Search in sources :

Example 1 with GAbstractionFactory

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

the class ResourceHandler method handle.

public void handle(final Resource resource) {
    GAbstractionFactory factory = new GAbstractionFactory();
    ResourceBuilder rg = new ResourceBuilder(build, factory.newResource(build, resource), resource.resourcePath(), resource.relativeUri().value());
    build.newResource(rg);
}
Also used : ResourceBuilder(org.raml.jaxrs.generator.builders.resources.ResourceBuilder) GAbstractionFactory(org.raml.jaxrs.generator.GAbstractionFactory)

Example 2 with GAbstractionFactory

use of org.raml.jaxrs.generator.GAbstractionFactory 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 3 with GAbstractionFactory

use of org.raml.jaxrs.generator.GAbstractionFactory 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)

Example 4 with GAbstractionFactory

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

the class RamlV10 method buildResourceV10.

public static void buildResourceV10(Object test, String raml, CodeContainer<TypeSpec> container, String name, String uri) throws IOException {
    Api api = buildApiV10(test, raml);
    CurrentBuild currentBuild = new CurrentBuild(api, ExtensionManager.createExtensionManager());
    currentBuild.constructClasses(new V10Finder(null, api));
    ResourceBuilder builder = new ResourceBuilder(currentBuild, new V10GResource(currentBuild, new GAbstractionFactory(), api.resources().get(0)), name, uri);
    builder.output(container);
}
Also used : ResourceBuilder(org.raml.jaxrs.generator.builders.resources.ResourceBuilder) CurrentBuild(org.raml.jaxrs.generator.CurrentBuild) GAbstractionFactory(org.raml.jaxrs.generator.GAbstractionFactory) V10GResource(org.raml.jaxrs.generator.v10.V10GResource) Api(org.raml.v2.api.model.v10.api.Api) V10Finder(org.raml.jaxrs.generator.v10.V10Finder)

Example 5 with GAbstractionFactory

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

the class RamlV08 method buildResourceV08.

public static void buildResourceV08(Object test, String raml, CodeContainer<TypeSpec> container, String name, String uri) throws IOException {
    Api api = buildApiV08(test, raml);
    V08TypeRegistry registry = new V08TypeRegistry();
    V08Finder typeFinder = new V08Finder(api, new GAbstractionFactory(), registry);
    CurrentBuild currentBuild = new CurrentBuild(null, ExtensionManager.createExtensionManager());
    currentBuild.constructClasses(typeFinder);
    ResourceBuilder builder = new ResourceBuilder(currentBuild, new V08GResource(new GAbstractionFactory(), api.resources().get(0), typeFinder.globalSchemas().keySet(), registry), name, uri);
    builder.output(container);
}
Also used : ResourceBuilder(org.raml.jaxrs.generator.builders.resources.ResourceBuilder) V08Finder(org.raml.jaxrs.generator.v08.V08Finder) CurrentBuild(org.raml.jaxrs.generator.CurrentBuild) V08GResource(org.raml.jaxrs.generator.v08.V08GResource) GAbstractionFactory(org.raml.jaxrs.generator.GAbstractionFactory) V08TypeRegistry(org.raml.jaxrs.generator.v08.V08TypeRegistry) Api(org.raml.v2.api.model.v08.api.Api)

Aggregations

GAbstractionFactory (org.raml.jaxrs.generator.GAbstractionFactory)8 CurrentBuild (org.raml.jaxrs.generator.CurrentBuild)6 Api (org.raml.v2.api.model.v10.api.Api)5 Test (org.junit.Test)4 ResourceBuilder (org.raml.jaxrs.generator.builders.resources.ResourceBuilder)4 GRequest (org.raml.jaxrs.generator.ramltypes.GRequest)2 GResponseType (org.raml.jaxrs.generator.ramltypes.GResponseType)2 V08Finder (org.raml.jaxrs.generator.v08.V08Finder)1 V08GResource (org.raml.jaxrs.generator.v08.V08GResource)1 V08TypeRegistry (org.raml.jaxrs.generator.v08.V08TypeRegistry)1 V10Finder (org.raml.jaxrs.generator.v10.V10Finder)1 V10GResource (org.raml.jaxrs.generator.v10.V10GResource)1 Api (org.raml.v2.api.model.v08.api.Api)1