public VertxEventBusBridgeBuilder addBridgeAddress(String address, Class<?> classWithAnnotations) { if (addressesToBridge == null) { addressesToBridge = new HashSet<>(); } addressesToBridge.add(address); if (address == null) { contextMetaBuilder.setRootURI("/").addService(classWithAnnotations); } else { contextMetaBuilder.setRootURI("/").addService(address, classWithAnnotations); } return this; }
@Override public void addRestSupportFor(Class cls, String baseURI) { contextMetaBuilder.setRootURI(baseURI).addService(cls); }
@Override public void addRestSupportFor(String alias, Class<?> cls, String baseURI) { contextMetaBuilder.setRootURI(baseURI).addService(alias, cls); }
/** * Get context meta builder. * * @return context meta builder */ public ContextMetaBuilder getContextMetaBuilder() { if (contextMetaBuilder == null) { contextMetaBuilder = ContextMetaBuilder.contextMetaBuilder(); contextMetaBuilder .setHostAddress(this.getPublicHost() + ":" + this.getPublicPort()) .setRootURI(this.getRootURI()); } return contextMetaBuilder; }
@Before public void setUp() throws Exception { contextMetaBuilder = ContextMetaBuilder.contextMetaBuilder(); contextMetaBuilder.setRootURI(contextMetaBuilder.getRootURI() + "Engine"); contextMetaBuilder.addService( SampleService.class); provider = new StandardMetaDataProvider(contextMetaBuilder.build(), RequestMethod.GET); }
contextMetaBuilder.setRootURI(contextMetaBuilder.getRootURI() + "Engine"); contextMetaBuilder.addService(SampleService.class);
public VertxEventBusBridgeBuilder addBridgeAddress(String address, Class<?> classWithAnnotations) { if (addressesToBridge == null) { addressesToBridge = new HashSet<>(); } addressesToBridge.add(address); if (address == null) { contextMetaBuilder.setRootURI("/").addService(classWithAnnotations); } else { contextMetaBuilder.setRootURI("/").addService(address, classWithAnnotations); } return this; }
@Override public void addRestSupportFor(String alias, Class<?> cls, String baseURI) { contextMetaBuilder.setRootURI(baseURI).addService(alias, cls); }
@Override public void addRestSupportFor(Class cls, String baseURI) { contextMetaBuilder.setRootURI(baseURI).addService(cls); }
@Override public void addRestSupportFor(Class cls, String baseURI) { contextMetaBuilder.setRootURI(baseURI).addService(cls); }
@Test public void testBuild() throws Exception { contextMetaBuilder.setRootURI(contextMetaBuilder.getRootURI() + "Engine"); contextMetaBuilder.addService(service("myService", "/myservice", method( "hello", getRequest( "/callme/", stringParam( headParam("foobarHeader") ), intParam( requestParam("helloMom") ), doubleParam( pathParam("score", 9) ) ) ) )); contextMetaBuilder.setServices(contextMetaBuilder.getServices()); ContextMeta context = contextMetaBuilder.build(); assertEquals("hello", context.getServices().get(0).getMethods().get(0).getName()); assertEquals("/callme/", context.getServices() .get(0).getMethods().get(0).getRequestEndpoints().get(0).getRequestURI()); }
public ContextMetaBuilder getAdminContextBuilder() { if (adminContextBuilder == null) { adminContextBuilder = ContextMetaBuilder.contextMetaBuilder(); adminContextBuilder.setDescription("QBit Admin interface, used to administrate and query status of QBit services"); adminContextBuilder.setTitle("QBit Admin interface"); adminContextBuilder.setVersion("0.9"); adminContextBuilder.setLicenseURL("https://github.com/advantageous/qbit/blob/master/License"); adminContextBuilder.setContactURL("http://www.mammatustech.com/"); adminContextBuilder.setRootURI(this.getEndpointServerBuilder().getUri()); if (this.getEndpointServerBuilder().getHost() != null) { adminContextBuilder.setHostAddress(this.getEndpointServerBuilder().getHost() + ":" + this.getEndpointServerBuilder().getPort()); } else { adminContextBuilder.setHostAddress("localhost:" + this.getEndpointServerBuilder().getPort()); } adminContextBuilder.addService(Admin.class); } return adminContextBuilder; }
@Test public void testBuildNestedBuilder() throws Exception { contextMetaBuilder.setRootURI(contextMetaBuilder.getRootURI() + "Engine"); contextMetaBuilder.addService( serviceMetaBuilder() .setName("myService") .addRequestPath("/myservice") .addMethod(method("hello", getRequest( "/callme/", stringParam( headParam("foobarHeader") ), intParam( requestParam("helloMom") ), doubleParam( pathParam("score", 9) ) ) )) .build()); contextMetaBuilder.setServices(contextMetaBuilder.getServices()); ContextMeta context = contextMetaBuilder.build(); assertEquals("hello", context.getServices().get(0).getMethods().get(0).getName()); assertEquals("/callme/", context.getServices() .get(0).getMethods().get(0).getRequestEndpoints().get(0).getRequestURI()); }
@Test public void testBuildNestedBuilder2() throws Exception { contextMetaBuilder.setRootURI(contextMetaBuilder.getRootURI() + "Engine"); contextMetaBuilder.addService( serviceMetaBuilder() .setName("myService") .addRequestPath("/myservice") .addMethod( serviceMethodMetaBuilder().setName("hello") .addRequestEndpoint(getRequest( "/callme/", stringParam( headParam("foobarHeader") ), intParam( requestParam("helloMom") ), doubleParam( pathParam("score", 9) ) )).build() ) .build()); contextMetaBuilder.setServices(contextMetaBuilder.getServices()); ContextMeta context = contextMetaBuilder.build(); assertEquals("hello", context.getServices().get(0).getMethods().get(0).getName()); assertEquals("/callme/", context.getServices() .get(0).getMethods().get(0).getRequestEndpoints().get(0).getRequestURI()); }
@Before public void setUp() throws Exception { contextMetaBuilder = ContextMetaBuilder.contextMetaBuilder(); contextMetaBuilder.setContactEmail("rick@rick.com"); contextMetaBuilder.setContactName("Rick Hightower"); contextMetaBuilder.setContactURL("https://github.com/advantageous/qbit"); contextMetaBuilder.setHostAddress("localhost:9090"); contextMetaBuilder.setDescription("Test set of services"); contextMetaBuilder.setLicenseName("APACHE 2"); contextMetaBuilder.setLicenseURL("https://github.com/advantageous/qbit/blob/master/License"); metaToSwagger = new MetaTransformerFromQbitMetaToSwagger(); contextMetaBuilder.setRootURI(contextMetaBuilder.getRootURI() + "Engine"); contextMetaBuilder.addService(SampleService.class); final ContextMeta context = contextMetaBuilder.build(); final ServiceEndpointInfo serviceEndpointInfo = metaToSwagger.serviceEndpointInfo(context); JsonSerializer jsonSerializer = new JsonSerializerFactory().setUseAnnotations(true).create(); System.out.println(jsonSerializer.serialize(serviceEndpointInfo)); }
@Test public void testBuildNestedBuilder3() throws Exception { contextMetaBuilder.setRootURI(contextMetaBuilder.getRootURI() + "Engine"); contextMetaBuilder.addService( serviceMetaBuilder() .setName("myService") .addRequestPath("/myservice") .addMethod( serviceMethodMetaBuilder().setName("hello") .addRequestEndpoint( requestMetaBuilder().setRequestURI("/callme/").addParameters( stringParam( headParam("foobarHeader") ), intParam( requestParam("helloMom") ), doubleParam( pathParam("score", 9) ) ).build() ).build() ) .build()); contextMetaBuilder.setServices(contextMetaBuilder.getServices()); ContextMeta context = contextMetaBuilder.build(); assertEquals("hello", context.getServices().get(0).getMethods().get(0).getName()); assertEquals("/callme/", context.getServices() .get(0).getMethods().get(0).getRequestEndpoints().get(0).getRequestURI()); }