当前位置: 首页>>代码示例>>Java>>正文


Java ArchivePaths类代码示例

本文整理汇总了Java中org.jboss.shrinkwrap.api.ArchivePaths的典型用法代码示例。如果您正苦于以下问题:Java ArchivePaths类的具体用法?Java ArchivePaths怎么用?Java ArchivePaths使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ArchivePaths类属于org.jboss.shrinkwrap.api包,在下文中一共展示了ArchivePaths类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDeployment

import org.jboss.shrinkwrap.api.ArchivePaths; //导入依赖的package包/类
/**
 * Creates the deployment.
 *
 * @return the web archive
 */
@Deployment
public static WebArchive createDeployment() {
  WebArchive war = null;
  try {
    File[] mavenDependencies = Maven.configureResolver()
        .fromFile("src/test/resources/settings-clean-test.xml").loadPomFromFile("pom.xml")
        .importCompileAndRuntimeDependencies().resolve().withoutTransitivity().asFile();
    war = ShrinkWrap.create(WebArchive.class)
        // deploying everything in out app, in future, you might be more restrictive, e.g. deploy
        // only models and EJBs.
        .addPackages(true, "me.nlighten.backend")
        // JSON has to be packed in war for NlightenConfigServiceTest
        .addAsResource(new File("src/main/java/me/nlighten/backend/config/NlightenConfig.json"),
            ArchivePaths.create("me/nlighten/backend/config/NlightenConfig.json"))
        // deploy test specific persistence xml
        .addAsResource("META-INF/persistence.xml")
        // deploy additional maven libraries
        .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml").addAsLibraries(mavenDependencies);
    System.out.println("Test archive contents: " + war.toString(true));
  } catch (Exception e) {
    e.printStackTrace();
  }
  return war;
}
 
开发者ID:yntelectual,项目名称:nlighten,代码行数:30,代码来源:AbstractTest.java

示例2: importWar

import org.jboss.shrinkwrap.api.ArchivePaths; //导入依赖的package包/类
@Test
public void importWar() {

	// When

	final WebArchive archive = doImport("src/it/demo-hook/pom.xml");

	// Then

	assertNotNull(
		archive.get(ArchivePaths.create("/WEB-INF/lib", "util-java.jar")));
	assertNotNull(
		archive.get(
			ArchivePaths.create("/WEB-INF/lib", "commons-logging.jar")));
	assertNotNull(
		archive.get(
			ArchivePaths.create("/WEB-INF/lib", "log4j-extras.jar")));
	assertNotNull(
		archive.get(ArchivePaths.create("/WEB-INF", "liferay-hook.xml")));
	assertNotNull(
		archive.get(
			ArchivePaths.create("/WEB-INF/classes", "log4j.properties")));
}
 
开发者ID:arquillian,项目名称:arquillian-extension-liferay,代码行数:24,代码来源:LiferayHookMavenImporterTestCase.java

示例3: addFiles

import org.jboss.shrinkwrap.api.ArchivePaths; //导入依赖的package包/类
private static void addFiles(WebArchive war, File dir, ArchivePath context) {
	if (!dir.isDirectory()) {
		throw new RuntimeException(dir.getAbsolutePath()
				+ " is not a directory");
	}

	for (File f : dir.listFiles()) {
		if (f.isFile()) {
			ArchivePath fileContext = ArchivePaths.create(context,
					f.getName());
			war.addAsWebResource(f, fileContext);
		} else {
			addFiles(war, f, ArchivePaths.create(context, f.getName()));
		}
	}
}
 
开发者ID:openkp,项目名称:openkp,代码行数:17,代码来源:ArchiveHelper.java

示例4: createTestModule

import org.jboss.shrinkwrap.api.ArchivePaths; //导入依赖的package包/类
private static void createTestModule() throws Exception {
    final File moduleXml = new File(DuplicateExtCommandTestCase.class.getResource(DuplicateExtCommandTestCase.class.getSimpleName() + "-module.xml").toURI());
    testModule = new TestModule(MODULE_NAME, moduleXml);

    final JavaArchive archive = testModule.addResource("test-cli-duplicate-commands-module.jar")
            .addClass(DuplicateExtCommandHandler.class)
            .addClass(DuplicateExtCommandHandlerProvider.class)
            .addClass(DuplicateExtCommandsExtension.class)
            .addClass(CliExtCommandsParser.class)
            .addClass(DuplicateExtCommand.class)
            .addClass(DuplicateExtCommandSubsystemResourceDescription.class);

    ArchivePath services = ArchivePaths.create("/");
    services = ArchivePaths.create(services, "services");

    final ArchivePath extService = ArchivePaths.create(services, Extension.class.getName());
    archive.addAsManifestResource(getResource(DuplicateExtCommandsExtension.class), extService);

    final ArchivePath cliCmdService = ArchivePaths.create(services, CommandHandlerProvider.class.getName());
    archive.addAsManifestResource(getResource(DuplicateExtCommandHandlerProvider.class), cliCmdService);

    final ArchivePath cliAeshCmdService = ArchivePaths.create(services, Command.class.getName());
    archive.addAsManifestResource(getResource(DuplicateExtCommand.class), cliAeshCmdService);
    testModule.create(true);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:26,代码来源:DuplicateExtCommandTestCase.java

示例5: createTestModule

import org.jboss.shrinkwrap.api.ArchivePaths; //导入依赖的package包/类
private static void createTestModule() throws Exception {
    File moduleXml = new File(CustomSecurityVault.class.getResource(CustomVaultInModuleTestCase.class.getSimpleName() + "-module.xml").toURI());
    testModule = new TestModule(MODULE_NAME, moduleXml);

    JavaArchive archive = testModule.addResource("test-custom-vault-in-module.jar")
            .addClass(CustomSecurityVault.class)
            .addClass(TestVaultExtension.class)
            .addClass(TestVaultParser.class)
            .addClass(TestVaultRemoveHandler.class)
            .addClass(TestVaultResolveExpressionHandler.class)
            .addClass(TestVaultSubsystemResourceDescription.class);

    ArchivePath path = ArchivePaths.create("/");
    path = ArchivePaths.create(path, "services");
    path = ArchivePaths.create(path, Extension.class.getName());
    archive.addAsManifestResource(CustomSecurityVault.class.getPackage(), Extension.class.getName(), path);
    testModule.create(true);

    picketLink = PicketBoxModuleUtil.createTestModule();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:21,代码来源:CustomVaultInModuleTestCase.java

示例6: createDeployment

import org.jboss.shrinkwrap.api.ArchivePaths; //导入依赖的package包/类
@Deployment
public static JavaArchive createDeployment() {
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class)
        .addClasses(AbstractEmployeeCriteriaTest.class,
            Employee.class, Employee_.class,
            Region.class, TaxCode.class)
        .addAsResource(
            new File("src/test/resources-glassfish-managed/scripts/create-schema.sql"),
            "/scripts/create-schema.sql")
        .addAsResource(
            "test-persistence.xml",
            "META-INF/persistence.xml")
        .addAsManifestResource(
            EmptyAsset.INSTANCE,
            ArchivePaths.create("beans.xml"));
    return jar;
}
 
开发者ID:peterpilgrim,项目名称:javaee7-developer-handbook,代码行数:18,代码来源:EmployeeCriteriaUpdateTest.java

示例7: createDeployment

import org.jboss.shrinkwrap.api.ArchivePaths; //导入依赖的package包/类
@Deployment
public static JavaArchive createDeployment() {
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class)
        .addClasses(Utils.class)
        .addAsResource(
            new File("src/test/resources-glassfish-managed/scripts/create-schema.sql"),
            "/scripts/create-schema.sql")
        .addAsResource(
            "test-persistence.xml",
            "META-INF/persistence.xml")
        .addAsManifestResource(
            EmptyAsset.INSTANCE,
            ArchivePaths.create("beans.xml"));
    System.out.printf(jar.toString(true));
    return jar;
}
 
开发者ID:peterpilgrim,项目名称:javaee7-developer-handbook,代码行数:17,代码来源:CompoundInterestRateStoredProcJPATest.java

示例8: archive

import org.jboss.shrinkwrap.api.ArchivePaths; //导入依赖的package包/类
@Deployment
public static JavaArchive archive() {
    return ShrinkWrap.create(JavaArchive.class, JPAArquillianAdapterTest.class.getSimpleName().concat(".jar"))
            .addClasses(Person.class, Persister.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"))
            .addAsManifestResource(new StringAsset("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                    "<persistence version=\"2.0\"\n" +
                    "             xmlns=\"http://java.sun.com/xml/ns/persistence\"\n" +
                    "             xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
                    "             xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence\n" +
                    "                       http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd\">\n" +
                    "  <persistence-unit name=\"person\">\n" +
                    "    <jta-data-source>My DataSource</jta-data-source>\n" +
                    "    <non-jta-data-source>My Unmanaged DataSource</non-jta-data-source>\n" +
                    "    <class>" + Person.class.getName() + "</class>\n" +
                    "    <properties>\n" +
                    "      <property name=\"openjpa.jdbc.SynchronizeMappings\" value=\"buildSchema(ForeignKeys=true)\"/>\n" +
                    "    </properties>\n" +
                    "  </persistence-unit>\n" +
                    "</persistence>"), ArchivePaths.create("persistence.xml"));
}
 
开发者ID:apache,项目名称:tomee,代码行数:22,代码来源:JPAArquillianAdapterTest.java

示例9: createDeployment

import org.jboss.shrinkwrap.api.ArchivePaths; //导入依赖的package包/类
public WebArchive createDeployment(Class...archiveClasses) {
    WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class)
            .version("3.0");
    decorateDescriptor(descriptor);

    WebArchive archive = ShrinkWrap.create(WebArchive.class, getTestContextName() + ".war")
            .setWebXML(new StringAsset(descriptor.exportAsString()))
            .addAsLibraries(JarLocation.jarLocation(Test.class))
            .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
    
    if (archiveClasses != null) {
        for (Class c: archiveClasses) {
            archive.addClass(c);
        }
    }
    decorateArchive(archive);

    return archive;
}
 
开发者ID:apache,项目名称:tomee,代码行数:20,代码来源:TestSetup.java

示例10: createDeployment

import org.jboss.shrinkwrap.api.ArchivePaths; //导入依赖的package包/类
@Deployment(testable = false)
public static WebArchive createDeployment() {
    WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class)
            .version("3.0")
            .createServlet()
                .servletName("check").servletClass(PersistenceServlet.class.getName()).up()
            .createServletMapping()
                .servletName("check").urlPattern("/" + TEST_NAME).up();

    WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war")
            .addClass(PersistenceServlet.class)
            .addClass(Address.class)
            .addClass(Runner.class)
            .addAsLibraries(JarLocation.jarLocation(Test.class))
            .addAsManifestResource("persistence.xml", ArchivePaths.create("persistence.xml"))
            .setWebXML(new StringAsset(descriptor.exportAsString()));



    return archive;
}
 
开发者ID:apache,项目名称:tomee,代码行数:22,代码来源:ServletPersistenceInjectionTest.java

示例11: createDeployment

import org.jboss.shrinkwrap.api.ArchivePaths; //导入依赖的package包/类
@Deployment
public static JavaArchive createDeployment() {
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class)
        .addClasses(Utils.class)
        .addAsResource(
                new File("src/test/resources-glassfish-managed/scripts/create-schema.sql"),
                "/scripts/create-schema.sql")
        .addAsResource(
                "test-persistence.xml",
                "META-INF/persistence.xml")
        .addAsManifestResource(
                EmptyAsset.INSTANCE,
                ArchivePaths.create("beans.xml"));
    System.out.printf(jar.toString(true));
    return jar;
}
 
开发者ID:peterpilgrim,项目名称:javaee7-developer-handbook,代码行数:17,代码来源:StoredProcedureJPATest.java

示例12: createDeployment

import org.jboss.shrinkwrap.api.ArchivePaths; //导入依赖的package包/类
@Deployment(testable = false)
public static WebArchive createDeployment() {

    final WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class)
            .version(WebAppVersionType._3_0)
            .createServlet().servletName("servlet").servletClass(SimpleServlet.class.getName()).up()
            .createServletMapping().servletName("servlet").urlPattern("/" + TEST_NAME).up();

    WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war")
            .addClass(TestRun.class)
            .addClass(SimpleServlet.class)
            .addClass(Car.class)
            .addClass(AssemblyLine.class)
            .setWebXML(new StringAsset(descriptor.exportAsString()))
            .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));



    return archive;
}
 
开发者ID:apache,项目名称:tomee,代码行数:21,代码来源:ServletCdiProducerTest.java

示例13: createDeployment

import org.jboss.shrinkwrap.api.ArchivePaths; //导入依赖的package包/类
@Deployment(testable = false)
public static WebArchive createDeployment() {

    WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class)
            .version("3.0")
            .createServlet().servletName("servlet").servletClass(SimpleServlet.class.getName()).up()
            .createServletMapping().servletName("servlet").urlPattern("/" + TEST_NAME).up();

    WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war")
            .addClass(TestRun.class)
            .addClass(SimpleServlet.class)
            .addClass(Car.class)
            .setWebXML(new StringAsset(descriptor.exportAsString()))
            .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));



    return archive;
}
 
开发者ID:apache,项目名称:tomee,代码行数:20,代码来源:ServletCdiConstructorInjectionTest.java

示例14: createDeployment

import org.jboss.shrinkwrap.api.ArchivePaths; //导入依赖的package包/类
@Deployment(testable = false)
public static WebArchive createDeployment() {

    WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class)
            .version(WebAppVersionType._3_0)
            .createServlet().servletName("servlet").servletClass(SimpleServlet.class.getName()).up()
            .createServletMapping().servletName("servlet").urlPattern("/" + TEST_NAME).up();

    WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war")
            .addClass(TestRun.class)
    		.addClass(SimpleServlet.class)
            .addClass(Car.class)
            .setWebXML(new StringAsset(descriptor.exportAsString()))
            .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));



    return archive;
}
 
开发者ID:apache,项目名称:tomee,代码行数:20,代码来源:ServletCdiInjectionTest.java

示例15: buildExplodedPar

import org.jboss.shrinkwrap.api.ArchivePaths; //导入依赖的package包/类
protected File buildExplodedPar() {
	String fileName = "explodedpar";
	JavaArchive archive = ShrinkWrap.create(  JavaArchive.class,fileName );
	archive.addClasses(
			Elephant.class,
			Carpet.class
	);

	ArchivePath path = ArchivePaths.create( "META-INF/persistence.xml" );
	archive.addAsResource( "explodedpar/META-INF/persistence.xml", path );

	path = ArchivePaths.create( "org/hibernate/jpa/test/pack/explodedpar/Elephant.hbm.xml" );
	archive.addAsResource( "explodedpar/org/hibernate/jpa/test/pack/explodedpar/Elephant.hbm.xml", path );

	path = ArchivePaths.create( "org/hibernate/jpa/test/pack/explodedpar/package-info.class" );
	archive.addAsResource( "org/hibernate/jpa/test/pack/explodedpar/package-info.class", path );

	File testPackage = new File( shrinkwrapArchiveDirectory, fileName );
	archive.as( ExplodedExporter.class ).exportExploded( shrinkwrapArchiveDirectory );
	return testPackage;
}
 
开发者ID:jipijapa,项目名称:jipijapa,代码行数:22,代码来源:ScannerTest.java


注:本文中的org.jboss.shrinkwrap.api.ArchivePaths类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。