use of org.raml.jaxrs.generator.ramltypes.GType in project raml-for-jax-rs by mulesoft-labs.
the class TypeUtilsTest method shouldExtendingAnotherMultipleInheritance.
@Test
public void shouldExtendingAnotherMultipleInheritance() throws Exception {
Map<String, GType> finder = finder("extendObjectMultipleIneritance.raml");
ObjectTypeDeclaration object = (ObjectTypeDeclaration) finder.get("ObjectOne").implementation();
TypeDeclaration extending = findProperty(object, "name");
ObjectTypeDeclaration extended = (ObjectTypeDeclaration) finder.get(extending.type());
assertTrue(TypeUtils.shouldCreateNewClass(extending, extended));
}
use of org.raml.jaxrs.generator.ramltypes.GType in project raml-for-jax-rs by mulesoft-labs.
the class TypeUtilsTest method shouldExtendingAnother.
@Test
public void shouldExtendingAnother() throws Exception {
Map<String, GType> finder = finder("extendingAnother.raml");
ObjectTypeDeclaration object = (ObjectTypeDeclaration) finder.get("ObjectOne").implementation();
TypeDeclaration extending = findProperty(object, "name");
ObjectTypeDeclaration extended = (ObjectTypeDeclaration) finder.get(extending.type()).implementation();
assertFalse(TypeUtils.shouldCreateNewClass(extending, extended));
}
use of org.raml.jaxrs.generator.ramltypes.GType in project raml-for-jax-rs by mulesoft-labs.
the class TypeUtilsTest method bigRaml.
@Test
public void bigRaml() throws Exception {
Map<String, GType> finder = finder("big.raml");
ObjectTypeDeclaration object = (ObjectTypeDeclaration) finder.get("RamlDataType").implementation();
TypeDeclaration extending = findProperty(object, "NilValue");
ObjectTypeDeclaration extended = (ObjectTypeDeclaration) finder.get(extending.type());
assertTrue(TypeUtils.shouldCreateNewClass(extending, extended));
}
use of org.raml.jaxrs.generator.ramltypes.GType in project raml-for-jax-rs by mulesoft-labs.
the class TypeUtilsTest method finder.
private Map<String, GType> finder(String raml) {
RamlModelResult ramlModelResult = new RamlModelBuilder().buildApi(new InputStreamReader(this.getClass().getResourceAsStream(raml)), ".");
if (ramlModelResult.hasErrors()) {
for (ValidationResult validationResult : ramlModelResult.getValidationResults()) {
System.out.println(validationResult.getMessage());
}
throw new AssertionError();
} else {
final Map<String, GType> decls = new HashMap<>();
new V10Finder(null, ramlModelResult.getApiV10()).findTypes(new GFinderListener() {
@Override
public void newTypeDeclaration(GType type) {
decls.put(type.name(), type);
}
});
return decls;
}
}
use of org.raml.jaxrs.generator.ramltypes.GType in project raml-for-jax-rs by mulesoft-labs.
the class TypeUtilsTest method shouldExtendingAnotherWithProperties.
@Test
public void shouldExtendingAnotherWithProperties() throws Exception {
Map<String, GType> finder = finder("extendingAnotherWithProperties.raml");
ObjectTypeDeclaration object = (ObjectTypeDeclaration) finder.get("ObjectOne").implementation();
TypeDeclaration extending = findProperty(object, "name");
ObjectTypeDeclaration extended = (ObjectTypeDeclaration) finder.get(extending.type()).implementation();
assertTrue(TypeUtils.shouldCreateNewClass(extending, extended));
}
Aggregations