• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PackageRevision类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: latestModificationSince

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
@Override
public PackageRevision latestModificationSince(PackageConfiguration packageConfiguration,
                                               RepositoryConfiguration repositoryConfiguration,
                                               PackageRevision previouslyKnownRevision) {
    LOGGER.debug("latestModificationSince called with previous revision " + previouslyKnownRevision);

    PackageRevision latestRevision = getLatestRevision(packageConfiguration, repositoryConfiguration);

    if (latestRevision != null &&
            latestRevision.getTimestamp().after(previouslyKnownRevision.getTimestamp()))
    {
        LOGGER.info("Latest revision later than previous known.");
        return latestRevision;
    } else {
        return previouslyKnownRevision;
    }
}
 
开发者ID:Sounie,项目名称:springer-gocd-cloudfoundry-plugin,代码行数:18,代码来源:CloudFoundryPoller.java


示例2: latestModificationSince

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
public PackageRevision latestModificationSince(PackageConfiguration packageConfig, RepositoryConfiguration repoConfig, PackageRevision previouslyKnownRevision) {
    LOGGER.info(String.format("latestModificationSince called with packageId %s, for repo: %s",
            packageConfig.get(NpmPackageConfig.PACKAGE_ID).getValue(), repoConfig.get(RepoUrl.REPO_URL).getValue()));
    validateConfig(repoConfig, packageConfig);
    NpmPackageConfig npmPackageConfig = new NpmPackageConfig(packageConfig);
    NpmParams params = new NpmParams(
            new NpmRepoConfig(repoConfig).getRepoUrl(),
            npmPackageConfig.getPackageId(),
            npmPackageConfig.getPollVersionFrom(),
            npmPackageConfig.getPollVersionTo(),
            previouslyKnownRevision);
    PackageRevision updatedPackage = poll(params);
    if (updatedPackage == null) {
        LOGGER.info(String.format("no modification since %s", previouslyKnownRevision.getRevision()));
        return null;
    }
    LOGGER.info(String.format("latestModificationSince returning with %s, %s",
            updatedPackage.getRevision(), updatedPackage.getTimestamp()));
    if (updatedPackage.getTimestamp().getTime() < previouslyKnownRevision.getTimestamp().getTime())
        LOGGER.warn(String.format("Updated Package %s published earlier (%s) than previous (%s, %s)",
                updatedPackage.getRevision(), updatedPackage.getTimestamp(), previouslyKnownRevision.getRevision(), previouslyKnownRevision.getTimestamp()));
    return updatedPackage;
}
 
开发者ID:varchev,项目名称:go-npm-poller,代码行数:24,代码来源:NpmPoller.java


示例3: latestModificationSince

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
@Override
@EntryPoint
public PackageRevision latestModificationSince(PackageConfiguration packageConfiguration, RepositoryConfiguration repositoryConfiguration, PackageRevision lastKnownRevision) {
    ModuleSpec module = moduleSpecFactory.build(packageConfiguration);
    Forge forge = forgeFactory.build(repositoryConfiguration);
    Version lastKnownReleaseVersion = Version.of(lastKnownRevision.getRevision());

    LOG.info("Looking up latest release of module %s in forge %s since version %s", module, forge, lastKnownReleaseVersion);
    try {
        ModuleVersion latestRelease = forge.getLatestVersion(module);
        if (latestRelease.getVersion().isGreaterThan(lastKnownReleaseVersion)) {
            //TODO: warn if this release is earlier than lastKnownRevision
            return latestRelease.toPackageRevision();
        } else {
            return null;
        }
    } catch (Forge.ModuleNotFound moduleNotFound) {
        LOG.info("Module %s not found in forge %s: %s", module, forge, moduleNotFound);
        return null;
    }
}
 
开发者ID:drrb,项目名称:go-puppet-forge-poller,代码行数:22,代码来源:ForgePoller.java


示例4: checkConnectionToPackage

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
/**
 * Check if the package is valid.
 *
 * @param packageConfiguration
 * @param repositoryConfiguration
 * @return
 */
@Override
public Result checkConnectionToPackage(
        final PackageConfiguration packageConfiguration, 
        final RepositoryConfiguration repositoryConfiguration) {
    
    Result checkConnectionResult = this.checkConnectionToRepository(repositoryConfiguration);
    if (!checkConnectionResult.isSuccessful()) {
        return checkConnectionResult;
    }

    try {
        Result packageConfigurationValidationResult = packageValidation(packageConfiguration, repositoryConfiguration);
        if (!packageConfigurationValidationResult.isSuccessful()) {
            return packageConfigurationValidationResult;
        }

        PackageRevision latestRevision = this.getLatestRevision(packageConfiguration, repositoryConfiguration);
        return new Result().withSuccessMessages(String.format("Found package '%s'.", latestRevision.getRevision()));
    } catch (Exception e) {
        String message = String.format("Could not find any package that matched '%s'.", packageConfiguration.get(Constants.REPOSITORY).getValue());
        LOG.warn(message);
        return new Result().withErrorMessages(message);
    }
}
 
开发者ID:decoomanj,项目名称:gocd-docker-material-poller,代码行数:32,代码来源:DockerMaterialPoller.java


示例5: getLatestRevision

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
public PackageRevision getLatestRevision(PackageConfiguration packageConfig, RepositoryConfiguration repoConfig) {
    LOGGER.info(String.format("getLatestRevision called with packageName %s, for repo: %s",
            packageConfig.get(GenericArtifactoryPackageConfig.PACKAGE_ID).getValue(), repoConfig.get(RepoUrl.REPO_URL).getValue()));

    validateConfig(repoConfig, packageConfig);

    GenericArtifactoryPackageConfig artifactoryPackageConfig = new GenericArtifactoryPackageConfig(packageConfig);
    GenericArtifactoryRepoConfig artifactoryRepoConfig = new GenericArtifactoryRepoConfig(repoConfig);

    GenericArtifactoryParams params = GenericArtifactoryParams.createFrom(
            artifactoryRepoConfig.getRepoUrl(),
            artifactoryPackageConfig,
            null);

    PackageRevision packageRevision = poll(params);

    LOGGER.info(String.format("getLatestRevision returning with %s, %s",
            packageRevision.getRevision(),
            packageRevision.getTimestamp()));

    return packageRevision;
}
 
开发者ID:varchev,项目名称:go-generic-artifactory-poller,代码行数:23,代码来源:GenericArtifactoryPoller.java


示例6: shouldTalkToPluginToGetLatestModification

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
@Test
public void shouldTalkToPluginToGetLatestModification() throws Exception {
    String expectedRequestBody = "{\"repository-configuration\":{\"key-one\":{\"value\":\"value-one\"},\"key-two\":{\"value\":\"value-two\"}}," +
            "\"package-configuration\":{\"key-three\":{\"value\":\"value-three\"},\"key-four\":{\"value\":\"value-four\"}}}";


    String expectedResponseBody = "{\"revision\":\"abc.rpm\",\"timestamp\":\"2011-07-14T19:43:37.100Z\",\"user\":\"some-user\",\"revisionComment\":\"comment\"," +
            "\"trackbackUrl\":\"http:\\\\localhost:9999\",\"data\":{\"dataKeyOne\":\"data-value-one\",\"dataKeyTwo\":\"data-value-two\"}}";

    when(pluginManager.isPluginOfType(PACKAGE_MATERIAL_EXTENSION, PLUGIN_ID)).thenReturn(true);
    when(pluginManager.submitTo(eq(PLUGIN_ID), requestArgumentCaptor.capture())).thenReturn(DefaultGoPluginApiResponse.success(expectedResponseBody));

    PackageRevision packageRevision = extension.getLatestRevision(PLUGIN_ID, packageConfiguration, repositoryConfiguration);

    assertRequest(requestArgumentCaptor.getValue(), PACKAGE_MATERIAL_EXTENSION, "1.0", PackageRepositoryExtension.REQUEST_LATEST_REVISION, expectedRequestBody);
    assertPackageRevision(packageRevision, "abc.rpm", "some-user", "2011-07-14T19:43:37.100Z", "comment", "http:\\localhost:9999");
}
 
开发者ID:gocd,项目名称:gocd,代码行数:18,代码来源:PackageRepositoryExtensionTest.java


示例7: shouldTalkToPluginToGetLatestModificationSinceLastRevision

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
@Test
public void shouldTalkToPluginToGetLatestModificationSinceLastRevision() throws Exception {
    String expectedRequestBody = "{\"repository-configuration\":{\"key-one\":{\"value\":\"value-one\"},\"key-two\":{\"value\":\"value-two\"}}," +
            "\"package-configuration\":{\"key-three\":{\"value\":\"value-three\"},\"key-four\":{\"value\":\"value-four\"}}," +
            "\"previous-revision\":{\"revision\":\"abc.rpm\",\"timestamp\":\"2011-07-13T19:43:37.100Z\",\"data\":{\"dataKeyOne\":\"data-value-one\",\"dataKeyTwo\":\"data-value-two\"}}}";


    String expectedResponseBody = "{\"revision\":\"abc.rpm\",\"timestamp\":\"2011-07-14T19:43:37.100Z\",\"user\":\"some-user\",\"revisionComment\":\"comment\"," +
            "\"trackbackUrl\":\"http:\\\\localhost:9999\",\"data\":{\"dataKeyOne\":\"data-value-one\",\"dataKeyTwo\":\"data-value-two\"}}";

    Date timestamp = new SimpleDateFormat(DATE_FORMAT).parse("2011-07-13T19:43:37.100Z");
    Map data = new LinkedHashMap();
    data.put("dataKeyOne", "data-value-one");
    data.put("dataKeyTwo", "data-value-two");
    PackageRevision previouslyKnownRevision = new PackageRevision("abc.rpm", timestamp, "someuser", "comment", null, data);

    when(pluginManager.isPluginOfType(PACKAGE_MATERIAL_EXTENSION, PLUGIN_ID)).thenReturn(true);
    when(pluginManager.submitTo(eq(PLUGIN_ID), requestArgumentCaptor.capture())).thenReturn(DefaultGoPluginApiResponse.success(expectedResponseBody));

    PackageRevision packageRevision = extension.latestModificationSince(PLUGIN_ID, packageConfiguration, repositoryConfiguration, previouslyKnownRevision);

    assertRequest(requestArgumentCaptor.getValue(), PACKAGE_MATERIAL_EXTENSION, "1.0", PackageRepositoryExtension.REQUEST_LATEST_REVISION_SINCE, expectedRequestBody);
    assertPackageRevision(packageRevision, "abc.rpm", "some-user", "2011-07-14T19:43:37.100Z", "comment", "http:\\localhost:9999");
}
 
开发者ID:gocd,项目名称:gocd,代码行数:25,代码来源:PackageRepositoryExtensionTest.java


示例8: shouldGetLatestModificationsAlongWithAdditionalDataFromThePackageRevision

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
@Test
public void shouldGetLatestModificationsAlongWithAdditionalDataFromThePackageRevision() {
    Date timestamp = new Date();

    PackageRevision packageRevision = new PackageRevision("revision-123", timestamp, "user");
    String dataKey = "extra_data";
    String dataValue = "value";
    packageRevision.addData(dataKey, dataValue);
    when(packageRepositoryExtension.getLatestRevision(eq(material.getPluginId()), packageConfiguration.capture(), repositoryConfiguration.capture())).thenReturn(packageRevision);

    HashMap<String, String> expected = new HashMap<>();
    expected.put(dataKey, dataValue);

    List<Modification> modifications = poller.latestModification(material, null, null);

    assertThat(modifications.get(0).getRevision(), is("revision-123"));
    assertThat(modifications.get(0).getModifiedTime(), is(timestamp));
    assertThat(modifications.get(0).getUserName(), is("user"));
    assertThat(modifications.get(0).getComment(), is(notNullValue()));
    assertThat(modifications.get(0).getAdditionalData(), is(JsonHelper.toJsonString(expected)));
    assertConfiguration(packageConfiguration.getValue(), material.getPackageDefinition().getConfiguration());
    assertConfiguration(repositoryConfiguration.getValue(), material.getPackageDefinition().getRepository().getConfiguration());
}
 
开发者ID:gocd,项目名称:gocd,代码行数:24,代码来源:PackageMaterialPollerTest.java


示例9: shouldTalkToPlugInToGetLatestModifications

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
@Test
public void shouldTalkToPlugInToGetLatestModifications() {
    Date timestamp = new Date();

    when(packageRepositoryExtension.getLatestRevision(eq(material.getPluginId()), packageConfiguration.capture(), repositoryConfiguration.capture())).thenReturn(new PackageRevision("revision-123", timestamp, "user"));


    List<Modification> modifications = poller.latestModification(material, null, null);

    assertThat(modifications.get(0).getRevision(), is("revision-123"));
    assertThat(modifications.get(0).getModifiedTime(), is(timestamp));
    assertThat(modifications.get(0).getUserName(), is("user"));
    assertThat(modifications.get(0).getComment(), is(notNullValue()));
    assertConfiguration(packageConfiguration.getValue(), "name", "go-agent");
    assertConfiguration(repositoryConfiguration.getValue(), "url", "http://some-url");

}
 
开发者ID:gocd,项目名称:gocd,代码行数:18,代码来源:PackageMaterialPollerTest.java


示例10: shouldTalkToPlugInToGetModificationsSinceAGivenRevision

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
@Test
public void shouldTalkToPlugInToGetModificationsSinceAGivenRevision() {
    Date timestamp = new Date();
    PackageMaterialRevision knownRevision = new PackageMaterialRevision("rev-122", timestamp);
    ArgumentCaptor<PackageRevision> knownPackageRevision = ArgumentCaptor.forClass(PackageRevision.class);
    PackageRevision latestRevision = new PackageRevision("rev-123", timestamp, "user");

    when(packageRepositoryExtension.latestModificationSince(eq(material.getPluginId()), packageConfiguration.capture(), repositoryConfiguration.capture(), knownPackageRevision.capture())).thenReturn(latestRevision);

    List<Modification> modifications = poller.modificationsSince(material, null, knownRevision, null);

    assertThat(modifications.get(0).getRevision(), is("rev-123"));
    assertThat(modifications.get(0).getModifiedTime(), is(timestamp));
    assertThat(modifications.get(0).getUserName(), is("user"));
    assertThat(modifications.get(0).getComment(), is(notNullValue()));
    assertConfiguration(packageConfiguration.getValue(), "name", "go-agent");
    assertConfiguration(repositoryConfiguration.getValue(), "url", "http://some-url");
    assertThat(knownPackageRevision.getValue().getRevision(), is("rev-122"));
    assertThat(knownPackageRevision.getValue().getTimestamp(), is(timestamp));

}
 
开发者ID:gocd,项目名称:gocd,代码行数:22,代码来源:PackageMaterialPollerTest.java


示例11: shouldNotThrowUpWhenDataKeyIsInvalid

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
@Ignore
@Test
public void shouldNotThrowUpWhenDataKeyIsInvalid() throws Exception {
    String invalidKey = "!INVALID";
    ReflectionUtil.setStaticField(Constants.class, "PACKAGE_LOCATION", invalidKey);
    try {
        PackageRevision latestRevision = null;
        try {
            latestRevision = poller.getLatestRevision(packagePackageConfigurations, repositoryPackageConfigurations);
        } catch (Exception e) {
            e.printStackTrace();
            fail("should not throw exception");
        }
        assertThat(latestRevision.getDataFor(invalidKey), is(nullValue()));
    } finally {
        ReflectionUtil.setStaticField(Constants.class, "PACKAGE_LOCATION", "LOCATION");
    }
}
 
开发者ID:gocd-contrib,项目名称:deb-repo-poller,代码行数:19,代码来源:DebRepositoryPollerTest.java


示例12: getPackageRevision

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
public PackageRevision getPackageRevision() {

        if(versionsList.isEmpty()){
            if(lastKnownVersion != null) return null;
            else throw new NpmException("No such package found");
        }
        PackageRevision result = new PackageRevision(getPackageVersion(), getPublishedDate(), getAuthor());
        result.addData(NpmPackageConfig.PACKAGE_LOCATION, getPackageLocation());
        result.addData(NpmPackageConfig.PACKAGE_VERSION, getPackageVersion());
        return result;
    }
 
开发者ID:varchev,项目名称:go-npm-poller,代码行数:12,代码来源:NpmFeedDocument.java


示例13: NpmParams

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
public NpmParams(RepoUrl repoUrl, String packageId, String pollVersionFrom, String pollVersionTo, PackageRevision previouslyKnownRevision) {
    this.repoUrl = repoUrl;
    this.packageId = packageId;
    if (pollVersionFrom != null && !pollVersionFrom.trim().isEmpty()) this.pollVersionFrom = pollVersionFrom;
    if (pollVersionTo != null && !pollVersionTo.trim().isEmpty()) this.pollVersionTo = pollVersionTo;
    this.lastKnownVersion = previouslyKnownRevision;
}
 
开发者ID:varchev,项目名称:go-npm-poller,代码行数:8,代码来源:NpmParams.java


示例14: getLatestRevision

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
public PackageRevision getLatestRevision(PackageConfiguration packageConfig, RepositoryConfiguration repoConfig) {
    LOGGER.info(String.format("getLatestRevision called with packageId %s, for repo: %s",
            packageConfig.get(NpmPackageConfig.PACKAGE_ID).getValue(), repoConfig.get(RepoUrl.REPO_URL).getValue()));
    validateConfig(repoConfig, packageConfig);
    NpmPackageConfig npm = new NpmPackageConfig(packageConfig);
    NpmParams params = new NpmParams(
            new NpmRepoConfig(repoConfig).getRepoUrl(),
            npm.getPackageId(),
            npm.getPollVersionFrom(),
            npm.getPollVersionTo(), null);
    PackageRevision packageRevision = poll(params);
    LOGGER.info(String.format("getLatestRevision returning with %s, %s",
            packageRevision.getRevision(), packageRevision.getTimestamp()));
    return packageRevision;
}
 
开发者ID:varchev,项目名称:go-npm-poller,代码行数:16,代码来源:NpmPoller.java


示例15: checkConnectionToPackage

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
@Override
public Result checkConnectionToPackage(PackageConfiguration packageConfigs, RepositoryConfiguration repoConfigs) {
    Result response = checkConnectionToRepository(repoConfigs);
    if (!response.isSuccessful()) {
        LOGGER.info(response.getMessagesForDisplay());
        return response;
    }
    PackageRevision packageRevision = getLatestRevision(packageConfigs, repoConfigs);
    response.withSuccessMessages("Found " + packageRevision.getRevision());
    return response;
}
 
开发者ID:varchev,项目名称:go-npm-poller,代码行数:12,代码来源:NpmPoller.java


示例16: poll

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
public PackageRevision poll(NpmParams params) {
    String url = params.getQuery();
    LOGGER.info(url);
    PackageRevision packageRevision = new NpmFeedDocument(new Feed(url).download(), params.getPollVersionFrom(), params.getPollVersionTo(), params.getLastKnownVersion()).getPackageRevision();
    if (packageRevision != null && params.getRepoUrl().getCredentials().provided())
        addUserInfoToLocation(packageRevision, params.getRepoUrl().getCredentials());
    return packageRevision;
}
 
开发者ID:varchev,项目名称:go-npm-poller,代码行数:9,代码来源:NpmPoller.java


示例17: shouldIgnoreLowerBoundDuringUpdate

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
@Test
public void shouldIgnoreLowerBoundDuringUpdate(){
    PackageRevision known = new PackageRevision("1.1.2",null,"abc");
    known.addData(PACKAGE_VERSION,"1.1.2");
    NpmParams params = new NpmParams(RepoUrl.create("http://registry.npmjs.org", null, null),
            "express", "1.0", null, known);
    assertThat(params.getQuery(),
            is("http://registry.npmjs.org/express"));
}
 
开发者ID:varchev,项目名称:go-npm-poller,代码行数:10,代码来源:NpmParamsTest.java


示例18: shouldCreatePackageRevision

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
@Test
public void shouldCreatePackageRevision() throws Exception {
    String fileContent = FileUtils.readFileToString(new File("test" + File.separator + "fast" + File.separator + "npm-good-feed.json"));
    JSONObject doc = new JSONObject(fileContent);
    PackageRevision result = new NpmFeedDocument(doc,null,null,null).getPackageRevision();
    assertThat(result.getUser(), is("Jeremy Ashkenas"));
    assertThat(result.getRevision(), is("1.6.0"));

    assertThat(result.getTimestamp(), is(javax.xml.bind.DatatypeConverter.parseDateTime(("2014-02-10T21:14:55.838Z")).getTime()));
    assertThat(result.getDataFor(NpmPackageConfig.PACKAGE_LOCATION), is("http://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz"));
    assertThat(result.getDataFor(NpmPackageConfig.PACKAGE_VERSION), is("1.6.0"));
}
 
开发者ID:varchev,项目名称:go-npm-poller,代码行数:13,代码来源:NpmFeedDocumentTest.java


示例19: PollerShouldExcuteCorrectCmd

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
@Test
public void PollerShouldExcuteCorrectCmd(){
    NpmPoller poller = new NpmPoller();
    NpmPoller spy = spy(poller);
    RepositoryConfiguration repoCfgs = mock(RepositoryConfiguration.class);
    PackageConfiguration pkgCfgs = mock(PackageConfiguration.class);
    String repoUrlStr = "http://google.com";//something valid to satisfy connection check
    when(repoCfgs.get(RepoUrl.REPO_URL)).thenReturn(new PackageMaterialProperty(RepoUrl.REPO_URL, repoUrlStr));
    String user = "user";
    when(repoCfgs.get(RepoUrl.USERNAME)).thenReturn(new PackageMaterialProperty(RepoUrl.USERNAME, user));
    String password = "passwrod";
    when(repoCfgs.get(RepoUrl.PASSWORD)).thenReturn(new PackageMaterialProperty(RepoUrl.PASSWORD, password));
    String packageId = "express";
    Property property = new PackageMaterialProperty(NpmPackageConfig.PACKAGE_ID, packageId);
    when(pkgCfgs.get(NpmPackageConfig.PACKAGE_ID)).thenReturn(property);
    PackageRevision dummyResult = new PackageRevision("1.0", new Date(),"user");
    RepoUrl repoUrl = RepoUrl.create(repoUrlStr, user, password);
    final NpmParams params = new NpmParams(repoUrl, packageId, null, null, null);
    Matcher<NpmParams> npmParamsMatcher = new BaseMatcher<NpmParams>() {
        NpmParams expected = params;
        @Override
        public boolean matches(Object item) {
            NpmParams npmParams = (NpmParams) item;
            return expected.getPackageId().equals(npmParams.getPackageId()) &&
                    expected.getRepoUrl().equals(npmParams.getRepoUrl());
        }

        @Override
        public void describeTo(Description description) {
            description.appendText(expected.getPackageId());
        }
    };
    doReturn(dummyResult).when(spy).poll(argThat(npmParamsMatcher));
    //actual test
    spy.getLatestRevision(pkgCfgs, repoCfgs);
    verify(spy).poll(argThat(npmParamsMatcher));
}
 
开发者ID:varchev,项目名称:go-npm-poller,代码行数:38,代码来源:NpmPollerTest.java


示例20: shouldGetUpdateWhenLastVersionKnown

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入依赖的package包/类
@Test
public void shouldGetUpdateWhenLastVersionKnown() throws ParseException {
    PackageRevision lastKnownVersion = new PackageRevision("1Password-1.0.9.288", new SimpleDateFormat("yyyy-MM-dd").parse("2013-03-21"), "xyz");
    lastKnownVersion.addData(PACKAGE_VERSION, "1.5.2");
    PackageRevision result = new NpmPoller().poll(new NpmParams(RepoUrl.create("http://registry.npmjs.org", null, null), "underscore", null, null, lastKnownVersion));
    assertThat(result.getDataFor(PACKAGE_VERSION), is("1.6.0"));
}
 
开发者ID:varchev,项目名称:go-npm-poller,代码行数:8,代码来源:NpmTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ContentType类代码示例发布时间:2022-05-23
下一篇:
Java XValuePresentation类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap