Search in sources :

Example 1 with GRequest

use of org.raml.jaxrs.generator.ramltypes.GRequest in project raml-for-jax-rs by mulesoft-labs.

the class V10GResourceTest method simpleRequest.

@Test
public void simpleRequest() throws Exception {
    Api api = RamlV10.buildApiV10(this, "resource-simple.raml");
    GAbstractionFactory fac = new GAbstractionFactory();
    V10GResource gr = new V10GResource(new CurrentBuild(api, null), fac, api.resources().get(0));
    GRequest req = gr.methods().get(0).body().get(0);
    assertEquals("application/json", req.mediaType());
    assertEquals("ObjectBase", req.type().type());
    assertEquals("ObjectBase", req.type().name());
}
Also used : GRequest(org.raml.jaxrs.generator.ramltypes.GRequest) CurrentBuild(org.raml.jaxrs.generator.CurrentBuild) GAbstractionFactory(org.raml.jaxrs.generator.GAbstractionFactory) Api(org.raml.v2.api.model.v10.api.Api) Test(org.junit.Test)

Example 2 with GRequest

use of org.raml.jaxrs.generator.ramltypes.GRequest in project raml-for-jax-rs by mulesoft-labs.

the class V10GResourceTest method extendingRequest.

@Test
public void extendingRequest() throws Exception {
    Api api = RamlV10.buildApiV10(this, "resource-extending-request.raml");
    GAbstractionFactory fac = new GAbstractionFactory();
    V10GResource gr = new V10GResource(new CurrentBuild(api, null), fac, api.resources().get(0));
    GRequest req = gr.methods().get(0).body().get(0);
    assertEquals("application/json", req.mediaType());
    assertEquals("ObjectBase", req.type().type());
    assertEquals("FunPutApplicationJson", req.type().name());
    assertEquals("model.FunPutApplicationJson", req.type().defaultJavaTypeName("").toString());
}
Also used : GRequest(org.raml.jaxrs.generator.ramltypes.GRequest) CurrentBuild(org.raml.jaxrs.generator.CurrentBuild) GAbstractionFactory(org.raml.jaxrs.generator.GAbstractionFactory) Api(org.raml.v2.api.model.v10.api.Api) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 CurrentBuild (org.raml.jaxrs.generator.CurrentBuild)2 GAbstractionFactory (org.raml.jaxrs.generator.GAbstractionFactory)2 GRequest (org.raml.jaxrs.generator.ramltypes.GRequest)2 Api (org.raml.v2.api.model.v10.api.Api)2