Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I developed the android application for this project already, I\'m just having p

ID: 3909799 • Letter: I

Question

I developed the android application for this project already, I'm just having problems with the CRUD tests for espresso and jUnit. Can anyone tell me how I would do them or what they would look like? thanks

You are creating a web-based "business to business" application for the Nova Scotia seafood industry, called the Seafood Marketplace. You are tasked with creating a simple CRUD interface that permits creating, reading, updating and deleting businesses. Technical requirements: Code in Android Studio published to GitHub Use Android UI Elements to create a List interface with Create, Edit, and Delete buttons. Edit the contact class to add the required contact information - Use Firebase rules to ensure that entries follow formatting rules (see below) - use Javadoc - define at least 1 test for each CRUD operation Note: there is already a starting project on github. Fork this repo and start coding from it. The code will not compile once you fork it. You need to create your firebase database on firebase.google.com and download the google-services.json configuration file the package name is: "com.acme.a3csci3130". Ifyou want you can change it on the application gradle. Note also that the starting project assumes a contacts list, not a business list - this will need to be modified accordingly. Link: https://github.com/imfranz/A3csci3130 The starting project uses Firebase-UI for Android, a UI-DB data binding library. See the use of FirebaseListAdapter in MainActivity. DO NOT update the project version More info: https://github.com/firebase/FirebaseUI- Android. There is a file named fireRules.json -- this is an example of firebase rules for data validation. More information about firebase rules can be found here: https://firebase.google.com/docs/databasesec urity/securing-data#validating data Business data formatting rules: Business number: required, 9-digit number Name: required, 2-48 character Primary business: required, {Fisher, Distributor, Processor, Fish Monger; Address:

Explanation / Answer

CRUD stands for CREATE, READ, UPDATE, & DELETE.

These are the four operations that make a model complete. Any software model (that makes uses of APIs) requires four operations acronymed as CRUD. The CRUD paradigm is common in constructing web based applications, because it provides a definitive framework for reminding developers of how to construct fully functional models. CRUD is basically the ideal to create an application that would perform at most 4 basic functionalities we have mentioned above.

In your question, you are asked to create a CRUD interface in your application, which is a straightforward process while building an app. You will have to begin with create a custom unit test, and all files will be kept in a seperate folder called AndroidTest.

First, let’s imagine a system to keep track of library books. In this hypothetical library database, we can imagine that there would be a books resource, which would store book objects. Let’s say that the book object looks like this:

“book”: { "id": <Integer>, “title”: <String>, “author”: <String>, “isbn”: <Integer> }

To make this library system usable, we will have to make sure there are clear mechanisms for performing CRUD operations.

Create: This will consist of a function which we will call when a new library book is being added to the catalogue. The program calling the function would supply the values for “title”, “author”, and “isbn”. After this function is called, there should be a new entry in the books resource corresponding to this new book. Additionally, the new entry is assigned a unique id (@id/numBook), which can be used to access this resource later.

Read: This will consist of a function which would be called to see all of the books currently in the catalog. This function call will not alter the books in the catalog. It will simply retrieve the resource and display the results. We will also have a function to retrieve a single book, for which we could supply the title, author, or ISBN. Again, this book will not be modified, only retrieved.

Update: There should be a function to call when information about a book must be changed. The program calling the function would supply the new values for “title”, “author”, and “isbn”. After the function call, the corresponding entry in the books resource will contain the new fields supplied.

Delete: There should be a function to call to remove a library book from the catalog. The program calling the function would supply one or more values (“title”, “author”, and/or “isbn”) to identify the book, and then this book would be removed from the books resource. After this function is called, the books resource should contain all of the books it had before, except for the one just deleted.

We will focus on Test case classes using JUnit3, and here's the sample code to explain how easy it is.

In your android studio project, first create two packages with the names controller and database. Basically all business logic to create the database and do the C.R.U.D. will be placed in the package database and one layer above. It is used to insert some logic to call the class to insert or do some behavior will placed on controller.

Create the package database with the class DatabaseConstants. Copy and paste the code into your file DatabaseConstants. This class will be responsible to represent the table contact.

In the package database create another class with the name DatabaseHelper. It will help us to manage the database sqlite3 of android. There are two required methods of the class SQLiteOpenHelper. The first one is onCreate and onUpdate. The first one is only called when your database has been created and the second one is called when the version of the database has been changed.

Note: In a REST environment, CRUD often corresponds to the HTTP methods POST, GET, PUT, and DELETE, respectively. These are the fundamental elements of a persistent storage system.

CREATE

To create resources in a REST environment, we most commonly use the HTTP POST method. POST creates a new resource of the specified resource type.

Request:

POST http://www.myexample.com/books/

Body { "book": { "name": “Sapiens”, "price": 40 } }

READ

To read resources in a REST environment, we use the GET method. Reading a resource should never change any information - it should only retrieve it.

Request:

GET http://www.myexample.com/books

Body { "books": [ { "id": 1, "name": “Spring winds”, "price": 6 }, { "id": 2, "name": “City of glass”, "price": 7 }, ... { "id": 1223, "name": “Inner Engineering”, "price": 8 }, { "id": 1224, "name": “Norse myths”, "price": 5 } ] }

UPDATE

PUT is the HTTP method used for the CRUD operation, Update.

For example, if the price of a book (Norse myths, for example) has gone up, we should go into the database and update that information. We can do this with a PUT request.

Request:

PUT http://www.myexample.com/books/1224

Body { "book": { "name": “Norse myths”, "price": 10 } }

This request should change the item with id 1224 to have the attributes supplied in the request body. This book with id 1224 should now still have the name “Norse myths”, but the price value should now be 10, whereas before it was 8.

DELETE

The CRUD operation Delete corresponds to the HTTP method DELETE. It is used to remove a resource from the system.

Request: DELETE http://www.myexample.com/books/1224

Such a call, if successful, returns a response code of 204 (NO CONTENT), with no response body. The books resource should no longer contain the book object with id 1224.

So, this is the process of creating a unit class in your project.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote