Tabnine Logo
org.jboss.shrinkwrap.api
Code IndexAdd Tabnine to your IDE (free)

How to use org.jboss.shrinkwrap.api

Best Java code snippets using org.jboss.shrinkwrap.api (Showing top 20 results out of 2,295)

origin: javaee-samples/javaee7-samples

public static WebArchive defaultWebArchive() {
  return 
    create(WebArchive.class, "test.war")
      .addPackages(true, "org.javaee7.jaspic")
      .deleteClass(ArquillianBase.class)
      .addAsWebInfResource(resource("web.xml"))
      .addAsWebInfResource(resource("jboss-web.xml"))
      .addAsWebInfResource(resource("glassfish-web.xml"));
}

origin: javaee-samples/javaee7-samples

public static Archive<?> tryWrapEAR(WebArchive webArchive) {
  if (getBoolean("useEarForJaspic")) {
    return
      // EAR archive
      create(EnterpriseArchive.class, "test.ear")
      
        // Liberty needs to have the binding file in an ear.
        // TODO: this is no longer the case and this code can be removed (-bnd.xml
        // needs to be moved to correct place)
        .addAsManifestResource(resource("ibm-application-bnd.xml"))

        // Web module
        // This is needed to prevent Arquillian generating an illegal application.xml
        .addAsModule(
          webArchive
        );  
  } else {
    return webArchive;
  }
}
origin: MovingBlocks/Terasology

/**
 * @throws IOException ShrinkWrap errors
 */
@Override
protected void setupPathManager() throws IOException {
  final JavaArchive homeArchive = ShrinkWrap.create(JavaArchive.class);
  final FileSystem vfs = ShrinkWrapFileSystems.newFileSystem(homeArchive);
  PathManager.getInstance().useOverrideHomePath(vfs.getPath(""));
}
origin: hibernate/hibernate-orm

@Deployment
public static WebArchive createDeployment() {
  return ShrinkWrap.create( WebArchive.class )
      .addClass( Kryptonite.class )
      .addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" )
      .addAsResource( new StringAsset( persistenceXml().exportAsString() ), "META-INF/persistence.xml" );
}
origin: hibernate/hibernate-orm

@Deployment
public static WebArchive deploy() throws Exception {
  final WebArchive war = ShrinkWrap.create( WebArchive.class, ARCHIVE_NAME + ".war" )
      .setManifest( "org/hibernate/test/wf/ddl/manifest.mf" )
      .addClasses( WildFlyDdlEntity.class )
      .addAsResource( new StringAsset( hibernate_cfg ), "hibernate.cfg.xml" )
      .addClasses( BmtSfStatefulBean.class )
      .addClasses( DdlInWildFlyUsingBmtAndSfTest.class );
  return war;
}
origin: hibernate/hibernate-orm

  @Deployment
  public static WebArchive buildDeployment() {
    WebArchive war = ShrinkWrap.create( WebArchive.class )
        .setManifest( "org/hibernate/test/wf/ddl/manifest.mf" )
        .addClass( WildFlyDdlEntity.class )
//                .addAsManifestResource( EmptyAsset.INSTANCE, "beans.xml")
        .addAsResource( new StringAsset( persistenceXml().exportAsString() ), PERSISTENCE_XML_RESOURCE_NAME )
        .addAsResource( "org/hibernate/test/wf/ddl/log4j.properties", "log4j.properties" );
    System.out.println( war.toString(true) );
    return war;
  }

origin: cbeust/testng

public static File generateJar(
  Class<?>[] classes, String[] resources, String prefix, String archiveName)
  throws IOException {
 File jarFile = File.createTempFile(prefix, ".jar");
 JavaArchive archive = ShrinkWrap.create(JavaArchive.class, archiveName).addClasses(classes);
 for (String resource : resources) {
  archive = archive.addAsResource(resource);
 }
 archive.as(ZipExporter.class).exportTo(jarFile, true);
 return jarFile;
}
origin: hibernate/hibernate-orm

protected File buildLargeJar() throws Exception {
  final String fileName = "large.jar";
  final JavaArchive archive = ShrinkWrap.create( JavaArchive.class, fileName );
  // Build a large jar by adding a lorem ipsum file repeatedly.
  final Path loremipsumTxtFile = Paths.get( ScannerTests.class.getResource(
      "/org/hibernate/jpa/test/packaging/loremipsum.txt" ).toURI() );
  for ( int i = 0; i < 100; i++ ) {
    ArchivePath path = ArchivePaths.create( "META-INF/file" + i );
    archive.addAsResource( loremipsumTxtFile.toFile(), path );
  }
  File testPackage = new File( shrinkwrapArchiveDirectory, fileName );
  archive.as( ZipExporter.class ).exportTo( testPackage, true );
  return testPackage;
}
origin: resteasy/Resteasy

public static WebArchive prepareArchiveWithApplication(String deploymentName, Class<? extends Application> clazz) {
 WebArchive war = ShrinkWrap.create(WebArchive.class, deploymentName + ".war");
 war.addClass(clazz);
 return war;
}
origin: oracle/helidon

Map<ArchivePath, Node> archiveContents = archive.getContent();
for (Map.Entry<ArchivePath, Node> entry : archiveContents.entrySet()) {
  ArchivePath path = entry.getKey();
  Node n = entry.getValue();
  Path f = subpath(deployDir, path.get());
  if (n.getAsset() == null) {
    Files.copy(n.getAsset().openStream(), f, StandardCopyOption.REPLACE_EXISTING);
    String p = n.getPath().get();
    if (callback != null) {
      callback.accept(p);
origin: kiegroup/optaplanner

@Deployment(testable = false)
public static WebArchive createDeployment() {
  File file = findPomFile();
  return ShrinkWrap.create(MavenImporter.class)
      .loadPomFromFile(file)
      .importBuildOutput()
      .as(WebArchive.class);
}
origin: org.jboss.arquillian.junit/arquillian-junit-container

  @Test
  public void shouldGenerateDependencies() throws Exception {
    Archive<?> archive = new JUnitDeploymentAppender().createAuxiliaryArchive();

    Assert.assertTrue(
      "Should have added Extension",
      archive.contains(
        ArchivePaths.create("/META-INF/services/org.jboss.arquillian.container.test.spi.TestRunner")));

    Assert.assertTrue(
      "Should have added TestRunner Impl",
      archive.contains(ArchivePaths.create("/org/jboss/arquillian/junit/container/JUnitTestRunner.class")));
  }
}
origin: oracle/helidon

@Override
public void undeploy(Archive<?> archive) {
  RunContext context = contexts.remove(archive.getId());
  if (null == context) {
    LOGGER.severe("Undeploying an archive that was not deployed. ID: " + archive.getId());
    return;
origin: hibernate/hibernate-orm

@Deployment
public static WebArchive createDeployment() {
  return ShrinkWrap.create( WebArchive.class )
      .addClass( AuditedEntity.class )
      .addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" )
      .addAsResource( new StringAsset( persistenceXml().exportAsString() ), "META-INF/persistence.xml" );
}
origin: hibernate/hibernate-orm

@Deployment
public static WebArchive deploy() throws Exception {
  final WebArchive war = ShrinkWrap.create( WebArchive.class, ARCHIVE_NAME + ".war" )
      .setManifest( "org/hibernate/test/wf/ddl/manifest.mf" )
      .addClasses( WildFlyDdlEntity.class )
      .addAsResource( new StringAsset( hibernate_cfg ), "hibernate.cfg.xml" )
      .addClasses( CmtSfStatefulBean.class )
      .addClasses( DdlInWildFlyUsingCmtAndSfTest.class );
  return war;
}
origin: MovingBlocks/Terasology

@BeforeClass
public static void setupEnvironment() throws Exception {
  final JavaArchive homeArchive = ShrinkWrap.create(JavaArchive.class);
  final FileSystem vfs = ShrinkWrapFileSystems.newFileSystem(homeArchive);
  PathManager.getInstance().useOverrideHomePath(vfs.getPath(""));
  /*
   * Create at least for each class a new headless environemnt as it is fast and prevents side effects
   * (Reusing a headless environment after other tests have modified the core registry isn't really clean)
   */
  env = new HeadlessEnvironment(new Name("engine"));
  context = env.getContext();
  moduleManager = context.get(ModuleManager.class);
}
origin: resteasy/Resteasy

/**
* Initialize deployment.
*
* @return Deployment.
*/
public static WebArchive prepareArchive(String deploymentName) {
 WebArchive war = ShrinkWrap.create(WebArchive.class, deploymentName + ".war");
 war.addClass(TestApplication.class);
 return war;
}
origin: oracle/helidon

contexts.put(archive.getId(), context);
origin: hibernate/hibernate-orm

@Deployment
public static WebArchive createDeployment() {
  return ShrinkWrap.create( WebArchive.class )
      .addClass( Kryptonite.class )
      .addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" )
      .addAsResource( new StringAsset( persistenceXml().exportAsString() ), "META-INF/persistence.xml" );
}
origin: MovingBlocks/Terasology

@Before
public void setup() throws Exception {
  super.setup();
  JavaArchive homeArchive = ShrinkWrap.create(JavaArchive.class);
  FileSystem vfs = ShrinkWrapFileSystems.newFileSystem(homeArchive);
  PathManager.getInstance().useOverrideHomePath(temporaryFolder.getRoot().toPath());
  savePath = PathManager.getInstance().getSavePath("testSave");
org.jboss.shrinkwrap.api

Most used classes

  • ShrinkWrap
    Main entry point into the ShrinkWrap system. Each Archive has an associated Configuration provided a
  • Archive
    Represents a collection of resources which may be constructed programmatically. In effect this repre
  • JavaArchive
    Traditional JAR (Java Archive) structure. Used in construction of libraries and applications.
  • WebArchive
    Traditional WAR (Java Web Archive) structure. Used in construction of web applications.
  • StringAsset
    Implementation of an Asset backed by a String
  • ZipExporter,
  • Asset,
  • ArchivePath,
  • ArchivePaths,
  • ZipImporter,
  • ByteArrayAsset,
  • Filters,
  • EnterpriseArchive,
  • FileAsset,
  • ArchiveAsset,
  • ClassLoaderAsset,
  • GenericArchive,
  • ExplodedImporter,
  • UrlAsset
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now