Search in sources :

Example 6 with Type

use of org.jboss.jandex.Type in project wildfly-swarm by wildfly-swarm.

the class ExpectationTests method testNestedGenerics.

@Test
public void testNestedGenerics() throws IOException, JSONException {
    String name = GenericTypeTestContainer.class.getName();
    Type pType = getFieldFromKlazz(name, "nesting").type();
    OpenApiDataObjectScanner scanner = new OpenApiDataObjectScanner(index, pType);
    Schema result = scanner.process();
    printToConsole(name, result);
    assertJsonEquals(name, "generic.nested.expected.json", result);
}
Also used : Type(org.jboss.jandex.Type) ClassType(org.jboss.jandex.ClassType) Schema(org.eclipse.microprofile.openapi.models.media.Schema) Test(org.junit.Test)

Example 7 with Type

use of org.jboss.jandex.Type in project wildfly-swarm by wildfly-swarm.

the class ExpectationTests method testComplexInheritanceGenerics.

@Test
public void testComplexInheritanceGenerics() throws IOException, JSONException {
    String name = GenericTypeTestContainer.class.getName();
    Type pType = getFieldFromKlazz(name, "complexInheritance").type();
    OpenApiDataObjectScanner scanner = new OpenApiDataObjectScanner(index, pType);
    Schema result = scanner.process();
    printToConsole(name, result);
    assertJsonEquals(name, "generic.complexInheritance.expected.json", result);
}
Also used : Type(org.jboss.jandex.Type) ClassType(org.jboss.jandex.ClassType) Schema(org.eclipse.microprofile.openapi.models.media.Schema) Test(org.junit.Test)

Example 8 with Type

use of org.jboss.jandex.Type in project wildfly-swarm by wildfly-swarm.

the class ExpectationTests method testComplexNestedGenerics.

@Test
public void testComplexNestedGenerics() throws IOException, JSONException {
    String name = GenericTypeTestContainer.class.getName();
    Type pType = getFieldFromKlazz(name, "complexNesting").type();
    OpenApiDataObjectScanner scanner = new OpenApiDataObjectScanner(index, pType);
    Schema result = scanner.process();
    printToConsole(name, result);
    assertJsonEquals(name, "generic.complexNesting.expected.json", result);
}
Also used : Type(org.jboss.jandex.Type) ClassType(org.jboss.jandex.ClassType) Schema(org.eclipse.microprofile.openapi.models.media.Schema) Test(org.junit.Test)

Example 9 with Type

use of org.jboss.jandex.Type in project wildfly-swarm by wildfly-swarm.

the class KitchenSinkTest method testTopLevelParameterisedType.

/**
 * Test parameterised type as a top-level entity (i.e. not just a bare class).
 *
 * @see org.jboss.jandex.ParameterizedType
 */
@Test
public void testTopLevelParameterisedType() throws IOException {
    // Look up the kitchen sink and get the field named "simpleParameterizedType"
    Type pType = getFieldFromKlazz(KitchenSink.class.getName(), "simpleParameterizedType").type();
    LOG.debugv("Scanning top-level entity: {0}", pType);
    OpenApiDataObjectScanner scanner = new OpenApiDataObjectScanner(index, pType);
    printToConsole("KustomPair", scanner.process());
}
Also used : ClassType(org.jboss.jandex.ClassType) Type(org.jboss.jandex.Type) Test(org.junit.Test)

Example 10 with Type

use of org.jboss.jandex.Type in project wildfly-swarm by wildfly-swarm.

the class SpecialCaseTests method testCollection_Wildcard.

@Test
public void testCollection_Wildcard() throws IOException, JSONException {
    String name = SpecialCaseTestContainer.class.getName();
    Type pType = getFieldFromKlazz(name, "listOfAnything").type();
    OpenApiDataObjectScanner scanner = new OpenApiDataObjectScanner(index, pType);
    Schema result = scanner.process();
    printToConsole(name, result);
    assertJsonEquals(name, "special.wildcard.expected.json", result);
}
Also used : Type(org.jboss.jandex.Type) Schema(org.eclipse.microprofile.openapi.models.media.Schema) Test(org.junit.Test)

Aggregations

Type (org.jboss.jandex.Type)28 Schema (org.eclipse.microprofile.openapi.models.media.Schema)15 Test (org.junit.Test)11 ClassType (org.jboss.jandex.ClassType)10 ClassInfo (org.jboss.jandex.ClassInfo)9 ParameterizedType (org.jboss.jandex.ParameterizedType)7 PrimitiveType (org.jboss.jandex.PrimitiveType)6 ArrayType (org.jboss.jandex.ArrayType)5 MethodInfo (org.jboss.jandex.MethodInfo)4 TypeUtil (org.wildfly.swarm.microprofile.openapi.runtime.util.TypeUtil)4 ArrayList (java.util.ArrayList)3 LinkedHashMap (java.util.LinkedHashMap)3 MediaType (org.eclipse.microprofile.openapi.models.media.MediaType)3 EEModuleClassDescription (org.jboss.as.ee.component.EEModuleClassDescription)3 InterceptorClassDescription (org.jboss.as.ee.component.interceptors.InterceptorClassDescription)3 MethodIdentifier (org.jboss.invocation.proxy.MethodIdentifier)3 FieldInfo (org.jboss.jandex.FieldInfo)3 RefType (org.wildfly.swarm.microprofile.openapi.runtime.util.JandexUtil.RefType)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2