Have a Question ?

Home / Answered Questions / Computing and IT / tasks-1-2-3-4-software-q-482

(Solved): Tasks 1, 2, 3 & 4 | software ...


Tasks

The School of Informatics has hired you to develop a system to keep modules' learning materials well organised and up to date. They are interested in keeping track of modules, who teaches them, and the lectures taught in each module. The data they are interested in keeping track of is as follows:

  • Modules: Module id (a unique identifier), module code (e.g., "CO2103", "CO3095"), title (e.g., "Software Architecture", "Calculus I"), the semester the module is taught at (an integer between 1 and 10), whether it is a core module or not (i.e., true or false).
  • Lectures: Lecture id (a unique identifier), week (an integer which defines the order in which a lecture is taught in a module), title (e.g., "Unit Testing"), and a url representing the online location of the slides for this lecture (no files, just the url).
  • Convenors: Convenor id (a unique identifier), name (e.g., "Jose Rojas"), position (either "GTA", "Lecturer" or "Professor") and office (e.g., "F27”)

The API should provide the options of creating (POST), retrieving (GET), editing (PUT/PATCH) and deleting (DELETE) existing modules, lectures and convenors. In other words, these are the resources that the API should provide endpoints for (including collections).

Besides the internal data needed for each resource as described above, there are evident relationships between these resources:

  • A module is taught by one convenor
  • A module is composed of an ordered sequence of lectures
  • A convenor can teach several modules
  • A lecture belongs to one specific module only

 

Task 1

Design and Documentation

Use SwaggerHub OR Swagger Editor to design and document a REST API that provides all the actions needed in the scenario described above. For each endpoint, you must provide a successful and an error response.

SwaggerHub: When creating your API on SwaggerHub, make sure to use OpenAPI Version 2.0 and set project visibility to "Private", so that nobody else can see your work and you end up involved in a plagiarism case. To create a Private API project, you will have to first Create an Organisation on a trial period of 14 days and then create the private API with the organisation as owner.

Swagger Editor: The Swagger Editor at http://editor.swagger.io/ is free to use. You can clear the editor and start from scratch (File > Clear Editor), or take inspiration from the Petstore API that loads up when you visit the website. To work effectively and avoid losing your work, you will have to save your work to your local computer frequently with File > Save as YAML and load it to continue working on it with File > Import file.

 

Submission

You must provide a swagger spec in JSON format for this task. The name of the file must be HiddenName.json . To produce this file, on SwaggerHub, you will have to click on Export > Download API > JSON Unresolved. Do not forget to rename your downloaded JSON spec to HiddenName.json. Finally, place the file in the src/main/resources/ directory of the Spring project you will create in Task 2.

 

Task 2

Implementation

Create a new Spring project on Sprint initializr

Load the project on Spring Tool Suite and use it to and implement the REST API you have designed in Task 1.

Once you are done, make sure your project runs and deploys on http://localhost:8080 when you run:

 

(THIS IS VERY IMPORTANT, IT MUST RUN WITH NO ERRORS)

 

 

 

Task 3

Testing

In the same project you created in Task 2, create a file named “C01234Tests.java” in package eduii.London to contain all your tests in a single class named C01234Tests and annotated with @SpringBootTest like this:

 

 

 

Write one executable test (annotated with @Test) and one curl example for each of the actions that you implement in your API (not just one example for each endpoint!).

You must provide a single test suite named AnythingForNowTests.java containing all your tests.

 

Once you have finished writing your tests, make sure you can execute:

(THIS IS VERY IMPORTANT, IT MUST RUN WITH NO ERRORS)

The curl examples will be provided as Javadoc for each of the tests in the same test suite (see example above); these examples will be collected and executed by an automated script. Make sure that each curl call is written in one single line and that it executes directly without modifications.

Submission of Tasks 2 and 3

Remember to place the swagger spec file from Task 1 in your project as src/main/resources/HiddenName.json. Then, you must export your Spring project as a zip file: File > Export > Archive File > Save in zip format. Make sure not to include sub-directories .gradle, bin and build (they are not needed)

Marking

To achieve up to 100;

  • Most endpoints have been included in the spec
  • Most endpoints have been implemented and run as expected, matching perfectly with the documentation
  • One successful and one error meaningful unit test has been implemented for most of the endpoints (including valid curl calls)


We have an Answer from Expert View Expert Answer

Expert Answer


Place a quick order to get a solution to these tasks and they will be ready in less than 2 days from now... 

We have an Answer from Expert
Buy This Answer $15

-- OR --

Subscribe To View Unlimited Answers
Subscribe $20 / Month