@Override protected ArchivePath getManifestPath() { return ArchivePaths.root(); }
@Override protected ArchivePath getClassesPath() { return ArchivePaths.root(); }
@Override protected ArchivePath getLibraryPath() { return ArchivePaths.root(); }
@Override protected ArchivePath getResourcePath() { return ArchivePaths.root(); }
public String format(Archive<?> archive) throws IllegalArgumentException { StringBuilder xml = new StringBuilder(); xml.append("<?xml version=\"1.0\"?>\n<deployment") .append(" name=\"").append(archive.getName()).append("\"") .append(" testclass=\"").append(testClass.getName()).append("\"") .append(">\n"); formatNode(archive.get(ArchivePaths.root()), xml); xml.append("</deployment>").append("\n"); return xml.toString(); }
public String format(Archive<?> archive) throws IllegalArgumentException { StringBuilder xml = new StringBuilder(); xml.append("<?xml version=\"1.0\"?>\n<deployment") .append(" name=\"").append(archive.getName()).append("\"") .append(" testclass=\"").append(testClass.getName()).append("\"") .append(">\n"); formatNode(archive.get(ArchivePaths.root()), xml); xml.append("</deployment>").append("\n"); return xml.toString(); }
public String format(Archive<?> archive) throws IllegalArgumentException { StringBuilder xml = new StringBuilder(); xml.append("<?xml version=\"1.0\"?>\n<deployment") .append(" name=\"").append(archive.getName()).append("\"") .append(" testclass=\"").append(testClass.getName()).append("\"") .append(">\n"); formatNode(archive.get(ArchivePaths.root()), xml); xml.append("</deployment>").append("\n"); return xml.toString(); }
public String format(Archive<?> archive) throws IllegalArgumentException { StringBuilder xml = new StringBuilder(); xml.append("<?xml version=\"1.0\"?>\n<deployment") .append(" name=\"").append(archive.getName()).append("\"") .append(" testclass=\"").append(testClass.getName()).append("\"") .append(">\n"); formatNode(archive.get(ArchivePaths.root()), xml); xml.append("</deployment>").append("\n"); return xml.toString(); }
/** * {@inheritDoc} * * @see java.nio.file.FileSystem#getRootDirectories() */ @Override public Iterable<Path> getRootDirectories() { this.checkClosed(); // Each ShrinkWrapFileSystem has one root directory final Path path = new ShrinkWrapPath(ArchivePaths.root(), this); final List<Path> paths = new ArrayList<>(1); paths.add(path); return Collections.unmodifiableList(paths); }
/** * {@inheritDoc} * * @see java.nio.file.FileSystem#getRootDirectories() */ @Override public Iterable<Path> getRootDirectories() { this.checkClosed(); // Each ShrinkWrapFileSystem has one root directory final Path path = new ShrinkWrapPath(ArchivePaths.root(), this); final List<Path> paths = new ArrayList<>(1); paths.add(path); return Collections.unmodifiableList(paths); }
/** * {@inheritDoc} * * @see java.nio.file.Path#getRoot() */ @Override public Path getRoot() { return this.isAbsolute() ? new ShrinkWrapPath(ArchivePaths.root(), fileSystem) : null; }
/** * {@inheritDoc} * * @see java.nio.file.Path#getRoot() */ @Override public Path getRoot() { return this.isAbsolute() ? new ShrinkWrapPath(ArchivePaths.root(), fileSystem) : null; }
protected void filter(ResolvedDependencies resolvedDependencies) { Set<ArchivePath> remove = new HashSet<>(); filter(remove, getArchive().get(ArchivePaths.root()), resolvedDependencies); for (ArchivePath each : remove) { getArchive().delete(each); } }
protected void filter(ResolvedDependencies resolvedDependencies) { Set<ArchivePath> remove = new HashSet<>(); filter(remove, getArchive().get(ArchivePaths.root()), resolvedDependencies); for (ArchivePath each : remove) { getArchive().delete(each); } }
@Test public void getPathRoot() { final Path path = fileSystem.getPath("/"); Assert.assertEquals("Root path not obtained correctly", ArchivePaths.root().get(), path.toString()); }
@Test public void get() throws URISyntaxException { // Get a previously-opened filesystem by passing in a mounted URI final Path path = Paths.get(ShrinkWrapFileSystems.getRootUri(archive)); Assert.assertTrue("Wrong Path implementation returned", path instanceof ShrinkWrapPath); Assert.assertEquals("Path returned is not correct", ArchivePaths.root().get(), path.toString()); }
@Test public void rootIsAbsolute() { final Path path = fileSystem.getPath("/"); Assert.assertTrue("Root path must be absolute", path.isAbsolute()); Assert.assertEquals("Root path should be equal to root archive path value", path.toString(), ArchivePaths .root().get()); }
@Test public void rootDirectories() { final Iterable<Path> paths = fileSystem.getRootDirectories(); int count = 0; for (final Path path : paths) { count++; Assert.assertEquals("Root was not in expected form", ArchivePaths.root().get(), path.toString()); } Assert.assertEquals("Should only be one root path per FS", 1, count); }
/** * Ensure adding an archive to a path requires an archive * * @throws Exception */ @Test public void testAddArchiveToPathRequireArchive() throws Exception { Archive<T> archive = getArchive(); try { archive.add((Archive<?>) null, ArchivePaths.root(), ZipExporter.class); Assert.fail("Should have throw an IllegalArgumentException"); } catch (IllegalArgumentException expectedException) { } }
/** * Ensure adding an asset with a name under an {@link ArchivePath} context results in successful storage * * @throws Exception */ @Test public void testAddAssetWithArchivePathAndName() throws Exception { Archive<T> archive = getArchive(); final String name = "test.properties"; final Asset asset = new ClassLoaderAsset(NAME_TEST_PROPERTIES); ArchivePath location = ArchivePaths.root(); archive.add(asset, location, name); ArchivePath expectedPath = new BasicPath("/", "test.properties"); Assert.assertTrue("Asset should be placed on " + expectedPath.get(), archive.contains(expectedPath)); }