Package org.glassfish.jersey.server.wadl

Examples of org.glassfish.jersey.server.wadl.WadlGenerator


        final ServiceLocator locator = ServerLocatorFactory.createLocator();
        final String propValue = "bar";
        WadlGeneratorConfig config = WadlGeneratorConfig.generator(MyWadlGenerator.class).
                prop("foo", propValue).
                build();
        WadlGenerator wadlGenerator = config.createWadlGenerator(locator);
        Assert.assertEquals(MyWadlGenerator.class, wadlGenerator.getClass());
        Assert.assertEquals(((MyWadlGenerator) wadlGenerator).getFoo(), propValue);

        final String propValue2 = "baz";
        config = WadlGeneratorConfig.generator(MyWadlGenerator.class).
                prop("foo", propValue).generator(MyWadlGenerator2.class).
                prop("bar", propValue2).
                build();
        wadlGenerator = config.createWadlGenerator(locator);
        Assert.assertEquals(MyWadlGenerator2.class, wadlGenerator.getClass());
        final MyWadlGenerator2 wadlGenerator2 = (MyWadlGenerator2) wadlGenerator;
        Assert.assertEquals(wadlGenerator2.getBar(), propValue2);

        Assert.assertEquals(MyWadlGenerator.class, wadlGenerator2.getDelegate().getClass());
        Assert.assertEquals(((MyWadlGenerator) wadlGenerator2.getDelegate()).getFoo(), propValue);
View Full Code Here


        }

        final ServiceLocator locator = ServerLocatorFactory.createLocator();

        WadlGeneratorConfig config = new MyWadlGeneratorConfig();
        WadlGenerator wadlGenerator = config.createWadlGenerator(locator);

        Assert.assertEquals(MyWadlGenerator2.class, wadlGenerator.getClass());
        final MyWadlGenerator2 wadlGenerator2 = (MyWadlGenerator2) wadlGenerator;
        Assert.assertEquals(wadlGenerator2.getBar(), propValue2);

        Assert.assertEquals(MyWadlGenerator.class, wadlGenerator2.getDelegate().getClass());
        Assert.assertEquals(((MyWadlGenerator) wadlGenerator2.getDelegate()).getFoo(), propValue);
View Full Code Here

        WadlGeneratorConfig config = WadlGeneratorConfig.
                generator(MyWadlGenerator3.class).
                prop("foo", "string").
                prop("bar", new Bar()).build();
        final ServiceLocator locator = ServerLocatorFactory.createLocator();
        WadlGenerator wadlGenerator = config.createWadlGenerator(locator);

        Assert.assertEquals(MyWadlGenerator3.class, wadlGenerator.getClass());

        MyWadlGenerator3 g = (MyWadlGenerator3) wadlGenerator;
        Assert.assertNotNull(g.foo);
        Assert.assertEquals(g.foo.s, "string");
        Assert.assertNotNull(g.bar);
View Full Code Here

        ResourceDocType rdt = new ResourceDocType();
        rdt.getDocs().add(cdt);


        /* Generate WADL for that class */
        WadlGenerator wg = new WadlGeneratorResourceDocSupport(new WadlGeneratorImpl(), rdt);

        WadlBuilder wb = new WadlBuilder(wg, false, null);
        Resource resource = Resource.from(TestResource.class);
        ApplicationDescription app = wb.generate(Lists.newArrayList(resource));

View Full Code Here

        final ServiceLocator serviceLocator = ServerLocatorFactory.createLocator();
        final Properties props = new Properties();
        props.put("testFile", "classpath:testfile.xml");
        final WadlGeneratorDescription description = new WadlGeneratorDescription(MyWadlGenerator2.class, props);

        final WadlGenerator wadlGenerator = WadlGeneratorLoader.loadWadlGeneratorDescriptions(serviceLocator, description);
        Assert.assertEquals(MyWadlGenerator2.class, wadlGenerator.getClass());

        final URL resource = getClass().getResource("testfile.xml");
        Assert.assertEquals(new File(resource.toURI()).getAbsolutePath(), ((MyWadlGenerator2) wadlGenerator).getTestFile()
                .getAbsolutePath());
View Full Code Here

        final Properties props = new Properties();
        final String path = "classpath:/" + getClass().getPackage().getName().replaceAll("\\.", "/") + "/testfile.xml";
        props.put("testFile", path);
        final WadlGeneratorDescription description = new WadlGeneratorDescription(MyWadlGenerator2.class, props);

        final WadlGenerator wadlGenerator = WadlGeneratorLoader.loadWadlGeneratorDescriptions(serviceLocator, description);
        Assert.assertEquals(MyWadlGenerator2.class, wadlGenerator.getClass());

        final URL resource = getClass().getResource("testfile.xml");
        Assert.assertEquals(new File(resource.toURI()).getAbsolutePath(), ((MyWadlGenerator2) wadlGenerator).getTestFile()
                .getAbsolutePath());
View Full Code Here

        final Properties props = new Properties();
        final String path = new File(resource.toURI()).getAbsolutePath();
        props.put("testFile", path);
        final WadlGeneratorDescription description = new WadlGeneratorDescription(MyWadlGenerator2.class, props);

        final WadlGenerator wadlGenerator = WadlGeneratorLoader.loadWadlGeneratorDescriptions(serviceLocator, description);
        Assert.assertEquals(MyWadlGenerator2.class, wadlGenerator.getClass());

        Assert.assertEquals(new File(resource.toURI()).getAbsolutePath(), ((MyWadlGenerator2) wadlGenerator).getTestFile()
                .getAbsolutePath());
    }
View Full Code Here

        final Properties props = new Properties();
        final String path = getClass().getPackage().getName().replaceAll("\\.", "/") + "/testfile.xml";
        props.put("testStream", path);
        final WadlGeneratorDescription description = new WadlGeneratorDescription(MyWadlGenerator2.class, props);

        final WadlGenerator wadlGenerator = WadlGeneratorLoader.loadWadlGeneratorDescriptions(serviceLocator, description);
        Assert.assertEquals(MyWadlGenerator2.class, wadlGenerator.getClass());

        final URL resource = getClass().getResource("testfile.xml");
        Assert.assertEquals(new File(resource.toURI()).length(), ((MyWadlGenerator2) wadlGenerator).getTestStreamContent()
                .length());
View Full Code Here

        final ResourceConfig resourceConfig = new ResourceConfig();
        resourceConfig.property(ServerProperties.WADL_GENERATOR_CONFIG,
                MyWadlGeneratorConfig.class.getName());

        final ServiceLocator locator = ServerLocatorFactory.createLocator(resourceConfig.getProperties());
        final WadlGenerator wadlGenerator = WadlGeneratorConfigLoader.loadWadlGeneratorsFromConfig(resourceConfig.getProperties())
                .createWadlGenerator(locator);
        Assert.assertEquals(MyWadlGenerator.class, wadlGenerator.getClass());

    }
View Full Code Here

        final WadlGeneratorConfig config = WadlGeneratorConfig.generator(MyWadlGenerator.class).build();

        final ResourceConfig resourceConfig = new ResourceConfig();
        resourceConfig.property(ServerProperties.WADL_GENERATOR_CONFIG, config);
        final ServiceLocator locator = ServerLocatorFactory.createLocator(resourceConfig.getProperties());
        final WadlGenerator wadlGenerator = WadlGeneratorConfigLoader.loadWadlGeneratorsFromConfig(resourceConfig.getProperties())
                .createWadlGenerator(locator);
        Assert.assertTrue(wadlGenerator instanceof MyWadlGenerator);
    }
View Full Code Here

TOP

Related Classes of org.glassfish.jersey.server.wadl.WadlGenerator

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.