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


Java PackageRevision.addData方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: shouldReturnNullIfNoNewerRevision

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入方法依赖的package包/类
@Test
public void shouldReturnNullIfNoNewerRevision() throws ParseException {
    PackageRevision lastKnownVersion = new PackageRevision("underscore-10.0.9.332", new SimpleDateFormat("yyyy-MM-dd").parse("2014-03-21"), "xyz");
    lastKnownVersion.addData(PACKAGE_VERSION, "10.0.9.332");
    NpmParams params = new NpmParams(RepoUrl.create("http://registry.npmjs.org", null, null), "underscore", null, null, lastKnownVersion);
    assertNull(new NpmPoller().poll(params));

}
 
开发者ID:varchev,项目名称:go-npm-poller,代码行数:9,代码来源:NpmTest.java

示例6: getPackageRevision

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

        if(versionsList.isEmpty()){
            if(lastVersionKnown) return null;
            else throw new GenericArtifactoryException("No such package found");
        }
        PackageRevision result = new PackageRevision(getPackageLabel(), getPublishedDate(), getAuthor());
        result.addData(GenericArtifactoryPackageConfig.PACKAGE_LOCATION, getPackageLocation());
        result.addData(GenericArtifactoryPackageConfig.PACKAGE_VERSION, getPackageVersion());
        return result;
    }
 
开发者ID:varchev,项目名称:go-generic-artifactory-poller,代码行数:12,代码来源:GenericArtifactoryFeedDocument.java

示例7: 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");
    GenericArtifactoryParams params = new GenericArtifactoryParams(RepoUrl.create("http://artifactory.example.com/artifactory", null, null),
            "repo-id", "Path/To/Artifact", "Artifact", "1.0", null, null);
    assertThat(params.getQuery(),
            is("http://artifactory.example.com/artifactory/api/storage/repo-id/Path/To/Artifact"));
}
 
开发者ID:varchev,项目名称:go-generic-artifactory-poller,代码行数:10,代码来源:GenericArtifactoryParamsTest.java

示例8: shouldGetModificationsSinceAGivenRevisionAlongWithAdditionalDataFromThePackageRevision

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入方法依赖的package包/类
@Test
public void shouldGetModificationsSinceAGivenRevisionAlongWithAdditionalDataFromThePackageRevision() {
    String previousRevision = "rev-122";
    Date timestamp = new Date();
    HashMap<String, String> dataInPreviousRevision = new HashMap<>();
    dataInPreviousRevision.put("1", "one");
    PackageMaterialRevision knownRevision = new PackageMaterialRevision(previousRevision, timestamp, dataInPreviousRevision);
    ArgumentCaptor<PackageRevision> knownPackageRevision = ArgumentCaptor.forClass(PackageRevision.class);

    PackageRevision latestRevision = new PackageRevision("rev-123", timestamp, "user");
    String dataKey = "2";
    String dataValue = "two";
    latestRevision.addData(dataKey, dataValue);

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

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

    assertThat(knownPackageRevision.getValue().getRevision(), is(previousRevision));
    assertThat(knownPackageRevision.getValue().getTimestamp(), is(timestamp));
    assertThat(knownPackageRevision.getValue().getData(), is(notNullValue()));
    assertThat(knownPackageRevision.getValue().getData().size(), is(dataInPreviousRevision.size()));
    assertThat(knownPackageRevision.getValue().getData().get("1"), is(dataInPreviousRevision.get("1")));

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

    Modification firstModification = modifications.get(0);
    assertThat(firstModification.getRevision(), is("rev-123"));
    assertThat(firstModification.getModifiedTime(), is(timestamp));
    assertThat(firstModification.getUserName(), is("user"));
    assertThat(firstModification.getComment(), is(notNullValue()));
    assertThat(firstModification.getAdditionalData(), is(expectedDataString));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:36,代码来源:PackageMaterialPollerTest.java

示例9: addUserInfoToLocation

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入方法依赖的package包/类
private void addUserInfoToLocation(PackageRevision packageRevision, Credentials credentials) {
    String location = packageRevision.getDataFor(NpmPackageConfig.PACKAGE_LOCATION);
    packageRevision.addData(NpmPackageConfig.PACKAGE_LOCATION, HttpRepoURL.getUrlWithCreds(location, credentials));
}
 
开发者ID:varchev,项目名称:go-npm-poller,代码行数:5,代码来源:NpmPoller.java

示例10: toPackageRevision

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入方法依赖的package包/类
public PackageRevision toPackageRevision() {
    PackageRevision revision = new PackageRevision(version.toString(), new Date(), name.replaceAll("^(.*)/.*$", "$1"), null, getUrl().toString());
    revision.addData("LOCATION", getUrl().toString());
    revision.addData("VERSION", getVersion().toString());
    return revision;
}
 
开发者ID:drrb,项目名称:go-puppet-forge-poller,代码行数:7,代码来源:ModuleVersion.java

示例11: addUserInfoToLocation

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision; //导入方法依赖的package包/类
private void addUserInfoToLocation(PackageRevision packageRevision, Credentials credentials) {
    String location = packageRevision.getDataFor(GenericArtifactoryPackageConfig.PACKAGE_LOCATION);
    packageRevision.addData(GenericArtifactoryPackageConfig.PACKAGE_LOCATION, HttpRepoURL.getUrlWithCreds(location, credentials));
}
 
开发者ID:varchev,项目名称:go-generic-artifactory-poller,代码行数:5,代码来源:GenericArtifactoryPoller.java


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