Skip to content

Latest commit

 

History

History
108 lines (73 loc) · 7.04 KB

frequentlyaskedquestions.asciidoc

File metadata and controls

108 lines (73 loc) · 7.04 KB

Frequently asked Questions

What editor/IDE should I use?

You may use any editor with which you are comfortable to perform the coursework. However, we recommend using the version of the popular Eclipse IDE which is included within the Programming IDE’s shortcut on each of your machines.

I get mvn is not recognized when running maven commands

This should no longer be possible on the University cluster machines, however if you get this issue please see one of the course demonstrators for help.

If you are getting this error on your own machine, then you have likely configured your PATH incorrectly. We recommend you refer to the installation guide (and Windows Tips) of the Apache Maven documentation.

I can’t see the .m2 folder mentioned in the tutorial for configuring Maven.

This section of the tutorial only applies to students working on their own machines, not those provided by the university!

Don’t worry. If you do not already have a ".m2" folder, you can simply create one and place the new settings.xml file inside.

When running mvn clean test -Parq-wildfly-remote I get the error Cannot deploy: test.war

At the top of the example test which you have been given as part of the quickstart (ContactRegistrationTest.java) you will see a createTestArchive() method annotated with @Deployment. This method is used to create a small .war file, containing the classes and their dependencies which are needed for your test. The general createTestArchive() method which we recommend is as follows:

@Deployment
public static Archive<?> createTestArchive() {
    File[] libs = Maven.resolver().loadPomFromFile("pom.xml")
            .resolve(
                    "io.swagger:swagger-jaxrs:1.5.16"
    ).withTransitivity().asFile();

    return ShrinkWrap
            .create(WebArchive.class, "test.war")
            .addPackages(true, "org.jboss.quickstarts.wfk")
            .addAsLibraries(libs)
            .addAsResource("META-INF/test-persistence.xml", "META-INF/persistence.xml")
            .addAsWebInfResource("arquillian-ds.xml")
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}

If you still run into problems, please ask a demonstrator for help.

I can’t work out how to do "…​"

The base quickstart which you have been provided with has been heavily modified to include extensive comments and clear examples of the techniques we expect you to use. If you cannot work out how to do a step in the coursework, we suggest you look closely at how it is done in the quickstart.

Failing that we suggest the following useful documentation:

Can I use "…​" instead of cURL?

There are several good plugins which replicate the functionality of the cURL command line tool in a more user friendly manner. We don’t mind if you choose to use one of these tools instead of cURL when testing your application.

Infact, we recommend a great Chrome extension called Postman.

You may of course use your Swagger documentation to interact with your API, in addition to any other options.

What if my customer’s details have already been taken on someone else’s service?

When working on part 3 of the coursework, you will encounter the requirement to make bookings between a customer in your service, and commodities (Flights, Taxis & Hotels) from external services. This could be difficult if you use common email addresses for your customers ([email protected] etc…​).

Our suggestion is that you follow how such a system would work in the real world: a travel agency is the customer from the point of view of the commodity service. Your own records should record the relationship between the actual customer (John Smith) and the various external booking ids, but the external services need have no knowledge of John Smith or his details.

Once you have decided on whose services to use in part 3 (and the details of your travel agent customer), we advise that you ask those students to add your Travel Agent customer’s details to their import.sql. This will mean that your travel agent customer will always exist on all external services it attempts to make bookings with.

I have added Swagger annotations but the service still doesn’t show up

When adding new packages for your new restful resources, make sure to add them to the Swagger config in ContactServiceApplication, as per the comments in that class. You will need to provide a single string containing each full package name (e.g. "org.jboss.quickstart.wfk.contact,org.jboss.quickstart.wfk.customer,…​") to the beanConfig.setResourcePackage(…​) method.

I am getting a 500 error when trying to POST a resource in Swagger

As mentioned in the tutorial video, swagger will try and include the id field in its default json object when POST ing a new resource. This is not allowed by the service, as the database will set Entity id fields itself. You should remove this line from the sample json input in Swagger’s interactive POST request forms. When you have done this - if the POST request still returns a 500 response - seek demonstrator help.

I can’t access h2console

If, when trying to log into h2console to try and view your application’s database structure, you get the following error:

General error: “javax.naming.NameNotFoundException: datasources/ContactsSwaggerQuickstartDS — service jboss.naming.contex.java.jboss.datasources.ContactsSwaggerQuickStartDS"

make sure that your JDBC Url field in the h2console login page is exactly java:jboss/datasources/JbossContactsSwaggerQuickstartDS. Be aware that this field’s value may have been autopopulated with an incorrect value.

Should I provide DELETE endpoints for my Customer/Commodity REST resources?

In the user stories for flight, taxi and hotel it specifically states the following:

Not be able to delete Customer or Flight records (these are unsupported operations).

However in the instructions for Part 2 of the coursework it states that you should implement:

  • REST endpoints to allow for the deletion of Customer and Commodity (Taxi/Hotel/Flight) resources.

  • Cascading deletion of related entities. Specifically, if a Commodity entity is deleted then any bookings made for it should also be deleted. Likewise, if a Customer entity is deleted, any bookings made by it should also be deleted.

This is obviously inconsistent and confusing, for which I apologise. The intention is that you do not need to provide delete operations for part 1. You will be able to get full marks for part 1 without having them there, however, they should be added when performing part 2, in order to verify that you have properly implemented relationship annotations and cascading deletes.