target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test void operation() { Operation operation = new RelationshipPatch(metaResource, metaResourceField, relatedMetaResource).operation(); Assert.assertTrue(operation.getResponses().containsKey("200")); } | @Override public Operation operation() { Operation operation = super.operation(); ApiResponse responseSchema = OASUtils.oneToMany(metaResourceField) ? new ResourceReferencesResponse(relatedMetaResource).$ref() : new ResourceReferenceResponse(relatedMetaResource).$ref(); responses.put("200", responseSchema); return oper... | RelationshipPatch extends AbstractNestedMutateOperation implements OASOperation { @Override public Operation operation() { Operation operation = super.operation(); ApiResponse responseSchema = OASUtils.oneToMany(metaResourceField) ? new ResourceReferencesResponse(relatedMetaResource).$ref() : new ResourceReferenceRespo... | RelationshipPatch extends AbstractNestedMutateOperation implements OASOperation { @Override public Operation operation() { Operation operation = super.operation(); ApiResponse responseSchema = OASUtils.oneToMany(metaResourceField) ? new ResourceReferencesResponse(relatedMetaResource).$ref() : new ResourceReferenceRespo... | RelationshipPatch extends AbstractNestedMutateOperation implements OASOperation { @Override public Operation operation() { Operation operation = super.operation(); ApiResponse responseSchema = OASUtils.oneToMany(metaResourceField) ? new ResourceReferencesResponse(relatedMetaResource).$ref() : new ResourceReferenceRespo... | RelationshipPatch extends AbstractNestedMutateOperation implements OASOperation { @Override public Operation operation() { Operation operation = super.operation(); ApiResponse responseSchema = OASUtils.oneToMany(metaResourceField) ? new ResourceReferencesResponse(relatedMetaResource).$ref() : new ResourceReferenceRespo... |
@Test void path() { RelationshipPatch RelationshipPatch = new RelationshipPatch(metaResource, metaResourceField, relatedMetaResource); Assert.assertEquals("/ResourcePath/{id}/relationships/someRelatedResource", RelationshipPatch.path()); } | @Override public String path() { return OASUtils.getRelationshipsPath(metaResource, metaResourceField); } | RelationshipPatch extends AbstractNestedMutateOperation implements OASOperation { @Override public String path() { return OASUtils.getRelationshipsPath(metaResource, metaResourceField); } } | RelationshipPatch extends AbstractNestedMutateOperation implements OASOperation { @Override public String path() { return OASUtils.getRelationshipsPath(metaResource, metaResourceField); } RelationshipPatch(MetaResource metaResource, MetaResourceField metaResourceField, MetaResource relatedMetaResource); } | RelationshipPatch extends AbstractNestedMutateOperation implements OASOperation { @Override public String path() { return OASUtils.getRelationshipsPath(metaResource, metaResourceField); } RelationshipPatch(MetaResource metaResource, MetaResourceField metaResourceField, MetaResource relatedMetaResource); @Override Opera... | RelationshipPatch extends AbstractNestedMutateOperation implements OASOperation { @Override public String path() { return OASUtils.getRelationshipsPath(metaResource, metaResourceField); } RelationshipPatch(MetaResource metaResource, MetaResourceField metaResourceField, MetaResource relatedMetaResource); @Override Opera... |
@Test public void testGenerateOpenApiContentGeneratesYamlUnsorted() throws IOException { compare( "gold/unsorted.yaml", OASGenerator.generateOpenApiContent(openApi, OutputFormat.YAML, false)); } | @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY); try {... | OASGenerator { @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABE... | OASGenerator { @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABE... | OASGenerator { @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABE... | OASGenerator { @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABE... |
@Test public void testGenerateOpenApiContentGeneratesYamlSorted() throws IOException { compare( "gold/sorted.yaml", OASGenerator.generateOpenApiContent(openApi, OutputFormat.YAML, true)); } | @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY); try {... | OASGenerator { @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABE... | OASGenerator { @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABE... | OASGenerator { @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABE... | OASGenerator { @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABE... |
@Test public void testGenerateOpenApiContentGeneratesJsonUnsorted() throws IOException { compare( "gold/unsorted.json", OASGenerator.generateOpenApiContent(openApi, OutputFormat.JSON, false)); } | @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY); try {... | OASGenerator { @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABE... | OASGenerator { @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABE... | OASGenerator { @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABE... | OASGenerator { @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABE... |
@Test public void testGenerateOpenApiContentGeneratesJsonSorted() throws IOException { compare( "gold/sorted.json", OASGenerator.generateOpenApiContent(openApi, OutputFormat.JSON, true)); } | @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY); try {... | OASGenerator { @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABE... | OASGenerator { @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABE... | OASGenerator { @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABE... | OASGenerator { @VisibleForTesting static String generateOpenApiContent(OpenAPI openApi, OutputFormat outputFormat, Boolean sort) { if (sort) { ObjectMapper objectMapper = outputFormat.mapper(); objectMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); objectMapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABE... |
@Test void schema() { Schema schema = new ResourceReferencesResponseSchema(metaResource).schema(); Assert.assertTrue(schema instanceof ObjectSchema); Assert.assertTrue(schema.getProperties().containsKey("data")); Assert.assertEquals(1, schema.getProperties().size()); Schema data = (Schema) schema.getProperties().get("d... | public Schema schema() { return new ObjectSchema() .addProperties( "data", new ArraySchema() .items(new ResourceReference(metaResource).$ref())); } | ResourceReferencesResponseSchema extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "data", new ArraySchema() .items(new ResourceReference(metaResource).$ref())); } } | ResourceReferencesResponseSchema extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "data", new ArraySchema() .items(new ResourceReference(metaResource).$ref())); } ResourceReferencesResponseSchema(MetaResource metaResource); } | ResourceReferencesResponseSchema extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "data", new ArraySchema() .items(new ResourceReference(metaResource).$ref())); } ResourceReferencesResponseSchema(MetaResource metaResource); Schema schema(); } | ResourceReferencesResponseSchema extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "data", new ArraySchema() .items(new ResourceReference(metaResource).$ref())); } ResourceReferencesResponseSchema(MetaResource metaResource); Schema schema(); } |
@Test void schema() { final Schema typeSchema = new TypeSchema(metaResource).schema(); assertNotNull(typeSchema); assertEquals(StringSchema.class, typeSchema.getClass()); assertIterableEquals(singletonList("ResourceType"), typeSchema.getEnum()); } | public Schema schema() { Schema typeSchema = new StringSchema() .description("The JSON:API resource type (" + metaResource.getResourceType() + ")"); typeSchema.addEnumItemObject(metaResource.getResourceType()); return typeSchema; } | TypeSchema extends AbstractSchemaGenerator { public Schema schema() { Schema typeSchema = new StringSchema() .description("The JSON:API resource type (" + metaResource.getResourceType() + ")"); typeSchema.addEnumItemObject(metaResource.getResourceType()); return typeSchema; } } | TypeSchema extends AbstractSchemaGenerator { public Schema schema() { Schema typeSchema = new StringSchema() .description("The JSON:API resource type (" + metaResource.getResourceType() + ")"); typeSchema.addEnumItemObject(metaResource.getResourceType()); return typeSchema; } TypeSchema(MetaResource metaResource); } | TypeSchema extends AbstractSchemaGenerator { public Schema schema() { Schema typeSchema = new StringSchema() .description("The JSON:API resource type (" + metaResource.getResourceType() + ")"); typeSchema.addEnumItemObject(metaResource.getResourceType()); return typeSchema; } TypeSchema(MetaResource metaResource); Sche... | TypeSchema extends AbstractSchemaGenerator { public Schema schema() { Schema typeSchema = new StringSchema() .description("The JSON:API resource type (" + metaResource.getResourceType() + ")"); typeSchema.addEnumItemObject(metaResource.getResourceType()); return typeSchema; } TypeSchema(MetaResource metaResource); Sche... |
@Test void schema() { Schema schema = new ApiError().schema(); Assert.assertTrue(schema instanceof ObjectSchema); Assert.assertTrue(schema.getProperties().containsKey("id")); Assert.assertTrue(schema.getProperties().containsKey("links")); Assert.assertTrue(schema.getProperties().containsKey("status")); Assert.assertTru... | public Schema schema() { return new ObjectSchema() .addProperties( "id", new StringSchema() .description("a unique identifier for this particular occurrence of the problem")) .addProperties("links", new ObjectSchema() .addProperties( "about", new StringSchema() .description("a link that leads to further details about t... | ApiError extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "id", new StringSchema() .description("a unique identifier for this particular occurrence of the problem")) .addProperties("links", new ObjectSchema() .addProperties( "about", new StringSchema() .description("a... | ApiError extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "id", new StringSchema() .description("a unique identifier for this particular occurrence of the problem")) .addProperties("links", new ObjectSchema() .addProperties( "about", new StringSchema() .description("a... | ApiError extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "id", new StringSchema() .description("a unique identifier for this particular occurrence of the problem")) .addProperties("links", new ObjectSchema() .addProperties( "about", new StringSchema() .description("a... | ApiError extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "id", new StringSchema() .description("a unique identifier for this particular occurrence of the problem")) .addProperties("links", new ObjectSchema() .addProperties( "about", new StringSchema() .description("a... |
@Test public void onCollectionRequestWithParamsGetShouldReturnCollection() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest(servletContext); request.setMethod("GET"); request.setContextPath(""); request.setServletPath("/api"); request.setPathInfo("/tasks"); request.setRequestURI("/api/task... | @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { ServletContext servletContext = getServletContext(); ServletRequestContext context = new ServletRequestContext(servletContext, request, response, boot.getWebPathPrefix(), defaultCharacterEncoding); RequestDis... | CrnkServlet extends HttpServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { ServletContext servletContext = getServletContext(); ServletRequestContext context = new ServletRequestContext(servletContext, request, response, boot.getWebPathPrefix(), def... | CrnkServlet extends HttpServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { ServletContext servletContext = getServletContext(); ServletRequestContext context = new ServletRequestContext(servletContext, request, response, boot.getWebPathPrefix(), def... | CrnkServlet extends HttpServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { ServletContext servletContext = getServletContext(); ServletRequestContext context = new ServletRequestContext(servletContext, request, response, boot.getWebPathPrefix(), def... | CrnkServlet extends HttpServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { ServletContext servletContext = getServletContext(); ServletRequestContext context = new ServletRequestContext(servletContext, request, response, boot.getWebPathPrefix(), def... |
@Test void schema() { Schema schema = new ResourceReferenceResponseSchema(metaResource).schema(); Assert.assertTrue(schema instanceof ObjectSchema); Assert.assertTrue(schema.getProperties().containsKey("data")); Assert.assertEquals(1, schema.getProperties().size()); Schema data = (Schema) schema.getProperties().get("da... | public Schema schema() { return new ObjectSchema() .addProperties( "data", new ResourceReference(metaResource).$ref()); } | ResourceReferenceResponseSchema extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "data", new ResourceReference(metaResource).$ref()); } } | ResourceReferenceResponseSchema extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "data", new ResourceReference(metaResource).$ref()); } ResourceReferenceResponseSchema(MetaResource metaResource); } | ResourceReferenceResponseSchema extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "data", new ResourceReference(metaResource).$ref()); } ResourceReferenceResponseSchema(MetaResource metaResource); Schema schema(); } | ResourceReferenceResponseSchema extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "data", new ResourceReference(metaResource).$ref()); } ResourceReferenceResponseSchema(MetaResource metaResource); Schema schema(); } |
@Test public void schema() { additionalMetaResourceField.setInsertable(true); final Schema dataSchema = new PostResourceData(metaResource).schema(); assertNotNull(dataSchema); assertEquals(ComposedSchema.class, dataSchema.getClass()); final List<Schema> allOf = ((ComposedSchema) dataSchema).getAllOf(); assertNotNull(al... | @Override public Schema schema() { return new ComposedSchema().allOf( OASUtils.getIncludedSchemaRefs( new PostResourceReference(metaResource), new ResourcePostAttributes(metaResource), new ResourcePostRelationships(metaResource) )); } | PostResourceData extends AbstractSchemaGenerator { @Override public Schema schema() { return new ComposedSchema().allOf( OASUtils.getIncludedSchemaRefs( new PostResourceReference(metaResource), new ResourcePostAttributes(metaResource), new ResourcePostRelationships(metaResource) )); } } | PostResourceData extends AbstractSchemaGenerator { @Override public Schema schema() { return new ComposedSchema().allOf( OASUtils.getIncludedSchemaRefs( new PostResourceReference(metaResource), new ResourcePostAttributes(metaResource), new ResourcePostRelationships(metaResource) )); } PostResourceData(MetaResource meta... | PostResourceData extends AbstractSchemaGenerator { @Override public Schema schema() { return new ComposedSchema().allOf( OASUtils.getIncludedSchemaRefs( new PostResourceReference(metaResource), new ResourcePostAttributes(metaResource), new ResourcePostRelationships(metaResource) )); } PostResourceData(MetaResource meta... | PostResourceData extends AbstractSchemaGenerator { @Override public Schema schema() { return new ComposedSchema().allOf( OASUtils.getIncludedSchemaRefs( new PostResourceReference(metaResource), new ResourcePostAttributes(metaResource), new ResourcePostRelationships(metaResource) )); } PostResourceData(MetaResource meta... |
@Test void schema() { Schema requestSchema = new PostResources(metaResource).schema(); assertNotNull(requestSchema); assertEquals(ObjectSchema.class, requestSchema.getClass()); ObjectSchema topLevelSchema = (ObjectSchema) requestSchema; assertIterableEquals(singleton("data"), topLevelSchema.getProperties().keySet()); S... | @Override public Schema schema() { return new ObjectSchema() .addRequiredItem("data") .addProperties("data", new ArraySchema() .items(new PostResourceData(metaResource).$ref())); } | PostResources extends AbstractSchemaGenerator { @Override public Schema schema() { return new ObjectSchema() .addRequiredItem("data") .addProperties("data", new ArraySchema() .items(new PostResourceData(metaResource).$ref())); } } | PostResources extends AbstractSchemaGenerator { @Override public Schema schema() { return new ObjectSchema() .addRequiredItem("data") .addProperties("data", new ArraySchema() .items(new PostResourceData(metaResource).$ref())); } PostResources(MetaResource metaResource); } | PostResources extends AbstractSchemaGenerator { @Override public Schema schema() { return new ObjectSchema() .addRequiredItem("data") .addProperties("data", new ArraySchema() .items(new PostResourceData(metaResource).$ref())); } PostResources(MetaResource metaResource); @Override Schema schema(); } | PostResources extends AbstractSchemaGenerator { @Override public Schema schema() { return new ObjectSchema() .addRequiredItem("data") .addProperties("data", new ArraySchema() .items(new PostResourceData(metaResource).$ref())); } PostResources(MetaResource metaResource); @Override Schema schema(); } |
@Test void schema() { Schema schema = new Links().schema(); Assert.assertTrue(schema instanceof ComposedSchema); List<Schema> allOf = ((ComposedSchema) schema).getAllOf(); Assert.assertEquals(2, allOf.size()); Assert.assertTrue(allOf.get(0) instanceof ObjectSchema); Assert.assertEquals(new Pagination().$ref().get$ref()... | public Schema schema() { return new ComposedSchema() .allOf( Arrays.asList( new ObjectSchema() .additionalProperties( new Link().$ref()), new Pagination().$ref() )) .description("Link members related to the primary data."); } | Links extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema() .allOf( Arrays.asList( new ObjectSchema() .additionalProperties( new Link().$ref()), new Pagination().$ref() )) .description("Link members related to the primary data."); } } | Links extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema() .allOf( Arrays.asList( new ObjectSchema() .additionalProperties( new Link().$ref()), new Pagination().$ref() )) .description("Link members related to the primary data."); } } | Links extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema() .allOf( Arrays.asList( new ObjectSchema() .additionalProperties( new Link().$ref()), new Pagination().$ref() )) .description("Link members related to the primary data."); } Schema schema(); } | Links extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema() .allOf( Arrays.asList( new ObjectSchema() .additionalProperties( new Link().$ref()), new Pagination().$ref() )) .description("Link members related to the primary data."); } Schema schema(); } |
@Test void schema() { Schema schema = new ResourceRelationships(metaResource).schema(); assertNotNull(schema); assertEquals(ObjectSchema.class, schema.getClass()); assertIterableEquals(singleton("relationships"), schema.getProperties().keySet()); Schema relationshipsSchema = ((ObjectSchema) schema).getProperties().get(... | @Override public Schema schema() { return super.schema() .description("Relationships between the resource and other JSON:API resources"); } | ResourceRelationships extends AbstractResourceAttributes { @Override public Schema schema() { return super.schema() .description("Relationships between the resource and other JSON:API resources"); } } | ResourceRelationships extends AbstractResourceAttributes { @Override public Schema schema() { return super.schema() .description("Relationships between the resource and other JSON:API resources"); } ResourceRelationships(MetaResource metaResource); } | ResourceRelationships extends AbstractResourceAttributes { @Override public Schema schema() { return super.schema() .description("Relationships between the resource and other JSON:API resources"); } ResourceRelationships(MetaResource metaResource); @Override Schema schema(); } | ResourceRelationships extends AbstractResourceAttributes { @Override public Schema schema() { return super.schema() .description("Relationships between the resource and other JSON:API resources"); } ResourceRelationships(MetaResource metaResource); @Override Schema schema(); } |
@Test void schema() { relationshipMetaResourceField.setUpdatable(true); Schema requestSchema = new PatchResource(metaResource).schema(); ObjectSchema topLevelSchema = (ObjectSchema) requestSchema; assertIterableEquals(singleton("data"), topLevelSchema.getProperties().keySet()); Schema dataSchema = topLevelSchema.getPro... | @Override public Schema schema() { return new ObjectSchema() .addRequiredItem("data") .addProperties("data", new ComposedSchema().allOf( OASUtils.getIncludedSchemaRefs( new ResourceReference(metaResource), new ResourcePatchAttributes(metaResource), new ResourcePatchRelationships(metaResource) ))); } | PatchResource extends AbstractSchemaGenerator { @Override public Schema schema() { return new ObjectSchema() .addRequiredItem("data") .addProperties("data", new ComposedSchema().allOf( OASUtils.getIncludedSchemaRefs( new ResourceReference(metaResource), new ResourcePatchAttributes(metaResource), new ResourcePatchRelati... | PatchResource extends AbstractSchemaGenerator { @Override public Schema schema() { return new ObjectSchema() .addRequiredItem("data") .addProperties("data", new ComposedSchema().allOf( OASUtils.getIncludedSchemaRefs( new ResourceReference(metaResource), new ResourcePatchAttributes(metaResource), new ResourcePatchRelati... | PatchResource extends AbstractSchemaGenerator { @Override public Schema schema() { return new ObjectSchema() .addRequiredItem("data") .addProperties("data", new ComposedSchema().allOf( OASUtils.getIncludedSchemaRefs( new ResourceReference(metaResource), new ResourcePatchAttributes(metaResource), new ResourcePatchRelati... | PatchResource extends AbstractSchemaGenerator { @Override public Schema schema() { return new ObjectSchema() .addRequiredItem("data") .addProperties("data", new ComposedSchema().allOf( OASUtils.getIncludedSchemaRefs( new ResourceReference(metaResource), new ResourcePatchAttributes(metaResource), new ResourcePatchRelati... |
@Test void schema() { Schema schema = new PostResourceReference(metaResource).schema(); Assert.assertTrue(schema instanceof ObjectSchema); Assert.assertTrue(schema.getProperties().containsKey("type")); Assert.assertTrue(schema.getProperties().containsKey("id")); Assert.assertEquals(2, schema.getProperties().size()); As... | public Schema schema() { MetaAttribute metaAttribute = getPrimaryKeyMetaResourceField(metaResource); return new ObjectSchema() .addProperties( "type", new TypeSchema(metaResource).schema()) .addProperties( "id", new ResourceAttribute(metaResource, metaAttribute).$ref()) .required(Collections.singletonList("type")); } | PostResourceReference extends AbstractSchemaGenerator { public Schema schema() { MetaAttribute metaAttribute = getPrimaryKeyMetaResourceField(metaResource); return new ObjectSchema() .addProperties( "type", new TypeSchema(metaResource).schema()) .addProperties( "id", new ResourceAttribute(metaResource, metaAttribute).$... | PostResourceReference extends AbstractSchemaGenerator { public Schema schema() { MetaAttribute metaAttribute = getPrimaryKeyMetaResourceField(metaResource); return new ObjectSchema() .addProperties( "type", new TypeSchema(metaResource).schema()) .addProperties( "id", new ResourceAttribute(metaResource, metaAttribute).$... | PostResourceReference extends AbstractSchemaGenerator { public Schema schema() { MetaAttribute metaAttribute = getPrimaryKeyMetaResourceField(metaResource); return new ObjectSchema() .addProperties( "type", new TypeSchema(metaResource).schema()) .addProperties( "id", new ResourceAttribute(metaResource, metaAttribute).$... | PostResourceReference extends AbstractSchemaGenerator { public Schema schema() { MetaAttribute metaAttribute = getPrimaryKeyMetaResourceField(metaResource); return new ObjectSchema() .addProperties( "type", new TypeSchema(metaResource).schema()) .addProperties( "id", new ResourceAttribute(metaResource, metaAttribute).$... |
@Test void schema() { Schema schema = new Info().schema(); Assert.assertTrue(schema instanceof ObjectSchema); Assert.assertTrue(schema.getProperties().containsKey("jsonapi")); Assert.assertTrue(schema.getProperties().containsKey("links")); Assert.assertTrue(schema.getProperties().containsKey("meta")); Assert.assertEqua... | public Schema schema() { return new ObjectSchema() .addProperties("jsonapi", new JsonApi().$ref()) .addProperties( "meta", new Meta().$ref()) .addProperties( "links", new Links().$ref()) .required(Collections.singletonList("meta")) .additionalProperties(false); } | Info extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties("jsonapi", new JsonApi().$ref()) .addProperties( "meta", new Meta().$ref()) .addProperties( "links", new Links().$ref()) .required(Collections.singletonList("meta")) .additionalProperties(false); } } | Info extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties("jsonapi", new JsonApi().$ref()) .addProperties( "meta", new Meta().$ref()) .addProperties( "links", new Links().$ref()) .required(Collections.singletonList("meta")) .additionalProperties(false); } } | Info extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties("jsonapi", new JsonApi().$ref()) .addProperties( "meta", new Meta().$ref()) .addProperties( "links", new Links().$ref()) .required(Collections.singletonList("meta")) .additionalProperties(false); } Schema schema();... | Info extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties("jsonapi", new JsonApi().$ref()) .addProperties( "meta", new Meta().$ref()) .addProperties( "links", new Links().$ref()) .required(Collections.singletonList("meta")) .additionalProperties(false); } Schema schema();... |
@Test void schemaPrimaryKey() { MetaResource metaResource = getTestMetaResource(); MetaResourceField metaResourceField = (MetaResourceField) metaResource.getChildren().get(0); Schema schema = new ResourceAttribute(metaResource, metaResourceField).schema(); Assert.assertTrue(schema instanceof StringSchema); Assert.asser... | public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInstance().applyFromModel(schema, metaResource, metaAttr... | ResourceAttribute extends AbstractSchemaGenerator { public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInst... | ResourceAttribute extends AbstractSchemaGenerator { public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInst... | ResourceAttribute extends AbstractSchemaGenerator { public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInst... | ResourceAttribute extends AbstractSchemaGenerator { public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInst... |
@Test void schema() { MetaResource metaResource = getTestMetaResource(); MetaResourceField additionalMetaResourceField = (MetaResourceField) metaResource.getChildren().get(1); Schema schema = new ResourceAttribute(metaResource, additionalMetaResourceField).schema(); Assert.assertTrue(schema instanceof StringSchema); As... | public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInstance().applyFromModel(schema, metaResource, metaAttr... | ResourceAttribute extends AbstractSchemaGenerator { public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInst... | ResourceAttribute extends AbstractSchemaGenerator { public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInst... | ResourceAttribute extends AbstractSchemaGenerator { public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInst... | ResourceAttribute extends AbstractSchemaGenerator { public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInst... |
@Test public void testUnacceptableRequestContentType() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest(servletContext); request.setMethod("GET"); request.setContextPath(""); request.setServletPath("/api"); request.setPathInfo("/tasks"); request.setRequestURI("/api/tasks"); request.setCont... | @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { ServletContext servletContext = getServletContext(); ServletRequestContext context = new ServletRequestContext(servletContext, request, response, boot.getWebPathPrefix(), defaultCharacterEncoding); RequestDis... | CrnkServlet extends HttpServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { ServletContext servletContext = getServletContext(); ServletRequestContext context = new ServletRequestContext(servletContext, request, response, boot.getWebPathPrefix(), def... | CrnkServlet extends HttpServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { ServletContext servletContext = getServletContext(); ServletRequestContext context = new ServletRequestContext(servletContext, request, response, boot.getWebPathPrefix(), def... | CrnkServlet extends HttpServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { ServletContext servletContext = getServletContext(); ServletRequestContext context = new ServletRequestContext(servletContext, request, response, boot.getWebPathPrefix(), def... | CrnkServlet extends HttpServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { ServletContext servletContext = getServletContext(); ServletRequestContext context = new ServletRequestContext(servletContext, request, response, boot.getWebPathPrefix(), def... |
@Test void schemaNullable() { MetaResource metaResource = getTestMetaResource(); MetaResourceField additionalMetaResourceField = (MetaResourceField) metaResource.getChildren().get(1); additionalMetaResourceField.setNullable(true); Schema schema = new ResourceAttribute(metaResource, additionalMetaResourceField).schema()... | public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInstance().applyFromModel(schema, metaResource, metaAttr... | ResourceAttribute extends AbstractSchemaGenerator { public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInst... | ResourceAttribute extends AbstractSchemaGenerator { public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInst... | ResourceAttribute extends AbstractSchemaGenerator { public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInst... | ResourceAttribute extends AbstractSchemaGenerator { public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInst... |
@Test @Disabled void notNullable() { MetaResource metaResource = getTestMetaResource(); MetaResourceField additionalMetaResourceField = (MetaResourceField) metaResource.getChildren().get(1); additionalMetaResourceField.setNullable(false); Schema schema = new ResourceAttribute(metaResource, additionalMetaResourceField).... | public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInstance().applyFromModel(schema, metaResource, metaAttr... | ResourceAttribute extends AbstractSchemaGenerator { public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInst... | ResourceAttribute extends AbstractSchemaGenerator { public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInst... | ResourceAttribute extends AbstractSchemaGenerator { public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInst... | ResourceAttribute extends AbstractSchemaGenerator { public Schema schema() { Schema schema = OASUtils.transformMetaResourceField(metaAttribute.getType()); if (metaAttribute.isPrimaryKeyAttribute()) { schema.setDescription("The JSON:API resource ID"); } schema.nullable(metaAttribute.isNullable()); OASAnnotations.getInst... |
@Test void schema() { Schema schema = new Meta().schema(); Assert.assertTrue(schema instanceof ObjectSchema); Assert.assertTrue((boolean) schema.getAdditionalProperties()); Assert.assertNull(schema.getProperties()); } | public Schema schema() { return new ObjectSchema() .description("Non-standard meta-information that can not be represented as an attribute or relationship.") .additionalProperties(true); } | Meta extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .description("Non-standard meta-information that can not be represented as an attribute or relationship.") .additionalProperties(true); } } | Meta extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .description("Non-standard meta-information that can not be represented as an attribute or relationship.") .additionalProperties(true); } } | Meta extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .description("Non-standard meta-information that can not be represented as an attribute or relationship.") .additionalProperties(true); } Schema schema(); } | Meta extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .description("Non-standard meta-information that can not be represented as an attribute or relationship.") .additionalProperties(true); } Schema schema(); } |
@Test void schema() { Schema schema = new Link().schema(); Assert.assertTrue(schema instanceof ComposedSchema); List<Schema> oneOf = ((ComposedSchema) schema).getOneOf(); Assert.assertEquals(2, oneOf.size()); StringSchema stringSchema = (StringSchema) oneOf.get(0); Assert.assertEquals("uri", stringSchema.getFormat()); ... | public Schema schema() { return new ComposedSchema() .oneOf( Arrays.asList( new StringSchema() .description("A string containing the link's URL.") .format("uri"), new ObjectSchema() .required(Collections.singletonList("href")) .addProperties( "href", new StringSchema() .format("uri") .description("A string containing t... | Link extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema() .oneOf( Arrays.asList( new StringSchema() .description("A string containing the link's URL.") .format("uri"), new ObjectSchema() .required(Collections.singletonList("href")) .addProperties( "href", new StringSchema() .format("ur... | Link extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema() .oneOf( Arrays.asList( new StringSchema() .description("A string containing the link's URL.") .format("uri"), new ObjectSchema() .required(Collections.singletonList("href")) .addProperties( "href", new StringSchema() .format("ur... | Link extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema() .oneOf( Arrays.asList( new StringSchema() .description("A string containing the link's URL.") .format("uri"), new ObjectSchema() .required(Collections.singletonList("href")) .addProperties( "href", new StringSchema() .format("ur... | Link extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema() .oneOf( Arrays.asList( new StringSchema() .description("A string containing the link's URL.") .format("uri"), new ObjectSchema() .required(Collections.singletonList("href")) .addProperties( "href", new StringSchema() .format("ur... |
@Test void schema() { Schema schema = new ResourceReference(metaResource).schema(); Assert.assertTrue(schema instanceof ObjectSchema); Assert.assertTrue(schema.getProperties().containsKey("id")); Assert.assertTrue(schema.getProperties().containsKey("type")); Assert.assertEquals(2, schema.getProperties().size()); Assert... | public Schema schema() { return new PostResourceReference(metaResource) .schema() .required(Arrays.asList("id", "type")); } | ResourceReference extends AbstractSchemaGenerator { public Schema schema() { return new PostResourceReference(metaResource) .schema() .required(Arrays.asList("id", "type")); } } | ResourceReference extends AbstractSchemaGenerator { public Schema schema() { return new PostResourceReference(metaResource) .schema() .required(Arrays.asList("id", "type")); } ResourceReference(MetaResource metaResource); } | ResourceReference extends AbstractSchemaGenerator { public Schema schema() { return new PostResourceReference(metaResource) .schema() .required(Arrays.asList("id", "type")); } ResourceReference(MetaResource metaResource); Schema schema(); } | ResourceReference extends AbstractSchemaGenerator { public Schema schema() { return new PostResourceReference(metaResource) .schema() .required(Arrays.asList("id", "type")); } ResourceReference(MetaResource metaResource); Schema schema(); } |
@Test void schema() { Schema requestSchema = new PostResource(metaResource).schema(); assertNotNull(requestSchema); assertEquals(ObjectSchema.class, requestSchema.getClass()); ObjectSchema topLevelSchema = (ObjectSchema) requestSchema; assertIterableEquals(singleton("data"), topLevelSchema.getProperties().keySet()); Sc... | @Override public Schema schema() { return new ObjectSchema() .addRequiredItem("data") .addProperties("data", new PostResourceData(metaResource).$ref()); } | PostResource extends AbstractSchemaGenerator { @Override public Schema schema() { return new ObjectSchema() .addRequiredItem("data") .addProperties("data", new PostResourceData(metaResource).$ref()); } } | PostResource extends AbstractSchemaGenerator { @Override public Schema schema() { return new ObjectSchema() .addRequiredItem("data") .addProperties("data", new PostResourceData(metaResource).$ref()); } PostResource(MetaResource metaResource); } | PostResource extends AbstractSchemaGenerator { @Override public Schema schema() { return new ObjectSchema() .addRequiredItem("data") .addProperties("data", new PostResourceData(metaResource).$ref()); } PostResource(MetaResource metaResource); @Override Schema schema(); } | PostResource extends AbstractSchemaGenerator { @Override public Schema schema() { return new ObjectSchema() .addRequiredItem("data") .addProperties("data", new PostResourceData(metaResource).$ref()); } PostResource(MetaResource metaResource); @Override Schema schema(); } |
@Test void schema() { Schema resourceSchema = new ResourceSchema(metaResource).schema(); assertNotNull(resourceSchema); assertEquals(ComposedSchema.class, resourceSchema.getClass()); assertIterableEquals(singletonList("attributes"), resourceSchema.getRequired()); List<Schema> allOf = ((ComposedSchema) resourceSchema).g... | public Schema schema() { return new ComposedSchema().allOf( OASUtils.getIncludedSchemaRefs( new ResourceReference(metaResource), new ResourceAttributes(metaResource), new ResourceRelationships(metaResource), new ResourceLinks(metaResource) )).addRequiredItem("attributes"); } | ResourceSchema extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema().allOf( OASUtils.getIncludedSchemaRefs( new ResourceReference(metaResource), new ResourceAttributes(metaResource), new ResourceRelationships(metaResource), new ResourceLinks(metaResource) )).addRequiredItem("attributes"... | ResourceSchema extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema().allOf( OASUtils.getIncludedSchemaRefs( new ResourceReference(metaResource), new ResourceAttributes(metaResource), new ResourceRelationships(metaResource), new ResourceLinks(metaResource) )).addRequiredItem("attributes"... | ResourceSchema extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema().allOf( OASUtils.getIncludedSchemaRefs( new ResourceReference(metaResource), new ResourceAttributes(metaResource), new ResourceRelationships(metaResource), new ResourceLinks(metaResource) )).addRequiredItem("attributes"... | ResourceSchema extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema().allOf( OASUtils.getIncludedSchemaRefs( new ResourceReference(metaResource), new ResourceAttributes(metaResource), new ResourceRelationships(metaResource), new ResourceLinks(metaResource) )).addRequiredItem("attributes"... |
@Test void schema() { Schema schema = new Success().schema(); Assert.assertTrue(schema instanceof ObjectSchema); Assert.assertTrue(schema.getProperties().containsKey("jsonapi")); Assert.assertTrue(schema.getProperties().containsKey("links")); Assert.assertTrue(schema.getProperties().containsKey("meta")); Assert.assertT... | public Schema schema() { return new ObjectSchema() .description("A JSON:API document with a single resource") .addProperties("jsonapi", new JsonApi().$ref()) .addProperties( "included", new ArraySchema() .items( new ObjectSchema() .addProperties( "type", new StringSchema() .description("The JSON:API resource type")) .a... | Success extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .description("A JSON:API document with a single resource") .addProperties("jsonapi", new JsonApi().$ref()) .addProperties( "included", new ArraySchema() .items( new ObjectSchema() .addProperties( "type", new StringSchema() .des... | Success extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .description("A JSON:API document with a single resource") .addProperties("jsonapi", new JsonApi().$ref()) .addProperties( "included", new ArraySchema() .items( new ObjectSchema() .addProperties( "type", new StringSchema() .des... | Success extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .description("A JSON:API document with a single resource") .addProperties("jsonapi", new JsonApi().$ref()) .addProperties( "included", new ArraySchema() .items( new ObjectSchema() .addProperties( "type", new StringSchema() .des... | Success extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .description("A JSON:API document with a single resource") .addProperties("jsonapi", new JsonApi().$ref()) .addProperties( "included", new ArraySchema() .items( new ObjectSchema() .addProperties( "type", new StringSchema() .des... |
@Test void schema() { Schema schema = new ResourceResponseSchema(metaResource).schema(); Assert.assertTrue(schema instanceof ComposedSchema); List<Schema> allOf = ((ComposedSchema) schema).getAllOf(); Assert.assertEquals(2, allOf.size()); Assert.assertEquals("#/components/schemas/Success", allOf.get(0).get$ref()); Sche... | public Schema schema() { return new ComposedSchema() .allOf( Arrays.asList( new Success().$ref(), new Schema() .addProperties( "data", new ResourceSchema(metaResource).$ref()) .required(Collections.singletonList("data")))); } | ResourceResponseSchema extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema() .allOf( Arrays.asList( new Success().$ref(), new Schema() .addProperties( "data", new ResourceSchema(metaResource).$ref()) .required(Collections.singletonList("data")))); } } | ResourceResponseSchema extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema() .allOf( Arrays.asList( new Success().$ref(), new Schema() .addProperties( "data", new ResourceSchema(metaResource).$ref()) .required(Collections.singletonList("data")))); } ResourceResponseSchema(MetaResource m... | ResourceResponseSchema extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema() .allOf( Arrays.asList( new Success().$ref(), new Schema() .addProperties( "data", new ResourceSchema(metaResource).$ref()) .required(Collections.singletonList("data")))); } ResourceResponseSchema(MetaResource m... | ResourceResponseSchema extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema() .allOf( Arrays.asList( new Success().$ref(), new Schema() .addProperties( "data", new ResourceSchema(metaResource).$ref()) .required(Collections.singletonList("data")))); } ResourceResponseSchema(MetaResource m... |
@Test void schema() { Schema schema = new ResourcesResponseSchema(metaResource).schema(); Assert.assertTrue(schema instanceof ComposedSchema); List<Schema> allOf = ((ComposedSchema) schema).getAllOf(); Assert.assertEquals(2, allOf.size()); Assert.assertEquals("#/components/schemas/Success", allOf.get(0).get$ref()); Sch... | public Schema schema() { return new ComposedSchema() .allOf( Arrays.asList( new Success().$ref(), new Schema() .addProperties( "data", new ArraySchema() .items(new ResourceSchema(metaResource).$ref())) .required(Collections.singletonList("data")))); } | ResourcesResponseSchema extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema() .allOf( Arrays.asList( new Success().$ref(), new Schema() .addProperties( "data", new ArraySchema() .items(new ResourceSchema(metaResource).$ref())) .required(Collections.singletonList("data")))); } } | ResourcesResponseSchema extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema() .allOf( Arrays.asList( new Success().$ref(), new Schema() .addProperties( "data", new ArraySchema() .items(new ResourceSchema(metaResource).$ref())) .required(Collections.singletonList("data")))); } ResourcesR... | ResourcesResponseSchema extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema() .allOf( Arrays.asList( new Success().$ref(), new Schema() .addProperties( "data", new ArraySchema() .items(new ResourceSchema(metaResource).$ref())) .required(Collections.singletonList("data")))); } ResourcesR... | ResourcesResponseSchema extends AbstractSchemaGenerator { public Schema schema() { return new ComposedSchema() .allOf( Arrays.asList( new Success().$ref(), new Schema() .addProperties( "data", new ArraySchema() .items(new ResourceSchema(metaResource).$ref())) .required(Collections.singletonList("data")))); } ResourcesR... |
@Test public void testMatchingException() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest(servletContext); request.setMethod("GET"); request.setContextPath(""); request.setServletPath("/api"); request.setPathInfo("/tasks-matching-exception"); request.setRequestURI("/api/matching-exception... | @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { ServletContext servletContext = getServletContext(); ServletRequestContext context = new ServletRequestContext(servletContext, request, response, boot.getWebPathPrefix(), defaultCharacterEncoding); RequestDis... | CrnkServlet extends HttpServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { ServletContext servletContext = getServletContext(); ServletRequestContext context = new ServletRequestContext(servletContext, request, response, boot.getWebPathPrefix(), def... | CrnkServlet extends HttpServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { ServletContext servletContext = getServletContext(); ServletRequestContext context = new ServletRequestContext(servletContext, request, response, boot.getWebPathPrefix(), def... | CrnkServlet extends HttpServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { ServletContext servletContext = getServletContext(); ServletRequestContext context = new ServletRequestContext(servletContext, request, response, boot.getWebPathPrefix(), def... | CrnkServlet extends HttpServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { ServletContext servletContext = getServletContext(); ServletRequestContext context = new ServletRequestContext(servletContext, request, response, boot.getWebPathPrefix(), def... |
@Test public void testEquals() { EqualsVerifier.forClass(ResourceIdentifier.class).usingGetClass().suppress(Warning.NONFINAL_FIELDS).verify(); Assert.assertEquals(ResourcePermission.ALL, ResourcePermission.ALL); Assert.assertEquals(ResourcePermission.DELETE, ResourcePermission.DELETE); Assert.assertEquals(ResourcePermi... | @Override public boolean equals(Object obj) { if (obj != null && obj.getClass() == ResourcePermission.class) { ResourcePermission p = (ResourcePermission) obj; return p.deleteAllowed == deleteAllowed && p.getAllowed == getAllowed && p.patchAllowed == patchAllowed && p.postAllowed == postAllowed; } return false; } | ResourcePermission { @Override public boolean equals(Object obj) { if (obj != null && obj.getClass() == ResourcePermission.class) { ResourcePermission p = (ResourcePermission) obj; return p.deleteAllowed == deleteAllowed && p.getAllowed == getAllowed && p.patchAllowed == patchAllowed && p.postAllowed == postAllowed; } ... | ResourcePermission { @Override public boolean equals(Object obj) { if (obj != null && obj.getClass() == ResourcePermission.class) { ResourcePermission p = (ResourcePermission) obj; return p.deleteAllowed == deleteAllowed && p.getAllowed == getAllowed && p.patchAllowed == patchAllowed && p.postAllowed == postAllowed; } ... | ResourcePermission { @Override public boolean equals(Object obj) { if (obj != null && obj.getClass() == ResourcePermission.class) { ResourcePermission p = (ResourcePermission) obj; return p.deleteAllowed == deleteAllowed && p.getAllowed == getAllowed && p.patchAllowed == patchAllowed && p.postAllowed == postAllowed; } ... | ResourcePermission { @Override public boolean equals(Object obj) { if (obj != null && obj.getClass() == ResourcePermission.class) { ResourcePermission p = (ResourcePermission) obj; return p.deleteAllowed == deleteAllowed && p.getAllowed == getAllowed && p.patchAllowed == patchAllowed && p.postAllowed == postAllowed; } ... |
@Test void schema() { Schema schema = new JsonApi().schema(); Assert.assertTrue(schema instanceof ObjectSchema); Assert.assertTrue(schema.getProperties().containsKey("version")); Assert.assertEquals(1, schema.getProperties().size()); } | public Schema schema() { return new ObjectSchema() .addProperties( "version", new StringSchema()) .additionalProperties(false); } | JsonApi extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "version", new StringSchema()) .additionalProperties(false); } } | JsonApi extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "version", new StringSchema()) .additionalProperties(false); } } | JsonApi extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "version", new StringSchema()) .additionalProperties(false); } Schema schema(); } | JsonApi extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "version", new StringSchema()) .additionalProperties(false); } Schema schema(); } |
@Test void schema() { Schema schema = new Failure().schema(); Assert.assertTrue(schema instanceof ObjectSchema); Assert.assertTrue(schema.getProperties().containsKey("jsonapi")); Assert.assertTrue(schema.getProperties().containsKey("errors")); Assert.assertTrue(schema.getProperties().containsKey("links")); Assert.asser... | public Schema schema() { return new ObjectSchema() .addProperties("jsonapi", new JsonApi().$ref()) .addProperties( "errors", new ArraySchema() .items(new ApiError().$ref()) .uniqueItems(true)) .addProperties( "meta", new Meta().$ref()) .addProperties( "links", new Links().$ref()) .required(Collections.singletonList("er... | Failure extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties("jsonapi", new JsonApi().$ref()) .addProperties( "errors", new ArraySchema() .items(new ApiError().$ref()) .uniqueItems(true)) .addProperties( "meta", new Meta().$ref()) .addProperties( "links", new Links().$ref(... | Failure extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties("jsonapi", new JsonApi().$ref()) .addProperties( "errors", new ArraySchema() .items(new ApiError().$ref()) .uniqueItems(true)) .addProperties( "meta", new Meta().$ref()) .addProperties( "links", new Links().$ref(... | Failure extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties("jsonapi", new JsonApi().$ref()) .addProperties( "errors", new ArraySchema() .items(new ApiError().$ref()) .uniqueItems(true)) .addProperties( "meta", new Meta().$ref()) .addProperties( "links", new Links().$ref(... | Failure extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties("jsonapi", new JsonApi().$ref()) .addProperties( "errors", new ArraySchema() .items(new ApiError().$ref()) .uniqueItems(true)) .addProperties( "meta", new Meta().$ref()) .addProperties( "links", new Links().$ref(... |
@Test void schema() { Schema schema = new Pagination().schema(); Assert.assertTrue(schema instanceof ObjectSchema); Stream.of("first", "last", "prev", "next").forEach( key -> { Schema subSchema = (Schema) schema.getProperties().get(key); Assert.assertTrue(subSchema instanceof StringSchema); Assert.assertTrue(subSchema.... | public Schema schema() { return new ObjectSchema() .addProperties( "first", new StringSchema() .description("The first page of data") .format("uri") .nullable(true)) .addProperties( "last", new StringSchema() .description("The last page of data") .format("uri") .nullable(true)) .addProperties( "prev", new StringSchema(... | Pagination extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "first", new StringSchema() .description("The first page of data") .format("uri") .nullable(true)) .addProperties( "last", new StringSchema() .description("The last page of data") .format("uri") .nullable(tru... | Pagination extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "first", new StringSchema() .description("The first page of data") .format("uri") .nullable(true)) .addProperties( "last", new StringSchema() .description("The last page of data") .format("uri") .nullable(tru... | Pagination extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "first", new StringSchema() .description("The first page of data") .format("uri") .nullable(true)) .addProperties( "last", new StringSchema() .description("The last page of data") .format("uri") .nullable(tru... | Pagination extends AbstractSchemaGenerator { public Schema schema() { return new ObjectSchema() .addProperties( "first", new StringSchema() .description("The first page of data") .format("uri") .nullable(true)) .addProperties( "last", new StringSchema() .description("The last page of data") .format("uri") .nullable(tru... |
@Test void response() { ApiResponse apiResponse = new ResourceReferencesResponse(metaResource).response(); Assert.assertNotNull(apiResponse); Assert.assertEquals("OK", apiResponse.getDescription()); Content content = apiResponse.getContent(); Assert.assertEquals(1, content.size()); Schema schema = content.get("applicat... | public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourceReferencesResponseSchema(metaResource).$ref()))); } | ResourceReferencesResponse extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourceReferencesResponseSchema(metaResource).$ref()))); } } | ResourceReferencesResponse extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourceReferencesResponseSchema(metaResource).$ref()))); } Resou... | ResourceReferencesResponse extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourceReferencesResponseSchema(metaResource).$ref()))); } Resou... | ResourceReferencesResponse extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourceReferencesResponseSchema(metaResource).$ref()))); } Resou... |
@Test void response() { ApiResponse apiResponse = new NoContent().response(); Assert.assertEquals("No Content", apiResponse.getDescription()); Assert.assertNull(apiResponse.getContent()); } | public ApiResponse response() { return new ApiResponse() .description("No Content"); } | NoContent extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description("No Content"); } } | NoContent extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description("No Content"); } } | NoContent extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description("No Content"); } ApiResponse response(); } | NoContent extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description("No Content"); } ApiResponse response(); } |
@Test void response() { ApiResponse apiResponse = new ResourceResponse(metaResource).response(); Assert.assertNotNull(apiResponse); Assert.assertEquals("OK", apiResponse.getDescription()); Content content = apiResponse.getContent(); Assert.assertEquals(1, content.size()); Schema schema = content.get("application/vnd.ap... | public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourceResponseSchema(metaResource).$ref()))); } | ResourceResponse extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourceResponseSchema(metaResource).$ref()))); } } | ResourceResponse extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourceResponseSchema(metaResource).$ref()))); } ResourceResponse(MetaReso... | ResourceResponse extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourceResponseSchema(metaResource).$ref()))); } ResourceResponse(MetaReso... | ResourceResponse extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourceResponseSchema(metaResource).$ref()))); } ResourceResponse(MetaReso... |
@Test void generateStandardApiResponses() { Map<String, ApiResponse> apiResponseMap = StaticResponses.generateStandardApiResponses(); Assert.assertEquals(16, apiResponseMap.size()); Assert.assertNotNull(apiResponseMap.get("NoContent")); Assert.assertNotNull(apiResponseMap.get("400")); Assert.assertNotNull(apiResponseMa... | public static Map<String, ApiResponse> generateStandardApiResponses() { return OASMergeUtil.mergeApiResponses(generateStandardApiSuccessResponses(), OASErrors.generateStandardApiErrorResponses()); } | StaticResponses { public static Map<String, ApiResponse> generateStandardApiResponses() { return OASMergeUtil.mergeApiResponses(generateStandardApiSuccessResponses(), OASErrors.generateStandardApiErrorResponses()); } } | StaticResponses { public static Map<String, ApiResponse> generateStandardApiResponses() { return OASMergeUtil.mergeApiResponses(generateStandardApiSuccessResponses(), OASErrors.generateStandardApiErrorResponses()); } } | StaticResponses { public static Map<String, ApiResponse> generateStandardApiResponses() { return OASMergeUtil.mergeApiResponses(generateStandardApiSuccessResponses(), OASErrors.generateStandardApiErrorResponses()); } static Map<String, ApiResponse> generateStandardApiResponses(); } | StaticResponses { public static Map<String, ApiResponse> generateStandardApiResponses() { return OASMergeUtil.mergeApiResponses(generateStandardApiSuccessResponses(), OASErrors.generateStandardApiErrorResponses()); } static Map<String, ApiResponse> generateStandardApiResponses(); } |
@Test void response() { ApiResponse apiResponse = new ResourcesResponse(metaResource).response(); Assert.assertNotNull(apiResponse); Assert.assertEquals("OK", apiResponse.getDescription()); Content content = apiResponse.getContent(); Assert.assertEquals(1, content.size()); Schema schema = content.get("application/vnd.a... | public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourcesResponseSchema(metaResource).$ref()))); } | ResourcesResponse extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourcesResponseSchema(metaResource).$ref()))); } } | ResourcesResponse extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourcesResponseSchema(metaResource).$ref()))); } ResourcesResponse(MetaR... | ResourcesResponse extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourcesResponseSchema(metaResource).$ref()))); } ResourcesResponse(MetaR... | ResourcesResponse extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourcesResponseSchema(metaResource).$ref()))); } ResourcesResponse(MetaR... |
@Test void response() { ApiResponse apiResponse = new ResourceReferenceResponse(metaResource).response(); Assert.assertNotNull(apiResponse); Assert.assertEquals("OK", apiResponse.getDescription()); Content content = apiResponse.getContent(); Assert.assertEquals(1, content.size()); Schema schema = content.get("applicati... | public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourceReferenceResponseSchema(metaResource).$ref()))); } | ResourceReferenceResponse extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourceReferenceResponseSchema(metaResource).$ref()))); } } | ResourceReferenceResponse extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourceReferenceResponseSchema(metaResource).$ref()))); } Resourc... | ResourceReferenceResponse extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourceReferenceResponseSchema(metaResource).$ref()))); } Resourc... | ResourceReferenceResponse extends AbstractResponseGenerator { public ApiResponse response() { return new ApiResponse() .description(HttpStatus.toMessage(200)) .content( new Content() .addMediaType( "application/vnd.api+json", new MediaType() .schema(new ResourceReferenceResponseSchema(metaResource).$ref()))); } Resourc... |
@Test public void testMergeOperations() { Operation thatOperation = new Operation(); Operation thisOperation = new Operation(); thisOperation.setOperationId("new id"); thisOperation.setSummary("new summary"); thisOperation.setDescription("new description"); Map<String, Object> extensions = new HashMap<>(); extensions.p... | public static Operation mergeOperations(Operation thisOperation, Operation thatOperation) { if (thatOperation == null) { return thisOperation; } if (thatOperation.getTags() != null) { thisOperation.setTags( mergeTags(thisOperation.getTags(), thatOperation.getTags()) ); } if (thatOperation.getExternalDocs() != null) { t... | OASMergeUtil { public static Operation mergeOperations(Operation thisOperation, Operation thatOperation) { if (thatOperation == null) { return thisOperation; } if (thatOperation.getTags() != null) { thisOperation.setTags( mergeTags(thisOperation.getTags(), thatOperation.getTags()) ); } if (thatOperation.getExternalDocs... | OASMergeUtil { public static Operation mergeOperations(Operation thisOperation, Operation thatOperation) { if (thatOperation == null) { return thisOperation; } if (thatOperation.getTags() != null) { thisOperation.setTags( mergeTags(thisOperation.getTags(), thatOperation.getTags()) ); } if (thatOperation.getExternalDocs... | OASMergeUtil { public static Operation mergeOperations(Operation thisOperation, Operation thatOperation) { if (thatOperation == null) { return thisOperation; } if (thatOperation.getTags() != null) { thisOperation.setTags( mergeTags(thisOperation.getTags(), thatOperation.getTags()) ); } if (thatOperation.getExternalDocs... | OASMergeUtil { public static Operation mergeOperations(Operation thisOperation, Operation thatOperation) { if (thatOperation == null) { return thisOperation; } if (thatOperation.getTags() != null) { thisOperation.setTags( mergeTags(thisOperation.getTags(), thatOperation.getTags()) ); } if (thatOperation.getExternalDocs... |
@Test public void concat() { MetaAttribute attr3 = Mockito.mock(MetaAttribute.class); Mockito.when(attr3.getName()).thenReturn("c"); Assert.assertEquals("a.b.c", path.concat(attr3).toString()); } | public MetaAttributePath concat(MetaAttribute... pathElements) { ArrayList<MetaAttribute> list = new ArrayList<>(); list.addAll(Arrays.asList(this.pathElements)); list.addAll(Arrays.asList(pathElements)); return to(list.toArray(newArray(0))); } | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttributePath concat(MetaAttribute... pathElements) { ArrayList<MetaAttribute> list = new ArrayList<>(); list.addAll(Arrays.asList(this.pathElements)); list.addAll(Arrays.asList(pathElements)); return to(list.toArray(newArray(0))); } } | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttributePath concat(MetaAttribute... pathElements) { ArrayList<MetaAttribute> list = new ArrayList<>(); list.addAll(Arrays.asList(this.pathElements)); list.addAll(Arrays.asList(pathElements)); return to(list.toArray(newArray(0))); } MetaAttributePath(Li... | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttributePath concat(MetaAttribute... pathElements) { ArrayList<MetaAttribute> list = new ArrayList<>(); list.addAll(Arrays.asList(this.pathElements)); list.addAll(Arrays.asList(pathElements)); return to(list.toArray(newArray(0))); } MetaAttributePath(Li... | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttributePath concat(MetaAttribute... pathElements) { ArrayList<MetaAttribute> list = new ArrayList<>(); list.addAll(Arrays.asList(this.pathElements)); list.addAll(Arrays.asList(pathElements)); return to(list.toArray(newArray(0))); } MetaAttributePath(Li... |
@Test void parameter() { Parameter parameter = new NestedFilter().parameter(); Assert.assertEquals("filter", parameter.getName()); Assert.assertEquals("query", parameter.getIn()); Assert.assertEquals("Customizable query (experimental)", parameter.getDescription()); Assert.assertNull(parameter.getRequired()); Schema sch... | public Parameter parameter() { return new Parameter() .name("filter") .description("Customizable query (experimental)") .in("query") .schema( new ObjectSchema() .addProperties( "AND", new ObjectSchema() .additionalProperties(true) .nullable(true)) .addProperties( "OR", new ObjectSchema() .additionalProperties(true) .nu... | NestedFilter extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("filter") .description("Customizable query (experimental)") .in("query") .schema( new ObjectSchema() .addProperties( "AND", new ObjectSchema() .additionalProperties(true) .nullable(true)) .addProperties( "OR", ... | NestedFilter extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("filter") .description("Customizable query (experimental)") .in("query") .schema( new ObjectSchema() .addProperties( "AND", new ObjectSchema() .additionalProperties(true) .nullable(true)) .addProperties( "OR", ... | NestedFilter extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("filter") .description("Customizable query (experimental)") .in("query") .schema( new ObjectSchema() .addProperties( "AND", new ObjectSchema() .additionalProperties(true) .nullable(true)) .addProperties( "OR", ... | NestedFilter extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("filter") .description("Customizable query (experimental)") .in("query") .schema( new ObjectSchema() .addProperties( "AND", new ObjectSchema() .additionalProperties(true) .nullable(true)) .addProperties( "OR", ... |
@Test void parameter() { Parameter parameter = new PrimaryKey(metaResource).parameter(); Assert.assertEquals("id", parameter.getName()); Assert.assertEquals("path", parameter.getIn()); Assert.assertTrue(parameter.getRequired()); Schema schema = parameter.getSchema(); Assert.assertEquals( "#/components/schemas/ResourceT... | public Parameter parameter() { MetaResourceField metaResourceField = OASUtils.getPrimaryKeyMetaResourceField(metaResource); return new Parameter() .name(metaResourceField.getName()) .in("path") .schema(new ResourceAttribute(metaResource, metaResourceField).$ref()); } | PrimaryKey extends AbstractParameterGenerator { public Parameter parameter() { MetaResourceField metaResourceField = OASUtils.getPrimaryKeyMetaResourceField(metaResource); return new Parameter() .name(metaResourceField.getName()) .in("path") .schema(new ResourceAttribute(metaResource, metaResourceField).$ref()); } } | PrimaryKey extends AbstractParameterGenerator { public Parameter parameter() { MetaResourceField metaResourceField = OASUtils.getPrimaryKeyMetaResourceField(metaResource); return new Parameter() .name(metaResourceField.getName()) .in("path") .schema(new ResourceAttribute(metaResource, metaResourceField).$ref()); } Prim... | PrimaryKey extends AbstractParameterGenerator { public Parameter parameter() { MetaResourceField metaResourceField = OASUtils.getPrimaryKeyMetaResourceField(metaResource); return new Parameter() .name(metaResourceField.getName()) .in("path") .schema(new ResourceAttribute(metaResource, metaResourceField).$ref()); } Prim... | PrimaryKey extends AbstractParameterGenerator { public Parameter parameter() { MetaResourceField metaResourceField = OASUtils.getPrimaryKeyMetaResourceField(metaResource); return new Parameter() .name(metaResourceField.getName()) .in("path") .schema(new ResourceAttribute(metaResource, metaResourceField).$ref()); } Prim... |
@Test void parameter() { Parameter parameter = new FieldFilter(metaResource, metaResourceField).parameter(); Assert.assertEquals("filter[id]", parameter.getName()); Assert.assertEquals("query", parameter.getIn()); Assert.assertEquals("Filter by id (csv)", parameter.getDescription()); Assert.assertNull(parameter.getRequ... | public Parameter parameter() { return new Parameter() .name("filter[" + metaResourceField.getName() + "]") .description("Filter by " + metaResourceField.getName() + " (csv)") .in("query") .schema(new StringSchema()); } | FieldFilter extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("filter[" + metaResourceField.getName() + "]") .description("Filter by " + metaResourceField.getName() + " (csv)") .in("query") .schema(new StringSchema()); } } | FieldFilter extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("filter[" + metaResourceField.getName() + "]") .description("Filter by " + metaResourceField.getName() + " (csv)") .in("query") .schema(new StringSchema()); } FieldFilter(MetaResource metaResource, MetaResourceF... | FieldFilter extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("filter[" + metaResourceField.getName() + "]") .description("Filter by " + metaResourceField.getName() + " (csv)") .in("query") .schema(new StringSchema()); } FieldFilter(MetaResource metaResource, MetaResourceF... | FieldFilter extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("filter[" + metaResourceField.getName() + "]") .description("Filter by " + metaResourceField.getName() + " (csv)") .in("query") .schema(new StringSchema()); } FieldFilter(MetaResource metaResource, MetaResourceF... |
@Test void parameter() { Parameter parameter = new Fields(metaResource).parameter(); Assert.assertEquals("fields", parameter.getName()); Assert.assertEquals("query", parameter.getIn()); Assert.assertEquals("ResourceType fields to include (csv)", parameter.getDescription()); Assert.assertNull(parameter.getRequired()); S... | public Parameter parameter() { return new Parameter() .name("fields") .description(metaResource.getResourceType() + " fields to include (csv)") .in("query") .schema(new StringSchema() ._default( OASUtils.attributes(metaResource, true) .map(MetaElement::getName) .collect(joining(",")))); } | Fields extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("fields") .description(metaResource.getResourceType() + " fields to include (csv)") .in("query") .schema(new StringSchema() ._default( OASUtils.attributes(metaResource, true) .map(MetaElement::getName) .collect(joini... | Fields extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("fields") .description(metaResource.getResourceType() + " fields to include (csv)") .in("query") .schema(new StringSchema() ._default( OASUtils.attributes(metaResource, true) .map(MetaElement::getName) .collect(joini... | Fields extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("fields") .description(metaResource.getResourceType() + " fields to include (csv)") .in("query") .schema(new StringSchema() ._default( OASUtils.attributes(metaResource, true) .map(MetaElement::getName) .collect(joini... | Fields extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("fields") .description(metaResource.getResourceType() + " fields to include (csv)") .in("query") .schema(new StringSchema() ._default( OASUtils.attributes(metaResource, true) .map(MetaElement::getName) .collect(joini... |
@Test void parameter() { Parameter parameter = new Include(metaResource).parameter(); Assert.assertEquals("include", parameter.getName()); Assert.assertEquals("query", parameter.getIn()); Assert.assertEquals("ResourceType relationships to include (csv)", parameter.getDescription()); Assert.assertNull(parameter.getRequi... | public Parameter parameter() { return new Parameter() .name("include") .description(metaResource.getResourceType() + " relationships to include (csv)") .in("query") .schema(new StringSchema() ._default( metaResource .getAttributes() .stream() .filter(MetaAttribute::isAssociation) .map(e -> e.getType().getElementType().... | Include extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("include") .description(metaResource.getResourceType() + " relationships to include (csv)") .in("query") .schema(new StringSchema() ._default( metaResource .getAttributes() .stream() .filter(MetaAttribute::isAssocia... | Include extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("include") .description(metaResource.getResourceType() + " relationships to include (csv)") .in("query") .schema(new StringSchema() ._default( metaResource .getAttributes() .stream() .filter(MetaAttribute::isAssocia... | Include extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("include") .description(metaResource.getResourceType() + " relationships to include (csv)") .in("query") .schema(new StringSchema() ._default( metaResource .getAttributes() .stream() .filter(MetaAttribute::isAssocia... | Include extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("include") .description(metaResource.getResourceType() + " relationships to include (csv)") .in("query") .schema(new StringSchema() ._default( metaResource .getAttributes() .stream() .filter(MetaAttribute::isAssocia... |
@Test void parameterNoSortableAttributes() { MetaResource metaResource = getTestMetaResource(); MetaResourceField metaResourceField = (MetaResourceField) metaResource.getChildren().get(0); MetaResourceField additionalMetaResourceField = (MetaResourceField) metaResource.getChildren().get(1); metaResourceField.setSortabl... | public Parameter parameter() { return new Parameter() .name("sort") .description(metaResource.getResourceType() + " sort order (csv)") .in("query") .schema(new StringSchema() .example( OASUtils.sortAttributes(metaResource, true) .map(MetaElement::getName) .collect(joining(",")))); } | Sort extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("sort") .description(metaResource.getResourceType() + " sort order (csv)") .in("query") .schema(new StringSchema() .example( OASUtils.sortAttributes(metaResource, true) .map(MetaElement::getName) .collect(joining(","))... | Sort extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("sort") .description(metaResource.getResourceType() + " sort order (csv)") .in("query") .schema(new StringSchema() .example( OASUtils.sortAttributes(metaResource, true) .map(MetaElement::getName) .collect(joining(","))... | Sort extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("sort") .description(metaResource.getResourceType() + " sort order (csv)") .in("query") .schema(new StringSchema() .example( OASUtils.sortAttributes(metaResource, true) .map(MetaElement::getName) .collect(joining(","))... | Sort extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("sort") .description(metaResource.getResourceType() + " sort order (csv)") .in("query") .schema(new StringSchema() .example( OASUtils.sortAttributes(metaResource, true) .map(MetaElement::getName) .collect(joining(","))... |
@Test void parameterSortableAttribute() { MetaResource metaResource = getTestMetaResource(); MetaResourceField metaResourceField = (MetaResourceField) metaResource.getChildren().get(0); MetaResourceField additionalMetaResourceField = (MetaResourceField) metaResource.getChildren().get(1); metaResourceField.setSortable(f... | public Parameter parameter() { return new Parameter() .name("sort") .description(metaResource.getResourceType() + " sort order (csv)") .in("query") .schema(new StringSchema() .example( OASUtils.sortAttributes(metaResource, true) .map(MetaElement::getName) .collect(joining(",")))); } | Sort extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("sort") .description(metaResource.getResourceType() + " sort order (csv)") .in("query") .schema(new StringSchema() .example( OASUtils.sortAttributes(metaResource, true) .map(MetaElement::getName) .collect(joining(","))... | Sort extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("sort") .description(metaResource.getResourceType() + " sort order (csv)") .in("query") .schema(new StringSchema() .example( OASUtils.sortAttributes(metaResource, true) .map(MetaElement::getName) .collect(joining(","))... | Sort extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("sort") .description(metaResource.getResourceType() + " sort order (csv)") .in("query") .schema(new StringSchema() .example( OASUtils.sortAttributes(metaResource, true) .map(MetaElement::getName) .collect(joining(","))... | Sort extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("sort") .description(metaResource.getResourceType() + " sort order (csv)") .in("query") .schema(new StringSchema() .example( OASUtils.sortAttributes(metaResource, true) .map(MetaElement::getName) .collect(joining(","))... |
@Test void parameterSortableAttributes() { MetaResource metaResource = getTestMetaResource(); MetaResourceField metaResourceField = (MetaResourceField) metaResource.getChildren().get(0); MetaResourceField additionalMetaResourceField = (MetaResourceField) metaResource.getChildren().get(1); metaResourceField.setSortable(... | public Parameter parameter() { return new Parameter() .name("sort") .description(metaResource.getResourceType() + " sort order (csv)") .in("query") .schema(new StringSchema() .example( OASUtils.sortAttributes(metaResource, true) .map(MetaElement::getName) .collect(joining(",")))); } | Sort extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("sort") .description(metaResource.getResourceType() + " sort order (csv)") .in("query") .schema(new StringSchema() .example( OASUtils.sortAttributes(metaResource, true) .map(MetaElement::getName) .collect(joining(","))... | Sort extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("sort") .description(metaResource.getResourceType() + " sort order (csv)") .in("query") .schema(new StringSchema() .example( OASUtils.sortAttributes(metaResource, true) .map(MetaElement::getName) .collect(joining(","))... | Sort extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("sort") .description(metaResource.getResourceType() + " sort order (csv)") .in("query") .schema(new StringSchema() .example( OASUtils.sortAttributes(metaResource, true) .map(MetaElement::getName) .collect(joining(","))... | Sort extends AbstractParameterGenerator { public Parameter parameter() { return new Parameter() .name("sort") .description(metaResource.getResourceType() + " sort order (csv)") .in("query") .schema(new StringSchema() .example( OASUtils.sortAttributes(metaResource, true) .map(MetaElement::getName) .collect(joining(","))... |
@Test public void test() { Map<String, ApiResponse> apiResponseCodes = OASErrors.generateStandardApiErrorResponses(); for (Map.Entry<String, ApiResponse> entry : apiResponseCodes.entrySet()) { Assert.assertTrue(entry.getKey().startsWith("4") || entry.getKey().startsWith("5")); ApiResponse apiResponse = entry.getValue()... | public static Map<String, ApiResponse> generateStandardApiErrorResponses() { Map<String, ApiResponse> responses = new LinkedHashMap<>(); List<Integer> responseCodes = getStandardHttpStatusCodes(); for (Integer responseCode : responseCodes) { if (responseCode >= 400 && responseCode <= 599) { ApiResponse apiResponse = ne... | OASErrors { public static Map<String, ApiResponse> generateStandardApiErrorResponses() { Map<String, ApiResponse> responses = new LinkedHashMap<>(); List<Integer> responseCodes = getStandardHttpStatusCodes(); for (Integer responseCode : responseCodes) { if (responseCode >= 400 && responseCode <= 599) { ApiResponse apiR... | OASErrors { public static Map<String, ApiResponse> generateStandardApiErrorResponses() { Map<String, ApiResponse> responses = new LinkedHashMap<>(); List<Integer> responseCodes = getStandardHttpStatusCodes(); for (Integer responseCode : responseCodes) { if (responseCode >= 400 && responseCode <= 599) { ApiResponse apiR... | OASErrors { public static Map<String, ApiResponse> generateStandardApiErrorResponses() { Map<String, ApiResponse> responses = new LinkedHashMap<>(); List<Integer> responseCodes = getStandardHttpStatusCodes(); for (Integer responseCode : responseCodes) { if (responseCode >= 400 && responseCode <= 599) { ApiResponse apiR... | OASErrors { public static Map<String, ApiResponse> generateStandardApiErrorResponses() { Map<String, ApiResponse> responses = new LinkedHashMap<>(); List<Integer> responseCodes = getStandardHttpStatusCodes(); for (Integer responseCode : responseCodes) { if (responseCode >= 400 && responseCode <= 599) { ApiResponse apiR... |
@Test public void notAField() { TSFunction function = new TSFunction(); Assert.assertFalse(function.isField()); } | @Override public boolean isField() { return false; } | TSFunction extends TSMember implements TSExportedElement { @Override public boolean isField() { return false; } } | TSFunction extends TSMember implements TSExportedElement { @Override public boolean isField() { return false; } } | TSFunction extends TSMember implements TSExportedElement { @Override public boolean isField() { return false; } @Override void accept(TSVisitor visitor); List<String> getStatements(); List<TSParameter> getParameters(); void setExported(boolean exported); @Override boolean isExported(); void addParameter(TSParameter pa... | TSFunction extends TSMember implements TSExportedElement { @Override public boolean isField() { return false; } @Override void accept(TSVisitor visitor); List<String> getStatements(); List<TSParameter> getParameters(); void setExported(boolean exported); @Override boolean isExported(); void addParameter(TSParameter pa... |
@Test public void toStringForEmptyPath() { Assert.assertEquals("", MetaAttributePath.EMPTY_PATH.toString()); } | @Override public String toString() { return render(PATH_SEPARATOR); } | MetaAttributePath implements Iterable<MetaAttribute> { @Override public String toString() { return render(PATH_SEPARATOR); } } | MetaAttributePath implements Iterable<MetaAttribute> { @Override public String toString() { return render(PATH_SEPARATOR); } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); } | MetaAttributePath implements Iterable<MetaAttribute> { @Override public String toString() { return render(PATH_SEPARATOR); } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); MetaAttributePath subPath(int startIndex); MetaAttributePath subPath(int startInd... | MetaAttributePath implements Iterable<MetaAttribute> { @Override public String toString() { return render(PATH_SEPARATOR); } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); MetaAttributePath subPath(int startIndex); MetaAttributePath subPath(int startInd... |
@Test(expected = UnsupportedOperationException.class) public void cannotCastToField() { TSFunction function = new TSFunction(); function.asField(); } | @Override public TSField asField() { throw new UnsupportedOperationException(); } | TSFunction extends TSMember implements TSExportedElement { @Override public TSField asField() { throw new UnsupportedOperationException(); } } | TSFunction extends TSMember implements TSExportedElement { @Override public TSField asField() { throw new UnsupportedOperationException(); } } | TSFunction extends TSMember implements TSExportedElement { @Override public TSField asField() { throw new UnsupportedOperationException(); } @Override void accept(TSVisitor visitor); List<String> getStatements(); List<TSParameter> getParameters(); void setExported(boolean exported); @Override boolean isExported(); voi... | TSFunction extends TSMember implements TSExportedElement { @Override public TSField asField() { throw new UnsupportedOperationException(); } @Override void accept(TSVisitor visitor); List<String> getStatements(); List<TSParameter> getParameters(); void setExported(boolean exported); @Override boolean isExported(); voi... |
@Test(expected = UnsupportedOperationException.class) public void throwExceptionWhenMetaElementNotMappedToNpmPackage() { TSMetaTransformationContext transformationContext = generator.createMetaTransformationContext(); MetaElement metaElement = Mockito.mock(MetaElement.class); metaElement.setId("does.not.exist"); transf... | protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } |
@Test(expected = UnsupportedOperationException.class) public void throwExceptionWhenMetaElementNotMappedToDirectory() { TSMetaTransformationContext transformationContext = generator.createMetaTransformationContext(); MetaElement metaElement = Mockito.mock(MetaElement.class); metaElement.setId("does.not.exist"); transfo... | protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } |
@Test(expected = IllegalStateException.class) public void throwExceptionWhenTransformingUnknownMetaElement() { MetaElement metaElement = Mockito.mock(MetaElement.class); metaElement.setId("does.not.exist"); TSMetaTransformationOptions options = Mockito.mock(TSMetaTransformationOptions.class); generator.transform(metaEl... | protected TSElement transform(MetaElement element, TSMetaTransformationOptions options) { if (elementSourceMap.containsKey(element)) { return elementSourceMap.get(element); } if (postProcessing) { throw new IllegalStateException("cannot add further element while post processing: " + element.getId()); } for (TSMetaTrans... | TSGenerator { protected TSElement transform(MetaElement element, TSMetaTransformationOptions options) { if (elementSourceMap.containsKey(element)) { return elementSourceMap.get(element); } if (postProcessing) { throw new IllegalStateException("cannot add further element while post processing: " + element.getId()); } fo... | TSGenerator { protected TSElement transform(MetaElement element, TSMetaTransformationOptions options) { if (elementSourceMap.containsKey(element)) { return elementSourceMap.get(element); } if (postProcessing) { throw new IllegalStateException("cannot add further element while post processing: " + element.getId()); } fo... | TSGenerator { protected TSElement transform(MetaElement element, TSMetaTransformationOptions options) { if (elementSourceMap.containsKey(element)) { return elementSourceMap.get(element); } if (postProcessing) { throw new IllegalStateException("cannot add further element while post processing: " + element.getId()); } fo... | TSGenerator { protected TSElement transform(MetaElement element, TSMetaTransformationOptions options) { if (elementSourceMap.containsKey(element)) { return elementSourceMap.get(element); } if (postProcessing) { throw new IllegalStateException("cannot add further element while post processing: " + element.getId()); } fo... |
@Test public void testResourcesMappedToRootDirectory() { MetaResource element = new MetaResource(); element.setImplementationType(Task.class); element.setId("resources.task"); TSMetaTransformationContext context = generator.createMetaTransformationContext(); Assert.assertEquals("", context.getDirectory(element)); } | protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } |
@Test public void testDataObjectsMappedToRootDirectoryByDefault() { MetaResource element = new MetaResource(); element.setImplementationType(ProjectData.class); element.setId("sometehing.task"); TSMetaTransformationContext context = generator.createMetaTransformationContext(); Assert.assertEquals("", context.getDirecto... | protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } |
@Test public void testDirectoryMapping() { MetaResource element = new MetaResource(); element.setImplementationType(ProjectData.class); element.setId("a.b.task"); config.getNpm().getDirectoryMapping().put("a", "x"); TSMetaTransformationContext context = generator.createMetaTransformationContext(); Assert.assertEquals("... | protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } |
@Test public void testNestedDirectoryMapping() { MetaResource element = new MetaResource(); element.setImplementationType(ProjectData.class); element.setId("a.b.task"); config.getNpm().getDirectoryMapping().put("a", "x/y"); TSMetaTransformationContext context = generator.createMetaTransformationContext(); Assert.assert... | protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } |
@Test public void testNestedDirectoryMappingIgnoresLeadingSlash() { MetaResource element = new MetaResource(); element.setImplementationType(ProjectData.class); element.setId("a.b.task"); config.getNpm().getDirectoryMapping().put("a", "/x/y"); TSMetaTransformationContext context = generator.createMetaTransformationCont... | protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } |
@Test public void testNestedDirectoryMappingIgnoresTrailingSlash() { MetaResource element = new MetaResource(); element.setImplementationType(ProjectData.class); element.setId("a.b.task"); config.getNpm().getDirectoryMapping().put("a", "x/y/"); TSMetaTransformationContext context = generator.createMetaTransformationCon... | protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } |
@Test public void toStringForSingleAttributePath() { MetaAttribute attr3 = Mockito.mock(MetaAttribute.class); Mockito.when(attr3.getName()).thenReturn("c"); path = new MetaAttributePath(Arrays.asList(attr3)); Assert.assertEquals("c", path.toString()); } | @Override public String toString() { return render(PATH_SEPARATOR); } | MetaAttributePath implements Iterable<MetaAttribute> { @Override public String toString() { return render(PATH_SEPARATOR); } } | MetaAttributePath implements Iterable<MetaAttribute> { @Override public String toString() { return render(PATH_SEPARATOR); } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); } | MetaAttributePath implements Iterable<MetaAttribute> { @Override public String toString() { return render(PATH_SEPARATOR); } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); MetaAttributePath subPath(int startIndex); MetaAttributePath subPath(int startInd... | MetaAttributePath implements Iterable<MetaAttribute> { @Override public String toString() { return render(PATH_SEPARATOR); } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); MetaAttributePath subPath(int startIndex); MetaAttributePath subPath(int startInd... |
@Test public void testEmptyDirectoryMapping() { MetaResource element = new MetaResource(); element.setImplementationType(ProjectData.class); element.setId("a.b.task"); config.getNpm().getDirectoryMapping().put("a", ""); TSMetaTransformationContext context = generator.createMetaTransformationContext(); Assert.assertEqua... | protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } |
@Test public void testRootDirectoryMapping() { MetaResource element = new MetaResource(); element.setImplementationType(ProjectData.class); element.setId("a.b.task"); config.getNpm().getDirectoryMapping().put("a.b", ""); TSMetaTransformationContext context = generator.createMetaTransformationContext(); Assert.assertEqu... | protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } |
@Test public void testRootDirectoryMappingIgnoresSlash() { MetaResource element = new MetaResource(); element.setImplementationType(ProjectData.class); element.setId("a.b.task"); config.getNpm().getDirectoryMapping().put("a.b", "/"); TSMetaTransformationContext context = generator.createMetaTransformationContext(); Ass... | protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } | TSGenerator { protected TSMetaTransformationContext createMetaTransformationContext() { return new TSMetaTransformationContextImpl(); } TSGenerator(File outputDir, MetaLookup lookup, TSGeneratorConfig config); void run(); void transformMetaToTypescript(); void runProcessors(); } |
@Test public void sameDirectoryImport() { List<TSSource> updatedSources = processor.process(sources); Assert.assertEquals(sources.size(), updatedSources.size()); Assert.assertEquals(1, classSource.getImports().size()); TSImport tsImport = classSource.getImports().get(0); Assert.assertEquals("./some-interface", tsImport... | @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } @Override List<TSSource> process(List<TSSource> sources); } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } @Override List<TSSource> process(List<TSSource> sources); } |
@Test public void childDirectoryImport() { interfaceSource.setDirectory("someDir/child-dir"); processor.process(sources); TSImport tsImport = classSource.getImports().get(0); Assert.assertEquals("./child-dir/some-interface", tsImport.getPath()); } | @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } @Override List<TSSource> process(List<TSSource> sources); } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } @Override List<TSSource> process(List<TSSource> sources); } |
@Test public void parentDirectoryImport() { interfaceSource.setDirectory(null); processor.process(sources); TSImport tsImport = classSource.getImports().get(0); Assert.assertEquals("../some-interface", tsImport.getPath()); } | @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } @Override List<TSSource> process(List<TSSource> sources); } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } @Override List<TSSource> process(List<TSSource> sources); } |
@Test public void siblingDirectoryImport() { interfaceSource.setDirectory("other-dir"); processor.process(sources); TSImport tsImport = classSource.getImports().get(0); Assert.assertEquals("../other-dir/some-interface", tsImport.getPath()); } | @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } @Override List<TSSource> process(List<TSSource> sources); } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } @Override List<TSSource> process(List<TSSource> sources); } |
@Test public void checkArrayElementTypeImported() { TSField field = new TSField(); field.setName("someField"); field.setType(new TSArrayType(interfaceType)); classType.addDeclaredMember(field); processor.process(sources); TSImport tsImport = classSource.getImports().get(0); Assert.assertEquals("./some-interface", tsImp... | @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } @Override List<TSSource> process(List<TSSource> sources); } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } @Override List<TSSource> process(List<TSSource> sources); } |
@Test public void checkParameterizedTypeImported() { TSInterfaceType parameterType = new TSInterfaceType(); parameterType.setName("ParamInterface"); TSSource paramSource = new TSSource(); paramSource.addElement(parameterType); paramSource.setNpmPackage("@crnk/test"); paramSource.setDirectory("someDir"); paramSource.set... | @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } @Override List<TSSource> process(List<TSSource> sources); } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } @Override List<TSSource> process(List<TSSource> sources); } |
@Test public void checkModuleImport() { TSInterfaceType moduleInterface = new TSInterfaceType(); moduleInterface.setName("SomeInterface"); TSModule module = new TSModule(); module.setName("SomeModule"); module.addElement(moduleInterface); TSSource moduleSource = new TSSource(); moduleSource.addElement(module); moduleSo... | @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } @Override List<TSSource> process(List<TSSource> sources); } | TSImportProcessor implements TSSourceProcessor { @Override public List<TSSource> process(List<TSSource> sources) { for (TSSource source : sources) { transform(source); sortImports(source); } return sources; } @Override List<TSSource> process(List<TSSource> sources); } |
@Test public void testHashCode() { MetaAttribute attr3 = Mockito.mock(MetaAttribute.class); Mockito.when(attr3.getName()).thenReturn("c"); MetaAttributePath path2 = new MetaAttributePath(Arrays.asList(attr3)); MetaAttributePath path3 = new MetaAttributePath(Arrays.asList(attr3)); Assert.assertNotEquals(path2.hashCode()... | @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Arrays.hashCode(pathElements); return result; } | MetaAttributePath implements Iterable<MetaAttribute> { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Arrays.hashCode(pathElements); return result; } } | MetaAttributePath implements Iterable<MetaAttribute> { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Arrays.hashCode(pathElements); return result; } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); } | MetaAttributePath implements Iterable<MetaAttribute> { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Arrays.hashCode(pathElements); return result; } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); MetaA... | MetaAttributePath implements Iterable<MetaAttribute> { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Arrays.hashCode(pathElements); return result; } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); MetaA... |
@Test public void testDisableBrowser() { UIModuleConfig config = new UIModuleConfig(); config.setBrowserEnabled(false); UIModule module = new UIModule(config); ModuleRegistry moduleRegistry = Mockito.mock(ModuleRegistry.class); Module.ModuleContext context = Mockito.mock(Module.ModuleContext.class); Mockito.when(contex... | @Override public void setupModule(ModuleContext context) { this.context = context; if(config.isBrowserEnabled()) { context.addHttpRequestProcessor(new UIHttpRequestProcessor(config)); setupHomeExtension(context); } if (config != null && config.isPresentationModelEnabled()) { Supplier<List<PresentationService>> services... | UIModule implements Module { @Override public void setupModule(ModuleContext context) { this.context = context; if(config.isBrowserEnabled()) { context.addHttpRequestProcessor(new UIHttpRequestProcessor(config)); setupHomeExtension(context); } if (config != null && config.isPresentationModelEnabled()) { Supplier<List<P... | UIModule implements Module { @Override public void setupModule(ModuleContext context) { this.context = context; if(config.isBrowserEnabled()) { context.addHttpRequestProcessor(new UIHttpRequestProcessor(config)); setupHomeExtension(context); } if (config != null && config.isPresentationModelEnabled()) { Supplier<List<P... | UIModule implements Module { @Override public void setupModule(ModuleContext context) { this.context = context; if(config.isBrowserEnabled()) { context.addHttpRequestProcessor(new UIHttpRequestProcessor(config)); setupHomeExtension(context); } if (config != null && config.isPresentationModelEnabled()) { Supplier<List<P... | UIModule implements Module { @Override public void setupModule(ModuleContext context) { this.context = context; if(config.isBrowserEnabled()) { context.addHttpRequestProcessor(new UIHttpRequestProcessor(config)); setupHomeExtension(context); } if (config != null && config.isPresentationModelEnabled()) { Supplier<List<P... |
@Test public void testDisablePresentationModel() { UIModuleConfig config = new UIModuleConfig(); config.setPresentationModelEnabled(false); UIModule module = new UIModule(config); ModuleRegistry moduleRegistry = Mockito.mock(ModuleRegistry.class); Module.ModuleContext context = Mockito.mock(Module.ModuleContext.class);... | @Override public void setupModule(ModuleContext context) { this.context = context; if(config.isBrowserEnabled()) { context.addHttpRequestProcessor(new UIHttpRequestProcessor(config)); setupHomeExtension(context); } if (config != null && config.isPresentationModelEnabled()) { Supplier<List<PresentationService>> services... | UIModule implements Module { @Override public void setupModule(ModuleContext context) { this.context = context; if(config.isBrowserEnabled()) { context.addHttpRequestProcessor(new UIHttpRequestProcessor(config)); setupHomeExtension(context); } if (config != null && config.isPresentationModelEnabled()) { Supplier<List<P... | UIModule implements Module { @Override public void setupModule(ModuleContext context) { this.context = context; if(config.isBrowserEnabled()) { context.addHttpRequestProcessor(new UIHttpRequestProcessor(config)); setupHomeExtension(context); } if (config != null && config.isPresentationModelEnabled()) { Supplier<List<P... | UIModule implements Module { @Override public void setupModule(ModuleContext context) { this.context = context; if(config.isBrowserEnabled()) { context.addHttpRequestProcessor(new UIHttpRequestProcessor(config)); setupHomeExtension(context); } if (config != null && config.isPresentationModelEnabled()) { Supplier<List<P... | UIModule implements Module { @Override public void setupModule(ModuleContext context) { this.context = context; if(config.isBrowserEnabled()) { context.addHttpRequestProcessor(new UIHttpRequestProcessor(config)); setupHomeExtension(context); } if (config != null && config.isPresentationModelEnabled()) { Supplier<List<P... |
@Test public void checkHomeModuleExtension() { HomeModule homeModule = HomeModule.create(); UIModule uiModule = UIModule.create(new UIModuleConfig()); CrnkBoot boot = new CrnkBoot(); boot.addModule(homeModule); boot.addModule(uiModule); boot.boot(); List<String> list = homeModule.list("/", new QueryContext()); Assert.a... | public static UIModule create(UIModuleConfig config) { return new UIModule(config); } | UIModule implements Module { public static UIModule create(UIModuleConfig config) { return new UIModule(config); } } | UIModule implements Module { public static UIModule create(UIModuleConfig config) { return new UIModule(config); } protected UIModule(); protected UIModule(UIModuleConfig config); } | UIModule implements Module { public static UIModule create(UIModuleConfig config) { return new UIModule(config); } protected UIModule(); protected UIModule(UIModuleConfig config); static UIModule create(UIModuleConfig config); String getModuleName(); @Override void setupModule(ModuleContext context); PresentationMana... | UIModule implements Module { public static UIModule create(UIModuleConfig config) { return new UIModule(config); } protected UIModule(); protected UIModule(UIModuleConfig config); static UIModule create(UIModuleConfig config); String getModuleName(); @Override void setupModule(ModuleContext context); PresentationMana... |
@Test public void checkHomeModuleIsOptional() { CrnkBoot boot = new CrnkBoot(); UIModule uiModule = UIModule.create(new UIModuleConfig()); boot.addModule(uiModule); boot.boot(); } | public static UIModule create(UIModuleConfig config) { return new UIModule(config); } | UIModule implements Module { public static UIModule create(UIModuleConfig config) { return new UIModule(config); } } | UIModule implements Module { public static UIModule create(UIModuleConfig config) { return new UIModule(config); } protected UIModule(); protected UIModule(UIModuleConfig config); } | UIModule implements Module { public static UIModule create(UIModuleConfig config) { return new UIModule(config); } protected UIModule(); protected UIModule(UIModuleConfig config); static UIModule create(UIModuleConfig config); String getModuleName(); @Override void setupModule(ModuleContext context); PresentationMana... | UIModule implements Module { public static UIModule create(UIModuleConfig config) { return new UIModule(config); } protected UIModule(); protected UIModule(UIModuleConfig config); static UIModule create(UIModuleConfig config); String getModuleName(); @Override void setupModule(ModuleContext context); PresentationMana... |
@Test public void length() { Assert.assertEquals(2, path.length()); } | public int length() { return pathElements.length; } | MetaAttributePath implements Iterable<MetaAttribute> { public int length() { return pathElements.length; } } | MetaAttributePath implements Iterable<MetaAttribute> { public int length() { return pathElements.length; } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); } | MetaAttributePath implements Iterable<MetaAttribute> { public int length() { return pathElements.length; } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); MetaAttributePath subPath(int startIndex); MetaAttributePath subPath(int startIndex, int endIndex);... | MetaAttributePath implements Iterable<MetaAttribute> { public int length() { return pathElements.length; } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); MetaAttributePath subPath(int startIndex); MetaAttributePath subPath(int startIndex, int endIndex);... |
@Test public void getLast() { Assert.assertEquals(attr2, path.getLast()); } | public MetaAttribute getLast() { if (pathElements != null && pathElements.length > 0) { return pathElements[pathElements.length - 1]; } return null; } | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttribute getLast() { if (pathElements != null && pathElements.length > 0) { return pathElements[pathElements.length - 1]; } return null; } } | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttribute getLast() { if (pathElements != null && pathElements.length > 0) { return pathElements[pathElements.length - 1]; } return null; } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); ... | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttribute getLast() { if (pathElements != null && pathElements.length > 0) { return pathElements[pathElements.length - 1]; } return null; } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); ... | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttribute getLast() { if (pathElements != null && pathElements.length > 0) { return pathElements[pathElements.length - 1]; } return null; } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); ... |
@Test public void iterator() { Iterator<MetaAttribute> iterator = path.iterator(); Assert.assertTrue(iterator.hasNext()); Assert.assertEquals("a", iterator.next().getName()); Assert.assertEquals("b", iterator.next().getName()); Assert.assertFalse(iterator.hasNext()); } | @Override public Iterator<MetaAttribute> iterator() { return Collections.unmodifiableList(Arrays.asList(pathElements)).iterator(); } | MetaAttributePath implements Iterable<MetaAttribute> { @Override public Iterator<MetaAttribute> iterator() { return Collections.unmodifiableList(Arrays.asList(pathElements)).iterator(); } } | MetaAttributePath implements Iterable<MetaAttribute> { @Override public Iterator<MetaAttribute> iterator() { return Collections.unmodifiableList(Arrays.asList(pathElements)).iterator(); } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); } | MetaAttributePath implements Iterable<MetaAttribute> { @Override public Iterator<MetaAttribute> iterator() { return Collections.unmodifiableList(Arrays.asList(pathElements)).iterator(); } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); MetaAttributePath ... | MetaAttributePath implements Iterable<MetaAttribute> { @Override public Iterator<MetaAttribute> iterator() { return Collections.unmodifiableList(Arrays.asList(pathElements)).iterator(); } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); MetaAttributePath ... |
@Test public void getLastForEmptyPath() { Assert.assertNull(MetaAttributePath.EMPTY_PATH.getLast()); } | public MetaAttribute getLast() { if (pathElements != null && pathElements.length > 0) { return pathElements[pathElements.length - 1]; } return null; } | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttribute getLast() { if (pathElements != null && pathElements.length > 0) { return pathElements[pathElements.length - 1]; } return null; } } | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttribute getLast() { if (pathElements != null && pathElements.length > 0) { return pathElements[pathElements.length - 1]; } return null; } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); ... | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttribute getLast() { if (pathElements != null && pathElements.length > 0) { return pathElements[pathElements.length - 1]; } return null; } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); ... | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttribute getLast() { if (pathElements != null && pathElements.length > 0) { return pathElements[pathElements.length - 1]; } return null; } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); ... |
@Test public void getElement() { Assert.assertEquals(attr1, path.getElement(0)); Assert.assertEquals(attr2, path.getElement(1)); } | public MetaAttribute getElement(int index) { return pathElements[index]; } | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttribute getElement(int index) { return pathElements[index]; } } | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttribute getElement(int index) { return pathElements[index]; } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); } | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttribute getElement(int index) { return pathElements[index]; } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); MetaAttributePath subPath(int startIndex); MetaAttributePath subPath(int sta... | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttribute getElement(int index) { return pathElements[index]; } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(MetaAttribute... pathElements); MetaAttributePath subPath(int startIndex); MetaAttributePath subPath(int sta... |
@Test public void subPath() { MetaAttributePath subPath = path.subPath(1); Assert.assertEquals(1, subPath.length()); Assert.assertEquals(attr2, subPath.getElement(0)); } | public MetaAttributePath subPath(int startIndex) { MetaAttribute[] range = Arrays.copyOfRange(pathElements, startIndex, pathElements.length); return new MetaAttributePath(range); } | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttributePath subPath(int startIndex) { MetaAttribute[] range = Arrays.copyOfRange(pathElements, startIndex, pathElements.length); return new MetaAttributePath(range); } } | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttributePath subPath(int startIndex) { MetaAttribute[] range = Arrays.copyOfRange(pathElements, startIndex, pathElements.length); return new MetaAttributePath(range); } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(Me... | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttributePath subPath(int startIndex) { MetaAttribute[] range = Arrays.copyOfRange(pathElements, startIndex, pathElements.length); return new MetaAttributePath(range); } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(Me... | MetaAttributePath implements Iterable<MetaAttribute> { public MetaAttributePath subPath(int startIndex) { MetaAttribute[] range = Arrays.copyOfRange(pathElements, startIndex, pathElements.length); return new MetaAttributePath(range); } MetaAttributePath(List<? extends MetaAttribute> pathElements); MetaAttributePath(Me... |
@Test public void testHashCode() { Assert.assertEquals(ResourcePermission.ALL.hashCode(), ResourcePermission.ALL.hashCode()); Assert.assertNotEquals(ResourcePermission.DELETE.hashCode(), ResourcePermission.ALL.hashCode()); Assert.assertNotEquals(ResourcePermission.GET.hashCode(), ResourcePermission.ALL.hashCode()); Ass... | @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (deleteAllowed ? 1231 : 1237); result = prime * result + (getAllowed ? 1231 : 1237); result = prime * result + (patchAllowed ? 1231 : 1237); result = prime * result + (postAllowed ? 1231 : 1237); return result; } | ResourcePermission { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (deleteAllowed ? 1231 : 1237); result = prime * result + (getAllowed ? 1231 : 1237); result = prime * result + (patchAllowed ? 1231 : 1237); result = prime * result + (postAllowed ? 1231 : 1237); retur... | ResourcePermission { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (deleteAllowed ? 1231 : 1237); result = prime * result + (getAllowed ? 1231 : 1237); result = prime * result + (patchAllowed ? 1231 : 1237); result = prime * result + (postAllowed ? 1231 : 1237); retur... | ResourcePermission { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (deleteAllowed ? 1231 : 1237); result = prime * result + (getAllowed ? 1231 : 1237); result = prime * result + (patchAllowed ? 1231 : 1237); result = prime * result + (postAllowed ? 1231 : 1237); retur... | ResourcePermission { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (deleteAllowed ? 1231 : 1237); result = prime * result + (getAllowed ? 1231 : 1237); result = prime * result + (patchAllowed ? 1231 : 1237); result = prime * result + (postAllowed ? 1231 : 1237); retur... |
@Test public void render() { Assert.assertEquals("a.b", path.toString()); } | public String render(String delimiter) { if (pathElements.length == 0) { return ""; } else if (pathElements.length == 1) { return pathElements[0].getName(); } else { StringBuilder builder = new StringBuilder(pathElements[0].getName()); for (int i = 1; i < pathElements.length; i++) { builder.append(delimiter); builder.a... | MetaAttributePath implements Iterable<MetaAttribute> { public String render(String delimiter) { if (pathElements.length == 0) { return ""; } else if (pathElements.length == 1) { return pathElements[0].getName(); } else { StringBuilder builder = new StringBuilder(pathElements[0].getName()); for (int i = 1; i < pathEleme... | MetaAttributePath implements Iterable<MetaAttribute> { public String render(String delimiter) { if (pathElements.length == 0) { return ""; } else if (pathElements.length == 1) { return pathElements[0].getName(); } else { StringBuilder builder = new StringBuilder(pathElements[0].getName()); for (int i = 1; i < pathEleme... | MetaAttributePath implements Iterable<MetaAttribute> { public String render(String delimiter) { if (pathElements.length == 0) { return ""; } else if (pathElements.length == 1) { return pathElements[0].getName(); } else { StringBuilder builder = new StringBuilder(pathElements[0].getName()); for (int i = 1; i < pathEleme... | MetaAttributePath implements Iterable<MetaAttribute> { public String render(String delimiter) { if (pathElements.length == 0) { return ""; } else if (pathElements.length == 1) { return pathElements[0].getName(); } else { StringBuilder builder = new StringBuilder(pathElements[0].getName()); for (int i = 1; i < pathEleme... |
@Test public void equals() { Assert.assertTrue(path.equals(path)); Assert.assertFalse(path.equals(new Object())); } | @Override public boolean equals(Object obj) { if (obj instanceof MetaAttributePath) { MetaAttributePath other = (MetaAttributePath) obj; return Arrays.equals(pathElements, other.pathElements); } return false; } | MetaAttributePath implements Iterable<MetaAttribute> { @Override public boolean equals(Object obj) { if (obj instanceof MetaAttributePath) { MetaAttributePath other = (MetaAttributePath) obj; return Arrays.equals(pathElements, other.pathElements); } return false; } } | MetaAttributePath implements Iterable<MetaAttribute> { @Override public boolean equals(Object obj) { if (obj instanceof MetaAttributePath) { MetaAttributePath other = (MetaAttributePath) obj; return Arrays.equals(pathElements, other.pathElements); } return false; } MetaAttributePath(List<? extends MetaAttribute> pathEl... | MetaAttributePath implements Iterable<MetaAttribute> { @Override public boolean equals(Object obj) { if (obj instanceof MetaAttributePath) { MetaAttributePath other = (MetaAttributePath) obj; return Arrays.equals(pathElements, other.pathElements); } return false; } MetaAttributePath(List<? extends MetaAttribute> pathEl... | MetaAttributePath implements Iterable<MetaAttribute> { @Override public boolean equals(Object obj) { if (obj instanceof MetaAttributePath) { MetaAttributePath other = (MetaAttributePath) obj; return Arrays.equals(pathElements, other.pathElements); } return false; } MetaAttributePath(List<? extends MetaAttribute> pathEl... |
@Test(expected = IllegalArgumentException.class) public void checkResolvePathWithNullNotAllowed() { MetaResource meta = resourceProvider.getMeta(Task.class); meta.resolvePath(null); } | public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } | MetaDataObject extends MetaType { public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } } | MetaDataObject extends MetaType { public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } } | MetaDataObject extends MetaType { public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } @JsonIgnore // TODO MetaAttribute getVersionAttribute(); L... | MetaDataObject extends MetaType { public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } @JsonIgnore // TODO MetaAttribute getVersionAttribute(); L... |
@Test public void checkResolveEmptyPath() { MetaResource meta = resourceProvider.getMeta(Task.class); Assert.assertEquals(MetaAttributePath.EMPTY_PATH, meta.resolvePath(new ArrayList<String>())); } | public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } | MetaDataObject extends MetaType { public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } } | MetaDataObject extends MetaType { public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } } | MetaDataObject extends MetaType { public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } @JsonIgnore // TODO MetaAttribute getVersionAttribute(); L... | MetaDataObject extends MetaType { public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } @JsonIgnore // TODO MetaAttribute getVersionAttribute(); L... |
@Test public void checkResolveSubtypeAttribute() { MetaResource meta = resourceProvider.getMeta(Task.class); Assert.assertNotNull(meta.findAttribute("subTypeValue", true)); } | public MetaAttribute findAttribute(String name, boolean includeSubTypes) { if (hasAttribute(name)) { return getAttribute(name); } if (includeSubTypes) { List<? extends MetaDataObject> transitiveSubTypes = getSubTypes(true, true); for (MetaDataObject subType : transitiveSubTypes) { if (subType.hasAttribute(name)) { retu... | MetaDataObject extends MetaType { public MetaAttribute findAttribute(String name, boolean includeSubTypes) { if (hasAttribute(name)) { return getAttribute(name); } if (includeSubTypes) { List<? extends MetaDataObject> transitiveSubTypes = getSubTypes(true, true); for (MetaDataObject subType : transitiveSubTypes) { if (... | MetaDataObject extends MetaType { public MetaAttribute findAttribute(String name, boolean includeSubTypes) { if (hasAttribute(name)) { return getAttribute(name); } if (includeSubTypes) { List<? extends MetaDataObject> transitiveSubTypes = getSubTypes(true, true); for (MetaDataObject subType : transitiveSubTypes) { if (... | MetaDataObject extends MetaType { public MetaAttribute findAttribute(String name, boolean includeSubTypes) { if (hasAttribute(name)) { return getAttribute(name); } if (includeSubTypes) { List<? extends MetaDataObject> transitiveSubTypes = getSubTypes(true, true); for (MetaDataObject subType : transitiveSubTypes) { if (... | MetaDataObject extends MetaType { public MetaAttribute findAttribute(String name, boolean includeSubTypes) { if (hasAttribute(name)) { return getAttribute(name); } if (includeSubTypes) { List<? extends MetaDataObject> transitiveSubTypes = getSubTypes(true, true); for (MetaDataObject subType : transitiveSubTypes) { if (... |
@Test(expected = IllegalStateException.class) public void checkCannotResolveSubtypeAttributeWithoutIncludingSubtypes() { MetaResource meta = resourceProvider.getMeta(Task.class); meta.findAttribute("subTypeValue", false); } | public MetaAttribute findAttribute(String name, boolean includeSubTypes) { if (hasAttribute(name)) { return getAttribute(name); } if (includeSubTypes) { List<? extends MetaDataObject> transitiveSubTypes = getSubTypes(true, true); for (MetaDataObject subType : transitiveSubTypes) { if (subType.hasAttribute(name)) { retu... | MetaDataObject extends MetaType { public MetaAttribute findAttribute(String name, boolean includeSubTypes) { if (hasAttribute(name)) { return getAttribute(name); } if (includeSubTypes) { List<? extends MetaDataObject> transitiveSubTypes = getSubTypes(true, true); for (MetaDataObject subType : transitiveSubTypes) { if (... | MetaDataObject extends MetaType { public MetaAttribute findAttribute(String name, boolean includeSubTypes) { if (hasAttribute(name)) { return getAttribute(name); } if (includeSubTypes) { List<? extends MetaDataObject> transitiveSubTypes = getSubTypes(true, true); for (MetaDataObject subType : transitiveSubTypes) { if (... | MetaDataObject extends MetaType { public MetaAttribute findAttribute(String name, boolean includeSubTypes) { if (hasAttribute(name)) { return getAttribute(name); } if (includeSubTypes) { List<? extends MetaDataObject> transitiveSubTypes = getSubTypes(true, true); for (MetaDataObject subType : transitiveSubTypes) { if (... | MetaDataObject extends MetaType { public MetaAttribute findAttribute(String name, boolean includeSubTypes) { if (hasAttribute(name)) { return getAttribute(name); } if (includeSubTypes) { List<? extends MetaDataObject> transitiveSubTypes = getSubTypes(true, true); for (MetaDataObject subType : transitiveSubTypes) { if (... |
@Test(expected = IllegalStateException.class) public void checkResolveInvalidAttribute() { MetaResource meta = resourceProvider.getMeta(Task.class); Assert.assertNotNull(meta.findAttribute("doesNotExist", true)); } | public MetaAttribute findAttribute(String name, boolean includeSubTypes) { if (hasAttribute(name)) { return getAttribute(name); } if (includeSubTypes) { List<? extends MetaDataObject> transitiveSubTypes = getSubTypes(true, true); for (MetaDataObject subType : transitiveSubTypes) { if (subType.hasAttribute(name)) { retu... | MetaDataObject extends MetaType { public MetaAttribute findAttribute(String name, boolean includeSubTypes) { if (hasAttribute(name)) { return getAttribute(name); } if (includeSubTypes) { List<? extends MetaDataObject> transitiveSubTypes = getSubTypes(true, true); for (MetaDataObject subType : transitiveSubTypes) { if (... | MetaDataObject extends MetaType { public MetaAttribute findAttribute(String name, boolean includeSubTypes) { if (hasAttribute(name)) { return getAttribute(name); } if (includeSubTypes) { List<? extends MetaDataObject> transitiveSubTypes = getSubTypes(true, true); for (MetaDataObject subType : transitiveSubTypes) { if (... | MetaDataObject extends MetaType { public MetaAttribute findAttribute(String name, boolean includeSubTypes) { if (hasAttribute(name)) { return getAttribute(name); } if (includeSubTypes) { List<? extends MetaDataObject> transitiveSubTypes = getSubTypes(true, true); for (MetaDataObject subType : transitiveSubTypes) { if (... | MetaDataObject extends MetaType { public MetaAttribute findAttribute(String name, boolean includeSubTypes) { if (hasAttribute(name)) { return getAttribute(name); } if (includeSubTypes) { List<? extends MetaDataObject> transitiveSubTypes = getSubTypes(true, true); for (MetaDataObject subType : transitiveSubTypes) { if (... |
@Test public void checkResolveMapPath() { MetaResource meta = resourceProvider.getMeta(Project.class); MetaAttributePath path = meta.resolvePath(Arrays.asList("data", "customData", "test")); Assert.assertEquals(2, path.length()); Assert.assertEquals("data", path.getElement(0).getName()); MetaMapAttribute mapAttr = (Met... | public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } | MetaDataObject extends MetaType { public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } } | MetaDataObject extends MetaType { public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } } | MetaDataObject extends MetaType { public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } @JsonIgnore // TODO MetaAttribute getVersionAttribute(); L... | MetaDataObject extends MetaType { public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } @JsonIgnore // TODO MetaAttribute getVersionAttribute(); L... |
@Test public void checkNestedObject() { MetaJsonObject meta = resourceProvider.getMeta(ProjectData.class); Assert.assertEquals("ProjectData", meta.getName()); Assert.assertEquals("resources.types.projectdata", meta.getId()); Assert.assertNotNull(meta.getAttribute("data").getType()); } | public MetaAttribute getAttribute(String name) { setupCache(); MetaAttribute attr = attrMap.get(name); PreconditionUtil.assertNotNull(getName() + "." + name, attr); return attr; } | MetaDataObject extends MetaType { public MetaAttribute getAttribute(String name) { setupCache(); MetaAttribute attr = attrMap.get(name); PreconditionUtil.assertNotNull(getName() + "." + name, attr); return attr; } } | MetaDataObject extends MetaType { public MetaAttribute getAttribute(String name) { setupCache(); MetaAttribute attr = attrMap.get(name); PreconditionUtil.assertNotNull(getName() + "." + name, attr); return attr; } } | MetaDataObject extends MetaType { public MetaAttribute getAttribute(String name) { setupCache(); MetaAttribute attr = attrMap.get(name); PreconditionUtil.assertNotNull(getName() + "." + name, attr); return attr; } @JsonIgnore // TODO MetaAttribute getVersionAttribute(); List<? extends MetaAttribute> getAttributes(); v... | MetaDataObject extends MetaType { public MetaAttribute getAttribute(String name) { setupCache(); MetaAttribute attr = attrMap.get(name); PreconditionUtil.assertNotNull(getName() + "." + name, attr); return attr; } @JsonIgnore // TODO MetaAttribute getVersionAttribute(); List<? extends MetaAttribute> getAttributes(); v... |
@Test(expected = IllegalArgumentException.class) public void checkResolveInvalidPath() { MetaResource meta = resourceProvider.getMeta(Project.class); meta.resolvePath(Arrays.asList("name", "doesNotExist")); } | public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } | MetaDataObject extends MetaType { public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } } | MetaDataObject extends MetaType { public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } } | MetaDataObject extends MetaType { public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } @JsonIgnore // TODO MetaAttribute getVersionAttribute(); L... | MetaDataObject extends MetaType { public MetaAttributePath resolvePath(List<String> attrPath, boolean includeSubTypes) { MetaAttributeFinder finder = includeSubTypes ? SUBTYPE_ATTRIBUTE_FINDER : DEFAULT_ATTRIBUTE_FINDER; return resolvePath(attrPath, finder); } @JsonIgnore // TODO MetaAttribute getVersionAttribute(); L... |
@Test public void xor() { Assert.assertTrue(ResourcePermission.DELETE.xor(ResourcePermission.DELETE).isEmpty()); Assert.assertTrue(ResourcePermission.GET.xor(ResourcePermission.GET).isEmpty()); Assert.assertEquals(ResourcePermission.create(false, true, false, true), ResourcePermission.GET.xor(ResourcePermission.DELETE)... | public ResourcePermission xor(ResourcePermission other) { boolean mergePush = postAllowed ^ other.postAllowed; boolean mergeGet = getAllowed ^ other.getAllowed; boolean mergePatch = patchAllowed ^ other.patchAllowed; boolean mergeDelete = deleteAllowed ^ other.deleteAllowed; return new ResourcePermission(mergePush, mer... | ResourcePermission { public ResourcePermission xor(ResourcePermission other) { boolean mergePush = postAllowed ^ other.postAllowed; boolean mergeGet = getAllowed ^ other.getAllowed; boolean mergePatch = patchAllowed ^ other.patchAllowed; boolean mergeDelete = deleteAllowed ^ other.deleteAllowed; return new ResourcePerm... | ResourcePermission { public ResourcePermission xor(ResourcePermission other) { boolean mergePush = postAllowed ^ other.postAllowed; boolean mergeGet = getAllowed ^ other.getAllowed; boolean mergePatch = patchAllowed ^ other.patchAllowed; boolean mergeDelete = deleteAllowed ^ other.deleteAllowed; return new ResourcePerm... | ResourcePermission { public ResourcePermission xor(ResourcePermission other) { boolean mergePush = postAllowed ^ other.postAllowed; boolean mergeGet = getAllowed ^ other.getAllowed; boolean mergePatch = patchAllowed ^ other.patchAllowed; boolean mergeDelete = deleteAllowed ^ other.deleteAllowed; return new ResourcePerm... | ResourcePermission { public ResourcePermission xor(ResourcePermission other) { boolean mergePush = postAllowed ^ other.postAllowed; boolean mergeGet = getAllowed ^ other.getAllowed; boolean mergePatch = patchAllowed ^ other.patchAllowed; boolean mergeDelete = deleteAllowed ^ other.deleteAllowed; return new ResourcePerm... |
@Test public void getKey() { MetaType keyType = Mockito.mock(MetaType.class); Mockito.when(keyType.getImplementationClass()).thenReturn((Class) Integer.class); Mockito.when(mapType.getKeyType()).thenReturn(keyType); Assert.assertEquals(Integer.valueOf(13), impl.getKey()); } | public Object getKey() { MetaType keyType = mapType.getKeyType(); TypeParser typeParser = new TypeParser(); return typeParser.parse(keyString, (Class) keyType.getImplementationClass()); } | MetaMapAttribute extends MetaAttribute { public Object getKey() { MetaType keyType = mapType.getKeyType(); TypeParser typeParser = new TypeParser(); return typeParser.parse(keyString, (Class) keyType.getImplementationClass()); } } | MetaMapAttribute extends MetaAttribute { public Object getKey() { MetaType keyType = mapType.getKeyType(); TypeParser typeParser = new TypeParser(); return typeParser.parse(keyString, (Class) keyType.getImplementationClass()); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); } | MetaMapAttribute extends MetaAttribute { public Object getKey() { MetaType keyType = mapType.getKeyType(); TypeParser typeParser = new TypeParser(); return typeParser.parse(keyString, (Class) keyType.getImplementationClass()); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override M... | MetaMapAttribute extends MetaAttribute { public Object getKey() { MetaType keyType = mapType.getKeyType(); TypeParser typeParser = new TypeParser(); return typeParser.parse(keyString, (Class) keyType.getImplementationClass()); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override M... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.