@Override public Archive<?> getArchive() { return ShrinkWrap.createFromZipFile(JavaArchive.class, spec.file); } }
public TestWarArchiveBuilder( final File baseWar, final Class<?> testClass, final File buildOutput ) { this( testClass, buildOutput ); war.merge( ShrinkWrap.createFromZipFile( WebArchive.class, baseWar ) ); }
@Deployment public static EnterpriseArchive createArchive() { File earFile = findPluginEARFile(); return ShrinkWrap.createFromZipFile(EnterpriseArchive.class, earFile); }
@Deployment public static EnterpriseArchive createArchive() { File earFile = findApplicationEARFile(); return ShrinkWrap.createFromZipFile(EnterpriseArchive.class, earFile); }
/** * Ensures that attempting to import as ZIP from a {@link File} that doesn't exist leads to * {@link IllegalArgumentException} * * @throws Exception */ @Test(expected = IllegalArgumentException.class) public void importFromNonexistantlFileThrowsException() throws Exception { final File file = new File("fileThatDoesntExist.tmp"); Assert.assertFalse("Error in test setup, file should not exist: " + file.getAbsolutePath(), file.exists()); ShrinkWrap.createFromZipFile(JavaArchive.class, null); }
@Test public void archiveEqualsShouldReturnTrueWhenNameAndContentsAreEqual() throws Exception { final File testFile = TestIOUtil.createFileFromResourceName(TEST_ZIP_1); final File testFile2 = TestIOUtil.createFileFromResourceName(TEST_ZIP_2); final Archive<?> archive = ShrinkWrap.createFromZipFile(JavaArchive.class, testFile); final Archive<?> archive2 = ShrinkWrap.createFromZipFile(JavaArchive.class, testFile2); Assert.assertEquals("Archives were not equal, but should be.", archive, archive2); }
@Test public void enterpriseArchiveEqualsShouldReturnTrueWhenNameAndContentsAreEqual() throws Exception { final File testFile1 = TestIOUtil.createFileFromResourceName(TEST_ZIP_1); final File testFile2 = TestIOUtil.createFileFromResourceName(TEST_ZIP_2); final EnterpriseArchive ear1 = ShrinkWrap.createFromZipFile(EnterpriseArchive.class, testFile1); final EnterpriseArchive ear2 = ShrinkWrap.createFromZipFile(EnterpriseArchive.class, testFile2); Assert.assertEquals("EnterpriseArchive instances were not equal, but should be.", ear1, ear2); }
@Deployment public static WebArchive createDeployment() { File archive = new File("target/executor-war-ejb-app.war"); if (!archive.exists()) { throw new IllegalStateException("There is no archive yet generated, run maven build or mvn assembly:assembly"); } WebArchive war = ShrinkWrap.createFromZipFile(WebArchive.class, archive); war.addPackage("org.jbpm.executor.ejb.impl.test"); // test cases return war; }
@Test public void archiveEqualsShouldReturnTrueWhenEqualByReference() throws Exception { // reference the same file final File testFile = TestIOUtil.createFileFromResourceName(TEST_ZIP_1); final File testFile2 = TestIOUtil.createFileFromResourceName(TEST_ZIP_1); final Archive<?> archive = ShrinkWrap.createFromZipFile(JavaArchive.class, testFile); final Archive<?> archive2 = ShrinkWrap.createFromZipFile(JavaArchive.class, testFile2); Assert.assertEquals("Archives were not equal, but should be.", archive, archive2); }
@Test public void archiveEqualsShouldReturnFalseWhenArchivesContentsAreNotEqual() throws Exception { final String archiveName = "test.zip"; final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, archiveName); final File testFile = TestIOUtil.createFileFromResourceName(TEST_ZIP_1); final JavaArchive archive2 = ShrinkWrap.createFromZipFile(JavaArchive.class, testFile); Assert .assertFalse("Archives were equal, but should not have been - contents differ.", archive.equals(archive2)); }
@Deployment(testable = false) public static WebArchive deploy() { return ShrinkWrap.create(WebArchive.class) .merge(ShrinkWrap.createFromZipFile(WebArchive.class, new File("target/geekseek-1.0.0-alpha-1-SNAPSHOT.war"))); } }
@Override protected File process(File toResign) throws Exception { Archive<?> apk = ShrinkWrap.createFromZipFile(JavaArchive.class, toResign); apk.delete("META-INF"); File toSign = new File(androidSDK.getPlatformConfiguration().getTmpDir(), DroidiumFileUtils.getRandomAPKFileName()); DroidiumFileUtils.export(apk, toSign); return super.process(toSign); } }
@Deployment public static WebArchive createDeployment() { File archive = new File("target/sample-war-ejb-app.war"); if (!archive.exists()) { throw new IllegalStateException("There is no archive yet generated, run maven build or mvn assembly:assembly"); } WebArchive war = ShrinkWrap.createFromZipFile(WebArchive.class, archive); war.addPackage("org.jbpm.services.ejb.test"); // test cases // deploy test kjar deployKjar(); return war; }
@Deployment public static WebArchive createDeployment() { File archive = new File("target/sample-war-ejb-app.war"); if (!archive.exists()) { throw new IllegalStateException("There is no archive yet generated, run maven build or mvn assembly:assembly"); } WebArchive war = ShrinkWrap.createFromZipFile(WebArchive.class, archive); war.addPackage("org.jbpm.services.ejb.test"); // test cases // deploy test kjar deployKjar(); return war; }
@Deployment public static WebArchive createDeployment() { File archive = new File("target/sample-war-ejb-app.war"); if (!archive.exists()) { throw new IllegalStateException("There is no archive yet generated, run maven build or mvn assembly:assembly"); } WebArchive war = ShrinkWrap.createFromZipFile(WebArchive.class, archive); war.addPackage("org.jbpm.services.ejb.test"); // test cases // deploy test kjar deployKjar(); return war; }
@Deployment public static WebArchive createDeployment() { File archive = new File("target/sample-war-ejb-app.war"); if (!archive.exists()) { throw new IllegalStateException("There is no archive yet generated, run maven build or mvn assembly:assembly"); } WebArchive war = ShrinkWrap.createFromZipFile(WebArchive.class, archive); war.addPackage("org.jbpm.services.ejb.test"); // test cases // deploy test kjar deployKjar(); return war; }
@Deployment public static WebArchive createDeployment() { File archive = new File("target/sample-war-ejb-app.war"); if (!archive.exists()) { throw new IllegalStateException("There is no archive yet generated, run maven build or mvn assembly:assembly"); } WebArchive war = ShrinkWrap.createFromZipFile(WebArchive.class, archive); war.addPackage("org.jbpm.services.ejb.test"); // test cases // deploy test kjar deployKjar(); return war; }
@Deployment public static WebArchive createDeployment() { File archive = new File("target/timer-war-ejb-app.war"); if (!archive.exists()) { throw new IllegalStateException("There is no archive yet generated, run maven build or mvn assembly:assembly"); } WebArchive war = ShrinkWrap.createFromZipFile(WebArchive.class, archive); war.addPackage("org.jbpm.services.ejb.timer.test"); // test cases war.addAsResource("BPMN2-TimerTask.bpmn2"); war.addAsResource("HumanTaskWithDeadlines.bpmn"); return war; }
@Deployment public static WebArchive createDeployment() { File archive = new File("target/sample-war-ejb-app.war"); if (!archive.exists()) { throw new IllegalStateException("There is no archive yet generated, run maven build or mvn assembly:assembly"); } WebArchive war = ShrinkWrap.createFromZipFile(WebArchive.class, archive); war.addPackage("org.jbpm.services.ejb.test"); // test cases war.addClass("org.jbpm.test.listener.process.NodeLeftCountDownProcessEventListener"); // deploy test kjar deployKjar(); return war; }
@Test public void archiveWriteToShouldWriteToStream() throws Exception { MockOutputStream outputStream = new MockOutputStream(); final File testFile = TestIOUtil.createFileFromResourceName(TEST_ARCHIVE); final Archive<?> archive = ShrinkWrap.createFromZipFile(JavaArchive.class, testFile); byte[] archiveToString = archive.toString(Formatters.SIMPLE).getBytes(); archive.writeTo(outputStream, Formatters.SIMPLE); Assert.assertArrayEquals("Inconsistent writes?", archiveToString, outputStream.getContents()); outputStream = new MockOutputStream(); archiveToString = archive.toString(Formatters.VERBOSE).getBytes(); archive.writeTo(outputStream, Formatters.VERBOSE); Assert.assertArrayEquals("Inconsistent writes?", archiveToString, outputStream.getContents()); }