Java Code Examples for org.jboss.shrinkwrap.api.spec.WebArchive#addClasses()

The following examples show how to use org.jboss.shrinkwrap.api.spec.WebArchive#addClasses() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Deployment
public static WebArchive deployment() {
    final WebArchive archive = ShrinkWrap.create(WebArchive.class, "jaxb-integration-tests.war");
    archive.addPackage(Customer.class.getPackage());
    archive.addClasses(XMLUtils.class);
    archive.addAsResource(new StringAsset("Customer"), "org/wildfly/camel/test/jaxb/model/jaxb.index");
    archive.addAsResource("jaxb/customer.xml", "customer.xml");
    archive.setManifest(new Asset() {
        @Override
        public InputStream openStream() {
            ManifestBuilder builder = new ManifestBuilder();
            builder.addManifestHeader("Dependencies", "org.jdom2");
            return builder.openStream();
        }
    });
    return archive;
}
 
Example 2
Source Project: appengine-tck   File: CloudSqlTestBase.java    License: Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive getDeployment() {
    // -Dtck.sql.connection=//my_project:test_instance
    // -Dtck.sql.user
    // -Dtck.sql.pw

    TestContext context = new TestContext().setUseSystemProperties(true).setCompatibilityProperties(TCK_PROPERTIES);

    // Declares usage of com.mysql.jdbc.GoogleDriver
    context.setAppEngineWebXmlFile("sql-appengine-web.xml");

    WebArchive war = getTckDeployment(context);
    war.addClasses(CloudSqlTestBase.class, SqlUtil.class);

    return war;
}
 
Example 3
Source Project: appengine-tck   File: ChannelTestBase.java    License: Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive getDeployment() {
    TestContext context = new TestContext();
    context.setAppEngineWebXmlFile("channel-appengine-web.xml");
    context.setWebXmlFile("channel-web.xml");

    WebArchive war = getTckDeployment(context);
    war.addClasses(ChannelTestBase.class, PresenceServlet.class);

    war.addAsWebResource("channelPage.jsp");
    war.addAsWebResource("channelEcho.jsp");

    return war;
}
 
Example 4
Source Project: appengine-tck   File: QueueTestBase.java    License: Apache License 2.0 5 votes vote down vote up
@Deployment
public static Archive getDeployment() {
    TestContext context = new TestContext();
    context.setWebXmlFile("web-taskqueue.xml");
    WebArchive war = getTckDeployment(context);
    war.addClasses(QueueTestBase.class, DatastoreUtil.class);
    war.addClasses(ExecTask.class, ExecDeferred.class);
    war.addClass(RequestData.class);
    war.addClass(DefaultQueueServlet.class);
    war.addClass(TestQueueServlet.class);
    war.addClass(PrintServlet.class);
    war.addClass(RetryTestServlet.class);
    war.addAsWebInfResource("queue.xml");
    return war;
}
 
Example 5
@Deployment(name = SIMPLE_WAR, managed = false)
public static Archive<?> getSimpleWar() {
    final WebArchive archive = ShrinkWrap.create(WebArchive.class, SIMPLE_WAR);
    final StringAsset jbossWebAsset = new StringAsset("<jboss-web><security-domain>cxf-security-domain</security-domain></jboss-web>");
    archive.addClasses(Endpoint.class, SecureEndpointImpl.class);
    archive.addAsResource("cxf/secure/cxf-roles.properties", "cxf-roles.properties");
    archive.addAsResource("cxf/secure/cxf-users.properties", "cxf-users.properties");
    archive.addAsWebInfResource(jbossWebAsset, "jboss-web.xml");
    return archive;
}
 
Example 6
@Deployment
public static WebArchive getDeployment() {
    TestContext context = new TestContext();
    WebArchive war = getTckDeployment(context);

    war.addClasses(ImagesServiceTestBase.class, ImageRequest.class);

    for (String fName : TEST_FILES) {
        war.addAsResource("testdata/" + fName, fName);
    }

    return war;
}
 
Example 7
@Deployment
public static WebArchive createdeployment() {
    final WebArchive archive = ShrinkWrap.create(WebArchive.class, "package-scan.war");
    archive.addAsWebInfResource("spring/package-scan-camel-context.xml");
    archive.addClasses(ScannedRouteBuilder.class);
    return archive;
}
 
Example 8
protected static WebArchive getBaseDeployment() {
    TestContext context = new TestContext().setUseSystemProperties(true).setCompatibilityProperties(TCK_PROPERTIES);
    context.setWebXmlFile("match-web.xml");

    WebArchive war = getTckDeployment(context);
    war.addClasses(ProspectiveTestBase.class);
    war.addClasses(MatchResponseServlet.class, SpecialMatchResponseServlet.class);
    war.addClasses(InvocationData.class, Ping.class);
    return war;
}
 
Example 9
@SuppressWarnings("unchecked")
protected <T> void addService(WebArchive archive, Class<T> serviceClass, Class<? extends T>... serviceImpls) {
    archive.addClasses(serviceImpls);
    StringBuilder builder = new StringBuilder();
    for (Class<? extends T> serviceImpl : serviceImpls) {
        builder.append(serviceImpl.getName()).append("\n");
    }
    archive.addAsWebInfResource(new StringAsset(builder.toString()), "classes/META-INF/services/" + serviceClass.getName());
}
 
Example 10
Source Project: appengine-tck   File: RpcTest.java    License: Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive getDeployment() {
    TestContext context = new TestContext().setWebXmlFile("rpc-web.xml");
    WebArchive war = getDefaultDeployment(context);
    war.addClasses(RpcEndpoint.class, TestData.class);
    war.add(new ClassLoaderAsset("xindex.html"), "index.html");
    war.add(new ClassLoaderAsset("js/base.js"), "js/base.js");
    war.addAsWebInfResource("rpcendpoint-v1-rest.discovery");
    war.addAsWebInfResource("rpcendpoint-v1-rpc.discovery");
    return war;
}
 
Example 11
@Deployment
public static WebArchive deployment() {
    final WebArchive archive = ShrinkWrap.create(WebArchive.class, "cxfrs-consumer-tests.war");
    archive.addClasses(GreetingService.class);
    archive.addAsResource("cxf/spring/cxfrs-consumer-camel-context.xml", "cxfrs-consumer-camel-context.xml");
    archive.setManifest(new Asset() {
        @Override
        public InputStream openStream() {
            ManifestBuilder builder = new ManifestBuilder();
            builder.addManifestHeader("Dependencies", "org.jboss.resteasy.resteasy-jaxrs");
            return builder.openStream();
        }
    });
    return archive;
}
 
Example 12
Source Project: wildfly-camel   File: CXFEndpointTest.java    License: Apache License 2.0 5 votes vote down vote up
@Deployment(testable = false)
public static WebArchive deployment() {
    final WebArchive archive = ShrinkWrap.create(WebArchive.class, "cxf-ws-consumer.war");
    archive.addClasses(Endpoint.class);
    archive.addAsResource("cxf/cxfws-consumer-camel-context.xml");
    return archive;
}
 
Example 13
@Deployment
public static WebArchive createdeployment() throws IOException {
    File[] libraryDependencies = Maven.configureResolverViaPlugin().
        resolve("org.apache.ftpserver:ftpserver-core").
        withTransitivity().
        asFile();

    final WebArchive archive = ShrinkWrap.create(WebArchive.class, "camel-ftp-tests.war");
    archive.addAsResource(new StringAsset(System.getProperty("basedir")), FILE_BASEDIR);
    archive.addClasses(AvailablePortFinder.class, TestUtils.class, FileUtils.class);
    archive.addAsLibraries(libraryDependencies);
    return archive;
}
 
Example 14
@Deployment
public static WebArchive createdeployment() {
    WebArchive archive = ShrinkWrap.create(WebArchive.class, "ahc-wss-test.war");
    archive.addClasses(WebSocketServerEndpoint.class);
    archive.addAsResource("ahc/application.keystore", "application.keystore");
    archive.addAsWebResource("ahc/websocket.js", "websocket.js");
    archive.addAsWebResource("ahc/index.jsp", "index.jsp");
    archive.addAsWebInfResource("ahc/web.xml", "web.xml");
    return archive;
}
 
Example 15
@Deployment
public static WebArchive createDeployment() {
    final WebArchive archive = ShrinkWrap.create(WebArchive.class, "undertow-load-balance.war");
    archive.addClasses(MyServlet.class);
    return archive;
}
 
Example 16
@Deployment
public static WebArchive createDeployment() {
    final WebArchive archive = ShrinkWrap.create(WebArchive.class, "camel-test.war");
    archive.addClasses(EnvironmentUtils.class);
    return archive;
}
 
Example 17
@Deployment(name = SIMPLE_WAR, managed = false, testable = false)
public static Archive<?> getSimpleWar() {
    final WebArchive archive = ShrinkWrap.create(WebArchive.class, SIMPLE_WAR);
    archive.addClasses(Endpoint.class, EndpointImpl.class);
    return archive;
}
 
Example 18
Source Project: appengine-tck   File: CronTestBase.java    License: Apache License 2.0 4 votes vote down vote up
protected static WebArchive getBaseDeployment(String cronXml) {
    WebArchive war = getTckDeployment(new TestContext().setWebXmlFile("web-ping-servlet.xml"));
    war.addAsWebInfResource(cronXml + ".xml", "cron.xml");
    war.addClasses(CronTestBase.class, PingServlet.class, ActionData.class);
    return war;
}
 
Example 19
protected static WebArchive getBaseDeployment() {
    WebArchive war = getBytemanDeployment();
    war.addClasses(ConcurrentTxTestBase.class);
    return war;
}
 
Example 20
@Deployment
public static WebArchive createdeployment() {
    WebArchive archive = ShrinkWrap.create(WebArchive.class, "ahc-ws-test.war");
    archive.addClasses(WebSocketServerEndpoint.class);
    return archive;
}