当前位置: 首页>>代码示例>>Java>>正文


Java VirtualChannel类代码示例

本文整理汇总了Java中hudson.remoting.VirtualChannel的典型用法代码示例。如果您正苦于以下问题:Java VirtualChannel类的具体用法?Java VirtualChannel怎么用?Java VirtualChannel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


VirtualChannel类属于hudson.remoting包,在下文中一共展示了VirtualChannel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: invoke

import hudson.remoting.VirtualChannel; //导入依赖的package包/类
@Override
public Boolean invoke(File file, VirtualChannel channel){
    try{
        Git git = Git.cloneRepository()
                .setURI(url)
                .setDirectory(localDir)
                .setTransportConfigCallback(getTransportConfigCallback())
                .setCredentialsProvider(new UsernamePasswordCredentialsProvider(username, password))
                .call();

        // Default branch to checkout is master
        if(branch==null || branch.isEmpty()){
            branch = "master";
        } else if (cloneType.equals("branch")){
            branch = "origin" + File.separator + branch;
        }
        git.checkout().setName(branch).call();
        git.close();
        }catch(GitAPIException e){
            status = false;
            e.printStackTrace(listener.getLogger());
        }
    return status;
}
 
开发者ID:warriorframework,项目名称:warrior-jenkins-plugin,代码行数:25,代码来源:WarriorPluginBuilder.java

示例2: invoke

import hudson.remoting.VirtualChannel; //导入依赖的package包/类
@Override
public Float invoke(final File ws, final VirtualChannel channel) throws IOException {
    final List<Float> cov = new ArrayList<Float>();
    cov.addAll(getFloats(ws, "**/cobertura.xml", new CoberturaParser()));
    cov.addAll(getFloats(ws, "**/cobertura-coverage.xml", new CoberturaParser()));
    cov.addAll(getFloats(ws, "**/jacoco.xml", new JacocoParser()));
    cov.addAll(getFloats(ws, "**/clover.xml", new CloverParser()));

    float s = 0;
    for (float v : cov) s += v;

    if (cov.isEmpty()) {
        return 0f;
    } else {
        return s / cov.size();
    }
}
 
开发者ID:terma,项目名称:github-pr-coverage-status,代码行数:18,代码来源:GetCoverageCallable.java

示例3: invoke

import hudson.remoting.VirtualChannel; //导入依赖的package包/类
@Override
public CxZipResult invoke(final File file, final VirtualChannel channel) throws IOException, InterruptedException {

    final File tempFile = File.createTempFile("base64ZippedSource", ".bin");
    FilePath remoteTempFile = new FilePath(tempFile);
    final OutputStream fileOutputStream = new FileOutputStream(tempFile);
    final Base64OutputStream base64FileOutputStream = new Base64OutputStream(fileOutputStream, true, 0, null);

    ZippingDetails zippingDetails;
    try {
        zippingDetails = new Zipper().zip(file, combinedFilterPattern, base64FileOutputStream, CxConfig.maxZipSize());
    } catch (Exception e) {
        deleteTempFile(remoteTempFile);
        throw e;

    } finally {
        fileOutputStream.close();
    }

    return new CxZipResult(remoteTempFile, zippingDetails);
}
 
开发者ID:jenkinsci,项目名称:checkmarx-plugin,代码行数:22,代码来源:SastZipperCallable.java

示例4: invoke

import hudson.remoting.VirtualChannel; //导入依赖的package包/类
public File[] invoke(File f, VirtualChannel channel) {
	File[] listFiles = {};
	
	Path pathAuthenticationScriptsDir = Paths.get(zapDefaultDir, NAME_SCRIPTS_DIR_ZAP, NAME_AUTHENTICATION_SCRIPTS_DIR_ZAP);
	 
	if(Files.isDirectory(pathAuthenticationScriptsDir)) {
		File zapAuthenticationScriptsDir =  pathAuthenticationScriptsDir.toFile() ;
		// create new filename filter (the filter returns true as all the extensions are accepted)
		FilenameFilter policyFilter = new FilenameFilter() {

			@Override
			
			public boolean accept(File dir, String name) {
				return true;
				 
			}
		};
		
		// returns pathnames for files and directory
		listFiles = zapAuthenticationScriptsDir.listFiles(policyFilter);
	}
	return listFiles;
}
 
开发者ID:jenkinsci,项目名称:zaproxy-plugin,代码行数:24,代码来源:ZAProxy.java

示例5: invoke

import hudson.remoting.VirtualChannel; //导入依赖的package包/类
public List<String> invoke(File f, VirtualChannel channel) throws IOException {
    PrintStream llog = taskListener.getLogger();
    llog.println("Creating connection to docker daemon...");
    try (DockerClient client = connector.getClient()) {
        BuildImageCmd buildImageCmd = client.buildImageCmd();
        buildImage.fillSettings(buildImageCmd);
        llog.println("Pulling image ");
        String imageId = buildImageCmd.exec(new MyBuildImageResultCallback(llog))
                .awaitImageId();
        llog.println(imageId);
        llog.println("Image tagging during build isn't support atm, no tags applied.");
    } catch (Exception ex) {
        LOG.error("Can't get client", ex);
        throw new IOException("Can't get docker client", ex);
    }

    return null;
}
 
开发者ID:KostyaSha,项目名称:yet-another-docker-plugin,代码行数:19,代码来源:DockerBuildImageStepFileCallable.java

示例6: newKeyMaterialFactory

import hudson.remoting.VirtualChannel; //导入依赖的package包/类
/**
 * Makes the key materials available locally and returns {@link KeyMaterialFactory} that gives you the parameters
 * needed to access it.
 */
public KeyMaterialFactory newKeyMaterialFactory(@Nonnull Item context, @Nonnull VirtualChannel target) throws IOException, InterruptedException {
    // as a build step, your access to credentials are constrained by what the build
    // can access, hence Jenkins.getAuthentication()
    DockerServerCredentials creds=null;
    if (credentialsId!=null) {
        List<DomainRequirement> domainRequirements = URIRequirementBuilder.fromUri(getUri()).build();
        domainRequirements.add(new DockerServerDomainRequirement());
        creds = CredentialsMatchers.firstOrNull(
                CredentialsProvider.lookupCredentials(
                        DockerServerCredentials.class, context, Jenkins.getAuthentication(),
                        domainRequirements),
                CredentialsMatchers.withId(credentialsId)
        );
    }

    // the directory needs to be outside workspace to avoid prying eyes
    FilePath dotDocker = dotDocker(target);
    dotDocker.mkdirs();
    // ServerKeyMaterialFactory.materialize creates a random subdir if one is needed:
    return newKeyMaterialFactory(dotDocker, creds);
}
 
开发者ID:jenkinsci,项目名称:docker-commons-plugin,代码行数:26,代码来源:DockerServerEndpoint.java

示例7: build

import hudson.remoting.VirtualChannel; //导入依赖的package包/类
/**
 * 
 * @param project_info
 * @return
 */
public boolean build(VirtualChannel channel, ByteArrayInputStream stream, BuildListener listener) {
	try {
		JAXBContext jaxbContext = JAXBContext.newInstance(Project.class);
		SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
		Schema schema = factory.newSchema(new StreamSource(ContinuousTestGeneration.class.getResourceAsStream("/xsd/ctg_project_report.xsd")));
		Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
		jaxbUnmarshaller.setSchema(schema);
		this.project = (Project) jaxbUnmarshaller.unmarshal(stream);

		for (CUT cut : this.project.getCut()) {
			ClassAction c = new ClassAction(this.getBuild(), cut);
			c.highlightSource(channel, listener);
			this.classes.add(c);
		}
	}
	catch(Exception e) {
		e.printStackTrace();
		return false;
	}

	return true;
}
 
开发者ID:EvoSuite,项目名称:evosuite,代码行数:28,代码来源:ModuleAction.java

示例8: invoke

import hudson.remoting.VirtualChannel; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Integer invoke(Repository repository, VirtualChannel channel) throws IOException, InterruptedException {
    RevWalk walker = new RevWalk(repository);
    RevCommit originCommit = walker.parseCommit(startObjectId);
    ObjectId targetId = repository.resolve(targetBranchName);
    RevCommit targetCommit = walker.parseCommit(targetId);

    walker.markStart(originCommit);
    walker.markUninteresting(targetCommit);

    int commitCount = 0;
    Iterator<RevCommit> iterator = walker.iterator();
    while (iterator.hasNext()) {
        iterator.next();
        commitCount++;
    }
    walker.dispose();

    return commitCount;
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:24,代码来源:GetCommitCountFromBranchCallback.java

示例9: invoke

import hudson.remoting.VirtualChannel; //导入依赖的package包/类
public List<MassifReport> invoke(File basedir, VirtualChannel virtualChannel) throws IOException, InterruptedException {
    List<MassifReport> reports = new Vector<MassifReport>();

    MassifLogger.logFine("looking for massif files in '" + basedir.getAbsolutePath() + "' with pattern '" + pattern + "'");
    for ( String fileName : findMassifReports(basedir) )
    {
        MassifLogger.logFine("parsing " + fileName + "...");
        try
        {
            MassifReport report = new MassifParser().parse( new File(basedir, fileName) );
            reports.add(report);
        }
        catch (Exception e)
        {
            MassifLogger.logWarn("failed to parse " + fileName + ": " + e.getMessage() + " at ");
            e.printStackTrace(MassifLogger.getLOGGER());
        }
    }

    return reports;
}
 
开发者ID:Perlmint,项目名称:massif-plugin,代码行数:22,代码来源:MassifParserResult.java

示例10: invoke

import hudson.remoting.VirtualChannel; //导入依赖的package包/类
@Override
public String invoke(final File dir, final VirtualChannel channel) throws IOException {
    dir.mkdirs();
    File f;
    Writer w = null;
    try {
        f = new File(dir.getAbsolutePath() + "/" + this.workspaceFile.fileName);
        f.createNewFile();
        w = new FileWriter(f);
        w.write(this.workspaceFile.contents);
        Files.setPosixFilePermissions(f.toPath(), PosixFilePermissions.fromString(this.workspaceFile.permissions));
    } finally {
        if (w != null) {
            w.close();
        }
    }
    return f.getAbsolutePath();
}
 
开发者ID:groupon,项目名称:DotCi,代码行数:19,代码来源:WorkspaceFileExporter.java

示例11: setLogLevel

import hudson.remoting.VirtualChannel; //导入依赖的package包/类
public static void setLogLevel(Level level) {
    SupportPlugin instance = getInstance();
    instance.handler.setLevel(level);
    for (Node n : Jenkins.getInstance().getNodes()) {
        Computer c = n.toComputer();
        if (c == null) {
            continue;
        }
        VirtualChannel channel = c.getChannel();
        if (channel != null) {
            try {
                channel.callAsync(new LogUpdater(level));
            } catch (IOException e) {
                // ignore
            }
        }
    }
}
 
开发者ID:jenkinsci,项目名称:support-core-plugin,代码行数:19,代码来源:SupportPlugin.java

示例12: invoke

import hudson.remoting.VirtualChannel; //导入依赖的package包/类
public Map<String, Long> invoke(File dir, VirtualChannel channel) throws IOException, InterruptedException {
    Map<String, Long> result = new LinkedHashMap<String, Long>();
    File[] files = dir.listFiles(filter);
    if (files == null) {
        return result;
    }
    for (File file : files) {
        FileHash hash = cached.get(file.getName());
        if (hash != null && hash.isPartialMatch(file)) {
            if (file.length() == hash.getLength()) {
                result.put(file.getName(), Long.MAX_VALUE); // indicate have everything
            } else {
                result.put(file.getName(), hash.getLength());
            }
        } else {
            // read the whole thing
            result.put(file.getName(), 0L);
        }
    }
    return result;
}
 
开发者ID:jenkinsci,项目名称:support-core-plugin,代码行数:22,代码来源:SmartLogFetcher.java

示例13: testLargeExportTableTruncated

import hudson.remoting.VirtualChannel; //导入依赖的package包/类
@Test
public void testLargeExportTableTruncated() throws Exception {
  // Given
  DumbSlave onlineSlave = j.createOnlineSlave();
  VirtualChannel channel = onlineSlave.getChannel();
  // This will generate an export table with 2MB of content.
  for (int i = 0; i < 35000; i++) {
    channel.export(MockSerializable.class, new MockSerializable() {
    });
  }

  // When
  String dumpTableString = SupportTestUtils.invokeComponentToString(new DumpExportTable());

  // Then
  assertThat(dumpTableString.length(), lessThanOrEqualTo(FileListCapComponent.MAX_FILE_SIZE));
}
 
开发者ID:jenkinsci,项目名称:support-core-plugin,代码行数:18,代码来源:DumpExportTableTest.java

示例14: invoke

import hudson.remoting.VirtualChannel; //导入依赖的package包/类
public Void invoke(File dir, VirtualChannel channel) throws IOException, InterruptedException {
    URLConnection con = archive.openConnection();
    // Jira Bug JENKINS-21033: Changing the User-Agent from "Java/<Java version #>" to "Jenkins/<Jenkins version #>"
    con.setRequestProperty("User-Agent", "Jenkins/" + Jenkins.getVersion().toString());
    InputStream in = con.getInputStream();
    try {
        CountingInputStream cis = new CountingInputStream(in);
        try {
            LOGGER.log(Level.INFO, "Invoke called for Unpack class to unpack to " + dir.getAbsolutePath());
            if (archive.toExternalForm().endsWith(".zip")) {
              LOGGER.log(Level.INFO, "Archive unzipped as it ends with '.zip'.  Starting unzip.");
              unzip(dir, cis);
            }
        } catch (IOException x) {
            throw new IOException(String.format("Failed to unpack %s (%d bytes read)", archive, cis.getByteCount()), x);
        }
    } finally {
        in.close();
    }
    return null;
}
 
开发者ID:jenkinsci,项目名称:cloudtest-plugin,代码行数:22,代码来源:CommonInstaller.java

示例15: getClient

import hudson.remoting.VirtualChannel; //导入依赖的package包/类
/**
 * {@link org.jenkinsci.plugins.gitclient.GitClient} implementation. The {@link org.jenkinsci.plugins.gitclient.GitClient} interface
 * provides the key operations which can be performed on a git repository.
 *
 * @return a {@link org.jenkinsci.plugins.gitclient.GitClient} for git operations on the repository
 * @throws java.io.IOException if any IO failure
 * @throws java.lang.InterruptedException if interrupted.
 */
public GitClient getClient() throws IOException, InterruptedException {
    jenkins.MasterToSlaveFileCallable<GitClient> callable = new jenkins.MasterToSlaveFileCallable<GitClient>() {
        public GitClient invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
            if (listener == null) listener = TaskListener.NULL;
            if (env == null) env = new EnvVars();

            if (exe == null || JGitTool.MAGIC_EXENAME.equalsIgnoreCase(exe)) {
                return new JGitAPIImpl(f, listener);
            }

            if (JGitApacheTool.MAGIC_EXENAME.equalsIgnoreCase(exe)) {
                final PreemptiveAuthHttpClientConnectionFactory factory = new PreemptiveAuthHttpClientConnectionFactory();
                return new JGitAPIImpl(f, listener, factory);
            }
            // Ensure we return a backward compatible GitAPI, even API only claim to provide a GitClient
            return new GitAPI(exe, f, listener, env);
        }
    };
    GitClient git = (repository!=null ? repository.act(callable) : callable.invoke(null,null));
    Jenkins jenkinsInstance = Jenkins.getInstance();
    if (jenkinsInstance != null && git != null)
        git.setProxy(jenkinsInstance.proxy);
    return git;
}
 
开发者ID:jenkinsci,项目名称:git-client-plugin,代码行数:33,代码来源:Git.java


注:本文中的hudson.remoting.VirtualChannel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。