@Test(expected = IllegalArgumentException.class) @ArchiveType(ManifestContainer.class) public void testAddNonExistentManifestResource() throws Exception { final String nonExistentResourceName = "ejb/security/ejb-jar.xml"; // Since the resource doesn't exist the ManifestContainer implementation throws the expected exception getManifestContainer().addAsManifestResource(nonExistentResourceName); }
@Test @ArchiveType(ManifestContainer.class) public void testAddManifestPackageStringTarget() throws Exception { getManifestContainer().addAsManifestResource(AssetUtil.class.getPackage(), "Test.properties", "Test.txt"); ArchivePath testPath = new BasicPath(getManifestPath(), "Test.txt"); Assert.assertTrue("Archive should contain " + testPath, getArchive().contains(testPath)); }
@Test @ArchiveType(ManifestContainer.class) public void testAddManifestPackage() throws Exception { getManifestContainer().addAsManifestResource(AssetUtil.class.getPackage(), "Test.properties"); ArchivePath testPath = new BasicPath(getManifestPath(), NAME_TEST_PROPERTIES); Assert.assertTrue("Archive should contain " + testPath, getArchive().contains(testPath)); }
@Test @ArchiveType(ManifestContainer.class) public void testAddManifestResource() throws Exception { getManifestContainer().addAsManifestResource(NAME_TEST_PROPERTIES); ArchivePath testPath = new BasicPath(getManifestPath(), NAME_TEST_PROPERTIES); Assert.assertTrue("Archive should contain " + testPath, getArchive().contains(testPath)); }
@Test @ArchiveType(ManifestContainer.class) public void testAddManifestStringTargetFile() throws Exception { getManifestContainer().addAsManifestResource(getFileForClassResource(NAME_TEST_PROPERTIES), "Test.txt"); ArchivePath testPath = new BasicPath(getManifestPath(), "Test.txt"); Assert.assertTrue("Archive should contain " + testPath, getArchive().contains(testPath)); }
/** * SHRINKWRAP-275 */ @Test @ArchiveType(ManifestContainer.class) public void testAddManifestStringTargetResourceFromJar() throws Exception { // Causing NPE getManifestContainer().addAsManifestResource("java/lang/String.class", "String.class"); ArchivePath testPath = new BasicPath(getManifestPath(), "String.class"); Assert.assertTrue("Archive should contain " + testPath, getArchive().contains(testPath)); }
@Test @ArchiveType(ManifestContainer.class) public void testAddManifestStringTargetResource() throws Exception { getManifestContainer().addAsManifestResource(NAME_TEST_PROPERTIES, "Test.txt"); ArchivePath testPath = new BasicPath(getManifestPath(), "Test.txt"); Assert.assertTrue("Archive should contain " + testPath, getArchive().contains(testPath)); }
@Test @ArchiveType(ManifestContainer.class) public void testAddManifestStringTargetURL() throws Exception { getManifestContainer().addAsManifestResource(getURLForClassResource(NAME_TEST_PROPERTIES), "Test.txt"); ArchivePath testPath = new BasicPath(getManifestPath(), "Test.txt"); Assert.assertTrue("Archive should contain " + testPath, getArchive().contains(testPath)); }
@Test @ArchiveType(ManifestContainer.class) public void testAddManifestStringTargetAsset() throws Exception { getManifestContainer().addAsManifestResource(getAssetForClassResource(NAME_TEST_PROPERTIES), "Test.txt"); ArchivePath testPath = new BasicPath(getManifestPath(), "Test.txt"); Assert.assertTrue("Archive should contain " + testPath, getArchive().contains(testPath)); }
@Test @ArchiveType(ManifestContainer.class) public void testAddManifestResourceRecursively() throws Exception { String baseFolder = "org/jboss/shrinkwrap/impl/base/recursion"; getManifestContainer().addAsManifestResource("org/jboss/shrinkwrap/impl/base/recursion"); assertArchiveContainsFolderRecursively(getFileForClassResource(baseFolder), getManifestPath(), baseFolder); }
@Test @ArchiveType(ManifestContainer.class) public void testAddManifestFile() throws Exception { getManifestContainer().addAsManifestResource(getFileForClassResource(NAME_TEST_PROPERTIES)); ArchivePath testPath = new BasicPath(getManifestPath(), "Test.properties"); Assert.assertTrue("Archive should contain " + testPath, getArchive().contains(testPath)); }
@Test @ArchiveType(ManifestContainer.class) public void testAddManifestPathTargetResource() throws Exception { getManifestContainer().addAsManifestResource(NAME_TEST_PROPERTIES, new BasicPath("Test.txt")); ArchivePath testPath = new BasicPath(getManifestPath(), "Test.txt"); Assert.assertTrue("Archive should contain " + testPath, getArchive().contains(testPath)); }
@Test @ArchiveType(ManifestContainer.class) public void testArchiveContainsEmptyManifestResourceDirectory() throws Exception { String baseFolder = "org/jboss/shrinkwrap/impl/base/recursion"; getManifestContainer().addAsManifestResource(baseFolder); String emptyFolderPath = baseFolder + "/empty"; assertArchiveContainsFolderRecursively(getFileForClassResource(emptyFolderPath), getManifestPath(), emptyFolderPath); }
@Test @ArchiveType(ManifestContainer.class) public void testAddManifestFileRecursively() throws Exception { File baseFolder = getFileForClassResource("org/jboss/shrinkwrap/impl/base/recursion"); getManifestContainer().addAsManifestResource(baseFolder); assertArchiveContainsFolderRecursively(baseFolder, getManifestPath(), "/recursion"); }
@Test @ArchiveType(ManifestContainer.class) public void testAddManifestURL() throws Exception { ArchivePath targetPath = new BasicPath("Test.properties"); getManifestContainer().addAsManifestResource(getURLForClassResource(NAME_TEST_PROPERTIES), targetPath); ArchivePath testPath = new BasicPath(getManifestPath(), targetPath); Assert.assertTrue("Archive should contain " + testPath, getArchive().contains(testPath)); }
@Test @ArchiveType(ManifestContainer.class) public void testAddManifestPathTargetURL() throws Exception { getManifestContainer().addAsManifestResource(getURLForClassResource(NAME_TEST_PROPERTIES), new BasicPath("Test.txt")); ArchivePath testPath = new BasicPath(getManifestPath(), "Test.txt"); Assert.assertTrue("Archive should contain " + testPath, getArchive().contains(testPath)); }
@Test @ArchiveType(ManifestContainer.class) public void testAddManifestPathTargetFile() throws Exception { getManifestContainer().addAsManifestResource(getFileForClassResource(NAME_TEST_PROPERTIES), new BasicPath("Test.txt")); ArchivePath testPath = new BasicPath(getManifestPath(), "Test.txt"); Assert.assertTrue("Archive should contain " + testPath, getArchive().contains(testPath)); }
@Test @ArchiveType(ManifestContainer.class) public void testAddManifestFileRecursivelyWithArchivePath() throws Exception { File baseFolder = getFileForClassResource("org/jboss/shrinkwrap/impl/base/recursion"); getManifestContainer().addAsManifestResource(baseFolder, new BasicPath("/new-name")); assertArchiveContainsFolderRecursively(baseFolder, getManifestPath(), "/new-name"); }
@Test @ArchiveType(ManifestContainer.class) public void testAddManifestResourceRecursivelyWithTargetArchivePath() throws Exception { String baseFolderPath = "org/jboss/shrinkwrap/impl/base/recursion"; getManifestContainer().addAsManifestResource(baseFolderPath, new BasicPath("/new-name")); assertArchiveContainsFolderRecursively(getFileForClassResource(baseFolderPath), getManifestPath(), "/new-name"); }
@Test @ArchiveType(ManifestContainer.class) public void testAddManifestURLRecursively() throws Exception { String baseFolderPath = "org/jboss/shrinkwrap/impl/base/recursion"; URL baseFolderURL = getURLForClassResource(baseFolderPath); getManifestContainer().addAsManifestResource(baseFolderURL, new BasicPath("/new-name")); assertArchiveContainsFolderRecursively(getFileForClassResource(baseFolderPath), getManifestPath(), "/new-name"); }