Package java.nio.file

Examples of java.nio.file.Path.resolve()


    assertThat(DirSupport.copyIfExists(root.toPath(), target), is(true));
    assertThat(target.toFile(), exists());
    assertThat(target.toFile(), isDirectory());
    assertThat(target.toFile(), not(isEmptyDirectory()));
    assertThat(target.resolve("dir2").resolve("dir21").toFile(), isDirectory());
    assertThat(target.resolve("dir2").resolve("dir21").resolve("file211.txt").toFile(), isFile());
  }

  @Test
  public void move() throws IOException {
    final Path target = util.createTempDir().toPath();
View Full Code Here


    DirSupport.move(root.toPath(), target);
    assertThat(root, not(exists()));
    assertThat(target.toFile(), exists());
    assertThat(target.toFile(), isDirectory());
    assertThat(target.toFile(), not(isEmptyDirectory()));
    assertThat(target.resolve("dir2").resolve("dir21").toFile(), isDirectory());
    assertThat(target.resolve("dir2").resolve("dir21").resolve("file211.txt").toFile(), isFile());
  }

  @Test
  public void moveIfExists() throws IOException {
View Full Code Here

    assertThat(root, not(exists()));
    assertThat(target.toFile(), exists());
    assertThat(target.toFile(), isDirectory());
    assertThat(target.toFile(), not(isEmptyDirectory()));
    assertThat(target.resolve("dir2").resolve("dir21").toFile(), isDirectory());
    assertThat(target.resolve("dir2").resolve("dir21").resolve("file211.txt").toFile(), isFile());
  }

  @Test
  public void moveIfExists() throws IOException {
    final Path target = util.createTempDir().toPath();
View Full Code Here

    assertThat(DirSupport.moveIfExists(root.toPath(), target), is(true));
    assertThat(root, not(exists()));
    assertThat(target.toFile(), exists());
    assertThat(target.toFile(), isDirectory());
    assertThat(target.toFile(), not(isEmptyDirectory()));
    assertThat(target.resolve("dir2").resolve("dir21").toFile(), isDirectory());
    assertThat(target.resolve("dir2").resolve("dir21").resolve("file211.txt").toFile(), isFile());
  }

  @Test
  public void apply() throws IOException {
View Full Code Here

    assertThat(root, not(exists()));
    assertThat(target.toFile(), exists());
    assertThat(target.toFile(), isDirectory());
    assertThat(target.toFile(), not(isEmptyDirectory()));
    assertThat(target.resolve("dir2").resolve("dir21").toFile(), isDirectory());
    assertThat(target.resolve("dir2").resolve("dir21").resolve("file211.txt").toFile(), isFile());
  }

  @Test
  public void apply() throws IOException {
    final ArrayList<String> fileNames = Lists.newArrayList();
View Full Code Here

        assertPathExists(root, "styles/stuff.sld");
        assertPathExists(root, "data/bar/stuff.properties");

        // ensure the exported store config points to the properties
        DataStoreInfo store = new XStreamPersisterFactory().createXMLPersister()
                .load(new FileInputStream(root.resolve("bar/datastore.xml").toFile()), DataStoreInfo.class);

        assertEquals("file:%WORKSPACE%/data/bar", store.getConnectionParameters().get("directory"));
    }

    @Test
View Full Code Here

        assertPathExists(root, "bar/widgets/featuretype.xml");
        assertPathExists(root, "bar/widgets/layer.xml");
        assertPathExists(root, "data/bar.gpkg");

        // ensure the geopackage has the right data in it
        GeoPackage gpkg = new GeoPackage(root.resolve("data/bar.gpkg").toFile());
        try {
            assertEquals(2, gpkg.features().size());
            assertNotNull(gpkg.feature("stuff"));
            assertNotNull(gpkg.feature("widgets"));
        }
View Full Code Here

            gpkg.close();
        }

        // ensure the exported store config points to the geopackage
        DataStoreInfo store = new XStreamPersisterFactory().createXMLPersister()
            .load(new FileInputStream(root.resolve("bar/datastore.xml").toFile()), DataStoreInfo.class);

        assertEquals("geopkg", store.getConnectionParameters().get("dbtype"));
        assertEquals("file:%WORKSPACE%/data/bar.gpkg", store.getConnectionParameters().get("database"));
    }
View Full Code Here

        Path root = exporter.run();

        assertPathExists(root, "bundle.json");

        try (
            FileInputStream in =  new FileInputStream(root.resolve("bundle.json").toFile());
        ) {
            JSONObj obj = JSONWrapper.read(in).toObject();
            assertEquals("blah", obj.str("name"));
        }
    }
View Full Code Here

        Path tmp = Files.createTempDirectory(Paths.get("target"), "export");
        org.geoserver.data.util.IOUtils.decompress(
            new ByteArrayInputStream(response.getContentAsByteArray()), tmp.toFile());

        assertTrue(tmp.resolve("bundle.json").toFile().exists());
    }

    @Test
    public void testWorkspaceImport() throws Exception {
        MockHttpServletRequest request = new MockHttpServletRequest();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.