@Test public void testVersionInfoComponent() throws URISyntaxException { Info info = new Info().version("1.0"); Swagger2MarkupConverter.Context context = createContext(); MarkupDocBuilder markupDocBuilder = context.createMarkupDocBuilder(); markupDocBuilder = new VersionInfoComponent(context).apply(markupDocBuilder, VersionInfoComponent.parameters(info, OverviewDocument.SECTION_TITLE_LEVEL)); markupDocBuilder.writeToFileWithoutExtension(outputDirectory, StandardCharsets.UTF_8); Path expectedFile = getExpectedFile(COMPONENT_NAME); DiffUtils.assertThatFileIsEqual(expectedFile, outputDirectory, getReportName(COMPONENT_NAME)); } }
@Test public void testLicenseInfoComponent() throws URISyntaxException { Info info = new Info() .license(new License().name("Apache 2.0").url("http://www.apache.org/licenses/LICENSE-2.0")) .termsOfService("Bla bla bla"); Swagger2MarkupConverter.Context context = createContext(); MarkupDocBuilder markupDocBuilder = context.createMarkupDocBuilder(); markupDocBuilder = new LicenseInfoComponent(context).apply(markupDocBuilder, LicenseInfoComponent.parameters(info, OverviewDocument.SECTION_TITLE_LEVEL)); markupDocBuilder.writeToFileWithoutExtension(outputDirectory, StandardCharsets.UTF_8); Path expectedFile = getExpectedFile(COMPONENT_NAME); DiffUtils.assertThatFileIsEqual(expectedFile, outputDirectory, getReportName(COMPONENT_NAME)); } }
private void correctInfo() { Info info = swagger.getInfo(); if (info == null) { info = new Info(); swagger.setInfo(info); } if (StringUtils.isEmpty(info.getTitle())) { info.setTitle("swagger definition for " + cls.getName()); } if (StringUtils.isEmpty(info.getVersion())) { info.setVersion("1.0.0"); } setJavaInterface(info, cls); }
private void setInfoFromAnnotation() { Info resultInfo = new Info(); for (Class<?> aClass : getValidClasses(SwaggerDefinition.class)) { SwaggerDefinition swaggerDefinition = AnnotationUtils.findAnnotation(aClass, SwaggerDefinition.class); io.swagger.annotations.Info infoAnnotation = swaggerDefinition.info(); Info info = new Info().title(infoAnnotation.title()) .description(emptyToNull(infoAnnotation.description())) .version(infoAnnotation.version()) .termsOfService(emptyToNull(infoAnnotation.termsOfService())) .license(from(infoAnnotation.license())) .contact(from(infoAnnotation.contact())); Map<String, Object> customExtensions = BaseReaderUtils.parseExtensions(infoAnnotation.extensions()); for (Map.Entry<String, Object> extension : customExtensions.entrySet()) { resultInfo.setVendorExtension(extension.getKey(), extension.getValue()); } resultInfo.mergeWith(info); } info = resultInfo; }
@Override public Info[] search(short length) { Info[] infolist = new Info[length]; for (int i = 0; i < infolist.length; i++) { infolist[i] = new Info("New Name"); } return infolist; }
public ResponseEntity<?> foo() { if (condition1) { return new InfoResponseEntity<Info>(new Info()); } return new VoidResponseEntity<Void>(); }
private void convertInfo(io.swagger.annotations.Info infoAnnotation, Swagger swagger) { if (infoAnnotation == null) { return; } Info info = new Info(); info.setTitle(infoAnnotation.title()); info.setVersion(infoAnnotation.version()); info.setDescription(infoAnnotation.description()); info.setTermsOfService(infoAnnotation.termsOfService()); info.setContact(convertContact(infoAnnotation.contact())); info.setLicense(convertLicense(infoAnnotation.license())); info.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(infoAnnotation.extensions())); swagger.setInfo(info); }
Info ii = new Info(); for (int i = 0; i < 1000; i++) { Thread t = new Thread(new ThreadJunk(ii)); t.start(); }
@Override protected void configure() { Info info = new Info() .title("Rakam API Documentation") .version(ServiceStarter.RAKAM_VERSION)
for(int j=0;j<100;j++) { Info ii = new Info(); for(int i=0;i<1000;i++) { Thread t = new Thread(new ThreadJunk(ii)); t.start(); } System.out.println(ii.getValue()); }
public static void main(String[] args) { Info info = new Info(); // your newly created class for(Letters l: info.getLettersInfo(plainText)) { // ... } }
public class Cookie { public static void main(String[] args) { try { Info info = new Info(); info.checkInput(); } catch(Exception e) { System.err.println("Error! " + e.getMessage()); } } }
private Info createInfo() { Info info = new Info(); info.title(System.getProperty(DaemonProperties.SERVICE_NAME, "")); String version = this.getClass().getPackage().getImplementationVersion(); info.version(version != null ? version : "0.0"); return info; }
private Info getInfo() { Info info = new Info(); // version in general refers to major version of the project (kie server) though it uses minor as well to allow emergency type of changesinfo.setTitle("KIE-Server API"); // must be updated with every major release info.setVersion("7.0"); info.setTitle("KIE Server"); return info; }
protected Info generateInfo() { return new Info() .version("0.1") .title("Project REST API") .description("Generated Swagger documentation"); }
public AppStorageApplication() { BeanConfig beanConfig = new BeanConfig(); beanConfig.setBasePath("/rest"); beanConfig.setResourcePackage(AppStorageServer.class.getPackage().getName()); beanConfig.setScan(); beanConfig.setInfo(new Info() .title("AFS storage API") .version(AfsRestApi.VERSION) .description("This is the documentation of AFS storage REST API")); } }
private Info getInfo() { Info info = new Info(); Contact contact = new Contact(); contact.setName(serviceTemplate.getMetadata().get(BluePrintConstants.METADATA_TEMPLATE_AUTHOR)); info.setContact(contact); info.setTitle(serviceTemplate.getMetadata().get(BluePrintConstants.METADATA_TEMPLATE_NAME)); info.setDescription(serviceTemplate.getDescription()); info.setVersion(serviceTemplate.getMetadata().get(BluePrintConstants.METADATA_TEMPLATE_VERSION)); return info; }
@Test public void shouldDetermineConnectorName() { final Swagger swagger = new Swagger(); assertThat(generator.determineConnectorName(SWAGGER_TEMPLATE, createSettingsFrom(swagger))).isEqualTo("unspecified"); final Info info = new Info(); swagger.info(info); assertThat(generator.determineConnectorName(SWAGGER_TEMPLATE, createSettingsFrom(swagger))).isEqualTo("unspecified"); info.title("title"); assertThat(generator.determineConnectorName(SWAGGER_TEMPLATE, createSettingsFrom(swagger))).isEqualTo("title"); }
@Test public void shouldDetermineConnectorName() { final Swagger swagger = new Swagger(); assertThat(generator.determineConnectorName(SWAGGER_TEMPLATE, createSettingsFrom(swagger))).isEqualTo("unspecified"); final Info info = new Info(); swagger.info(info); assertThat(generator.determineConnectorName(SWAGGER_TEMPLATE, createSettingsFrom(swagger))).isEqualTo("unspecified"); info.title("title"); assertThat(generator.determineConnectorName(SWAGGER_TEMPLATE, createSettingsFrom(swagger))).isEqualTo("title"); }
@Test public void shouldDetermineConnectorDescription() { final Swagger swagger = new Swagger(); assertThat(generator.determineConnectorDescription(SWAGGER_TEMPLATE, createSettingsFrom(swagger))).isEqualTo("unspecified"); final Info info = new Info(); swagger.info(info); assertThat(generator.determineConnectorDescription(SWAGGER_TEMPLATE, createSettingsFrom(swagger))).isEqualTo("unspecified"); info.description("description"); assertThat(generator.determineConnectorDescription(SWAGGER_TEMPLATE, createSettingsFrom(swagger))).isEqualTo("description"); }