Tabnine Logo
SCMFile
Code IndexAdd Tabnine to your IDE (free)

How to use
SCMFile
in
jenkins.scm.api

Best Java code snippets using jenkins.scm.api.SCMFile (Showing top 11 results out of 315)

origin: jenkinsci/subversion-plugin

@Override
public long lastModified() throws IOException, InterruptedException {
  return getRoot().lastModified();
}
origin: jenkinsci/subversion-plugin

assertThat(fs, notNullValue());
assertThat(fs.getRoot(), notNullValue());
Iterable<SCMFile> children = fs.getRoot().children();
Set<String> names = new TreeSet<String>();
SCMFile file = null;
SCMFile dir = null;
for (SCMFile f : children) {
  names.add(f.getName());
  if ("file".equals(f.getName())) {
    file = f;
  } else if ("file2".equals(f.getName())) {
    file2 = f;
  } else if ("dir".equals(f.getName())) {
    dir = f;
assertThat(file.getType(), is(SCMFile.Type.REGULAR_FILE));
assertThat(file2.getType(), is(SCMFile.Type.REGULAR_FILE));
assertThat(dir.getType(), is(SCMFile.Type.DIRECTORY));
assertThat(file.contentAsString(), is("modified"));
assertThat(file2.contentAsString(), is("new"));
origin: jenkinsci/workflow-multibranch-plugin

String script = null;
try {
  script = fs.child(scriptPath).contentAsString();
  listener.getLogger().println("Obtained " + scriptPath + " from " + rev);
} catch (IOException | InterruptedException x) {
origin: jenkinsci/subversion-plugin

@Test
public void ofSourceRevision() throws Exception {
  sampleRepo.init();
  sampleRepo.svnkit("copy", "--message=branching", sampleRepo.trunkUrl(), sampleRepo.branchesUrl() + "/dev");
  sampleRepo.svnkit("switch", sampleRepo.branchesUrl() + "/dev", sampleRepo.wc());
  SCMSource source = new SubversionSCMSource(null, sampleRepo.prjUrl());
  SCMRevision revision = source.fetch(new SCMHead("branches/dev"), null);
  sampleRepo.write("file", "modified");
  sampleRepo.svnkit("commit", "--message=dev1", sampleRepo.wc());
  try (SCMFileSystem fs = SCMFileSystem.of(source, new SCMHead("branches/dev"), revision)) {
    assertThat(fs, notNullValue());
    SCMFile root = fs.getRoot();
    assertThat(root, notNullValue());
    Iterable<SCMFile> children = root.children();
    Iterator<SCMFile> iterator = children.iterator();
    assertThat(iterator.hasNext(), is(true));
    SCMFile file = iterator.next();
    assertThat(iterator.hasNext(), is(false));
    assertThat(file.getName(), is("file"));
    assertThat(file.contentAsString(), is(""));
  }
}
origin: jenkinsci/subversion-plugin

SCMFile root = fs.getRoot();
assertThat(root, notNullValue());
assertTrue(root.isRoot());
Iterable<SCMFile> children = root.children();
Iterator<SCMFile> iterator = children.iterator();
assertThat(iterator.hasNext(), is(true));
SCMFile file = iterator.next();
assertThat(iterator.hasNext(), is(false));
assertThat(file.getName(), is("file"));
origin: jenkinsci/subversion-plugin

@Test
public void lastModified_Smokes() throws Exception {
  long currentTime = isWindows() ? System.currentTimeMillis() / 1000L * 1000L : System.currentTimeMillis();
  sampleRepo.init();
  sampleRepo.svnkit("copy", "--message=branching", sampleRepo.trunkUrl(), sampleRepo.branchesUrl() + "/dev");
  sampleRepo.svnkit("switch", sampleRepo.branchesUrl() + "/dev", sampleRepo.wc());
  SCMSource source = new SubversionSCMSource(null, sampleRepo.prjUrl());
  SCMRevision revision = source.fetch(new SCMHead("branches/dev"), null);
  long oneMinute = 60*1000;
  sampleRepo.write("file", "modified");
  sampleRepo.svnkit("commit", "--message=dev1", sampleRepo.wc());
  try (SCMFileSystem fs = SCMFileSystem.of(source, new SCMHead("branches/dev"), revision);) {			
    long lastModified = fs.lastModified();
    //ensure the timestamp is from after we started but not in the distant future
    assertThat(lastModified, greaterThanOrEqualTo(currentTime));
    assertThat(lastModified, lessThanOrEqualTo(currentTime + oneMinute));
    SCMFile file = fs.getRoot().child("file");
    lastModified = file.lastModified();
    assertThat(lastModified, greaterThanOrEqualTo(currentTime));
    assertThat(lastModified, lessThanOrEqualTo(currentTime + oneMinute));
  }
}
origin: jenkinsci/subversion-plugin

assertThat(fs, notNullValue());
assertThat(fs.getRoot(), notNullValue());
Iterable<SCMFile> children = fs.getRoot().children();
Iterator<SCMFile> iterator = children.iterator();
assertThat(iterator.hasNext(), is(true));
SCMFile dir = iterator.next();
assertThat(iterator.hasNext(), is(false));
assertThat(dir.getName(), is("dir"));
assertThat(dir.getType(), is(SCMFile.Type.DIRECTORY));
children = dir.children();
iterator = children.iterator();
assertThat(iterator.hasNext(), is(true));
SCMFile subdir = iterator.next();
assertThat(iterator.hasNext(), is(false));
assertThat(subdir.getName(), is("subdir"));
assertThat(subdir.getType(), is(SCMFile.Type.DIRECTORY));
children = subdir.children();
iterator = children.iterator();
assertThat(iterator.hasNext(), is(true));
SCMFile file = iterator.next();
assertThat(iterator.hasNext(), is(false));
assertThat(file.getName(), is("file"));
assertThat(file.contentAsString(), is("modified"));
origin: org.jenkins-ci.plugins.workflow/workflow-multibranch

String script = null;
try {
  script = fs.child(scriptPath).contentAsString();
  listener.getLogger().println("Obtained " + scriptPath + " from " + rev);
} catch (IOException | InterruptedException x) {
origin: jenkinsci/workflow-cps-plugin

try (SCMFileSystem fs = SCMFileSystem.of(build.getParent(), scm)) {
  if (fs != null) {
    String script = fs.child(expandedScriptPath).contentAsString();
    listener.getLogger().println("Obtained " + expandedScriptPath + " from " + scm.getKey());
    Queue.Executable exec = owner.getExecutable();
origin: jenkinsci/workflow-multibranch-plugin

      if (fs != null) { // JENKINS-33273
        try {
          String text = fs.child(step.path).contentAsString();
          listener.getLogger().println("Obtained " + step.path + " from " + standaloneSCM.getKey());
          return text;
if (trustedFS != null && (!trustCheck || tipFS != null)) {
  if (trustCheck) {
    untrustedFile = tipFS.child(step.path).contentAsString();
  content = trustedFS.child(step.path).contentAsString();
  listener.getLogger().println("Obtained " + step.path + " from " + trusted);
} else {
origin: org.jenkins-ci.plugins.workflow/workflow-multibranch

      if (fs != null) { // JENKINS-33273
        try {
          String text = fs.child(step.path).contentAsString();
          listener.getLogger().println("Obtained " + step.path + " from " + standaloneSCM.getKey());
          return text;
if (trustedFS != null && (!trustCheck || tipFS != null)) {
  if (trustCheck) {
    untrustedFile = tipFS.child(step.path).contentAsString();
  content = trustedFS.child(step.path).contentAsString();
  listener.getLogger().println("Obtained " + step.path + " from " + trusted);
} else {
jenkins.scm.apiSCMFile

Most used methods

  • contentAsString
  • lastModified
  • child
  • children
  • getName
  • getType
  • isRoot

Popular in Java

  • Start an intent from android
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setContentView (Activity)
  • onRequestPermissionsResult (Fragment)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Permission (java.security)
    Legacy security code; do not use.
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now