Package io.hawt.jsonschema

Examples of io.hawt.jsonschema.SchemaLookup


public class SchemaLookupTest {

    @Test
    public void testLookupSchemaForJavaLangString() throws Exception {
        SchemaLookup lookup = createSchemaLookup();
        String result = lookup.getSchemaForClass("java.lang.String");
    }
View Full Code Here


    }
    */

    @Test
    public void testFailedLookup() throws Exception {
        SchemaLookup lookup = createSchemaLookup();
        try {
            String result = lookup.getSchemaForClass("James");
            Assert.fail("Should have thrown a NoClassDefFoundException");
        } catch (Exception e) {
            // pass
        }
    }
View Full Code Here

            // pass
        }
    }

    protected SchemaLookup createSchemaLookup() {
        SchemaLookup lookup = new SchemaLookup();
        lookup.init();
        return lookup;
    }
View Full Code Here

    }

    // right now these just verify the lookup doesn't bail
    @Test
    public void testObjectWithJaxbAnnotations() throws Exception {
        SchemaLookup lookup = createSchemaLookup();
        String result = lookup.getSchemaForClass("io.hawt.jsonschema.test.objects.ObjectWithJaxbAnnotations");
        System.out.println("testObjectWithJaxbAnnotations - Got: \n\n" + result + "\n\n");
        assertTrue(result.contains("\"default\" : \"default-value\""));
    }
View Full Code Here

        assertTrue(result.contains("\"default\" : \"default-value\""));
    }

    @Test
    public void testCreateOpenshiftContainerOptions() throws Exception {
        SchemaLookup lookup = createSchemaLookup();
        String result = lookup.getSchemaForClass("io.fabric8.openshift.CreateOpenshiftContainerOptions");
        System.out.println("testCreateOpenshiftContainerOptions - Got: \n\n" + result + "\n\n");
        assertTrue(result.contains("\"default\" : \"openshift.redhat.com\""));
    }
View Full Code Here

        assertTrue(result.contains("\"default\" : \"openshift.redhat.com\""));
    }

    @Test
    public void testObjectWithValidationAnnotations() throws Exception {
        SchemaLookup lookup = createSchemaLookup();
        String result = lookup.getSchemaForClass("io.hawt.jsonschema.test.objects.ObjectWithValidationAnnotations");
        System.out.println("testObjectWithValidationAnnotations - Got: \n\n" + result + "\n\n");
    }
View Full Code Here

        System.out.println("testObjectWithValidationAnnotations - Got: \n\n" + result + "\n\n");
    }

    @Test
    public void testObjectWithJsonAnnotations() throws Exception {
        SchemaLookup lookup = createSchemaLookup();
        String result = lookup.getSchemaForClass("io.hawt.jsonschema.test.objects.ObjectWithJsonAnnotations");
        System.out.println("testObjectWithJsonAnnotations - Got: \n\n" + result + "\n\n");
    }
View Full Code Here

        System.out.println("testObjectWithJsonAnnotations - Got: \n\n" + result + "\n\n");
    }

    @Test
    public void testObjectWithTransientModifiers() throws Exception {
        SchemaLookup lookup = createSchemaLookup();
        String result = lookup.getSchemaForClass(ObjectWithTransientModifiers.class.getName());
        System.out.println("testObjectWithTransientModifiers - Got: \n\n" + result + "\n\n");
    }
View Full Code Here

    @Parameter(required=true)
    private Map<String, String> classes;

    public void execute() throws MojoExecutionException
    {
        SchemaLookup lookup = new SchemaLookup();
        lookup.init();

        for (String clazz : this.classes.keySet()) {
            try {
                getLog().info("Looking up schema for class " + clazz);

                String targetFileName = this.classes.get(clazz);
                String fileContents = "var " + clazz.replace('.', '_') + " = " + lookup.getSchemaForClass(clazz) + ";\n\n";

                File outputFile = new File(targetFileName);

                if (outputFile.getParentFile().mkdirs()) {
                    getLog().info("Created path " + outputFile.getParentFile());
View Full Code Here

TOP

Related Classes of io.hawt.jsonschema.SchemaLookup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.