Package java.io

Examples of java.io.File.toPath()


            result_ok = false;
            posix_errno = Posix.ENOENT;
            return;
          }
         
          Path path = file.toPath();
          PosixFileAttributes attrs;
          try {
            attrs = Files.readAttributes(path, PosixFileAttributes.class, LinkOption.NOFOLLOW_LINKS);

          } catch (IOException e) {
View Full Code Here


    File dir = new File(System.getenv("beaker_tmp_dir"));
    File tmp = File.createTempFile(base, suffix, dir);
    if (!windows()) {
      Set<PosixFilePermission> perms = EnumSet.of(PosixFilePermission.OWNER_READ,
                                                  PosixFilePermission.OWNER_WRITE);
      Files.setPosixFilePermissions(tmp.toPath(), perms);
    }
    return tmp.getAbsolutePath();
  }

  private BufferedWriter openTemp(String location)
View Full Code Here

      shell.execute("cd " + testFolder, 5, TimeUnit.SECONDS);
      shell.execute("touch " + file, 5, TimeUnit.SECONDS);
      shell.execute("cd ..", 5, TimeUnit.SECONDS);

      File fileSource = new File(tmpDir, file);
      Files.write(fileSource.toPath(), "TEST".getBytes());
      File fileTarget = new File(new File(tmpDir, testFolder), file);
      Assert.assertTrue(fileSource.exists());
      Assert.assertTrue(fileTarget.exists());
      shell.execute("cp " + file + " " + testFolder, 5, TimeUnit.MINUTES);
      Assert.assertTrue(fileSource.exists());
View Full Code Here

   public void testJsonResourceDataRead() throws Exception
   {
      File tmpFile = File.createTempFile("parser_json_test", ".json");
      tmpFile.deleteOnExit();
      String jsonData = "{\"firstName\": \"George\", \"lastName\": \"Gastaldi\"}";
      Files.write(tmpFile.toPath(), jsonData.getBytes());
      Resource<File> resource = resourceFactory.create(tmpFile);
      Assert.assertThat(resource, CoreMatchers.instanceOf(JsonResource.class));
      JsonResource jsonResource = resource.reify(JsonResource.class);
      JsonObject jsonObject = jsonResource.getJsonObject();
      Assert.assertNotNull(jsonObject);
View Full Code Here

    private File createDirInAppbase(boolean withXml) throws IOException {
        File dir = new File(getTomcatInstance().getHost().getAppBaseFile(),
                APP_NAME.getBaseName());
        if (withXml) {
            recurrsiveCopy(DIR_XML_SOURCE.toPath(), dir.toPath());
        } else {
            recurrsiveCopy(DIR_SOURCE.toPath(), dir.toPath());
        }
        return dir;
    }
View Full Code Here

        File dir = new File(getTomcatInstance().getHost().getAppBaseFile(),
                APP_NAME.getBaseName());
        if (withXml) {
            recurrsiveCopy(DIR_XML_SOURCE.toPath(), dir.toPath());
        } else {
            recurrsiveCopy(DIR_SOURCE.toPath(), dir.toPath());
        }
        return dir;
    }

    private File createDirXmlInAppbase() throws IOException {
View Full Code Here

    }

    private File createDirXmlInAppbase() throws IOException {
        File dir = new File(getTomcatInstance().getHost().getAppBaseFile(),
                APP_NAME.getBaseName() + "/META-INF");
        recurrsiveCopy(DIR_XML_SOURCE_META_INF.toPath(), dir.toPath());
        return dir;
    }

    private File createDirInExternal(boolean withXml) throws IOException {
        File ext = new File(external, "external" + ".war");
View Full Code Here

    }

    private File createDirInExternal(boolean withXml) throws IOException {
        File ext = new File(external, "external" + ".war");
        if (withXml) {
            recurrsiveCopy(DIR_XML_SOURCE.toPath(), ext.toPath());
        } else {
            recurrsiveCopy(DIR_SOURCE.toPath(), ext.toPath());
        }
        return ext;
    }
View Full Code Here

    private File createDirInExternal(boolean withXml) throws IOException {
        File ext = new File(external, "external" + ".war");
        if (withXml) {
            recurrsiveCopy(DIR_XML_SOURCE.toPath(), ext.toPath());
        } else {
            recurrsiveCopy(DIR_SOURCE.toPath(), ext.toPath());
        }
        return ext;
    }

    private File createWar(File src, boolean useAppbase) throws IOException {
View Full Code Here

            dest = new File(getTomcatInstance().getHost().getAppBaseFile(),
                APP_NAME.getBaseName() + ".war");
        } else {
            dest = new File(external, "external" + ".war");
        }
        Files.copy(src.toPath(), dest.toPath());
        return dest;
    }

    private File createXmlInConfigBaseForAppbase() throws IOException {
        File xml = getXmlInConfigBaseForAppbase();
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.