本文整理汇总了Java中jetbrains.buildServer.util.CollectionsUtil类的典型用法代码示例。如果您正苦于以下问题:Java CollectionsUtil类的具体用法?Java CollectionsUtil怎么用?Java CollectionsUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CollectionsUtil类属于jetbrains.buildServer.util包,在下文中一共展示了CollectionsUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testComplexValueParameterCallVaultAPIOnlyOnce
import jetbrains.buildServer.util.CollectionsUtil; //导入依赖的package包/类
@Test
public void testComplexValueParameterCallVaultAPIOnlyOnce() throws Exception {
final String path = "secret/test-read-once";
template.write(path, CollectionsUtil.asMap("first", "TestValueA", "second", "TestValueB"));
final List<VaultParameter> parameters = Arrays.asList(
VaultParameter.extract("/" + path + "!/first"),
VaultParameter.extract("/" + path + "!/second")
);
myRequestedURIs.clear();
final Map<String, String> replacements = resolver.doFetchAndPrepareReplacements(template, parameters, new NullBuildProgressLogger());
then(replacements).hasSize(2).contains(entry("/" + path + "!/first", "TestValueA"), entry("/" + path + "!/second", "TestValueB"));
then(myRequestedURIs).hasSize(1).containsOnlyOnce("/v1/" + path);
}
示例2: setUp
import jetbrains.buildServer.util.CollectionsUtil; //导入依赖的package包/类
@BeforeMethod
@Override
protected void setUp() throws Exception {
super.setUp();
// setPartialMessagesChecker();
new TeamCityProperties() {{
setModel(new BasePropertiesModel() {
@NotNull
@Override
public Map<String, String> getUserDefinedProperties() {
return CollectionsUtil.asMap("teamcity.agent.build.messages.translators.enabled", "true");
}
});
}};
myEventDispatcher = EventDispatcher.create(AgentLifeCycleListener.class);
myCurrentBuildTracker = new CurrentBuildTrackerImpl(myEventDispatcher);
myTranslatorsRegistry = new TranslatorsRegistryImpl();
myParserLoader = new ParserLoaderImpl(myCurrentBuildTracker);
myParsersRegistry = new ParsersRegistryImpl(myTranslatorsRegistry, myParserLoader);
}
示例3: testComplexValueParameterResolvedFromVault
import jetbrains.buildServer.util.CollectionsUtil; //导入依赖的package包/类
@Test
public void testComplexValueParameterResolvedFromVault() throws Exception {
final String path = "secret/test-complex";
template.write(path, CollectionsUtil.asMap("first", "TestValueA", "second", "TestValueB"));
final List<VaultParameter> parameters = Arrays.asList(
new VaultParameter("/" + path, "first"),
new VaultParameter("/" + path, "second")
);
final Map<String, String> replacements = resolver.doFetchAndPrepareReplacements(feature, vault.getToken(), parameters, new NullBuildProgressLogger());
then(replacements).hasSize(2).contains(entry("/" + path + "!/first", "TestValueA"), entry("/" + path + "!/second", "TestValueB"));
}
示例4: doTestWrapperTokenCreated
import jetbrains.buildServer.util.CollectionsUtil; //导入依赖的package包/类
private void doTestWrapperTokenCreated(String authMountPath) {
final ClientHttpRequestFactory factory = createClientHttpRequestFactory();
final VaultTemplate template = new VaultTemplate(getVault().getEndpoint(), factory, () -> VaultToken.of(getVault().getToken()));
// Ensure approle auth enabled
template.opsForSys().authMount(authMountPath, VaultMount.create("approle"));
then(template.opsForSys().getAuthMounts()).containsKey(authMountPath + "/");
template.write("auth/" + authMountPath + "/role/testrole", CollectionsUtil.asMap(
"secret_id_ttl", "10m",
"token_num_uses", "10",
"token_ttl", "20m",
"token_max_ttl", "30m",
"secret_id_num_uses", "40"
));
Pair<String, String> credentials = getAppRoleCredentials(template, "auth/" + authMountPath + "/role/testrole");
final Pair<String, String> wrapped = VaultConnector.doRequestWrappedToken(new VaultFeatureSettings(getVault().getUrl(), authMountPath, credentials.getFirst(), credentials.getSecond()));
then(wrapped.getFirst()).isNotNull();
then(wrapped.getSecond()).isNotNull();
final CubbyholeAuthenticationOptions options = CubbyholeAuthenticationOptions.builder()
.wrapped()
.initialToken(VaultToken.of(wrapped.getFirst()))
.build();
final RestTemplate simpleTemplate = UtilKt.createRestTemplate(new VaultFeatureSettings(getVault().getUrl(), authMountPath, "", ""));
final CubbyholeAuthentication authentication = new CubbyholeAuthentication(options, simpleTemplate);
final TaskScheduler scheduler = new ConcurrentTaskScheduler();
final MyLifecycleAwareSessionManager sessionManager = new MyLifecycleAwareSessionManager(authentication, simpleTemplate, scheduler);
then(sessionManager.getSessionToken()).isNotNull();
sessionManager.renewToken();
then(sessionManager.getSessionToken()).isNotNull();
}
示例5: createDummyParameters
import jetbrains.buildServer.util.CollectionsUtil; //导入依赖的package包/类
private Map<String, String> createDummyParameters(@Nullable final PowerShellBitness bit) {
final Map<String, String> result = CollectionsUtil.asMap(
PowerShellConstants.RUNNER_EXECUTION_MODE, PowerShellExecutionMode.STDIN.getValue(),
PowerShellConstants.RUNNER_SCRIPT_MODE, PowerShellScriptMode.CODE.getValue(),
PowerShellConstants.RUNNER_SCRIPT_CODE, "echo works"
);
if (bit != null) {
result.put(PowerShellConstants.RUNNER_BITNESS, bit.getValue());
}
return result;
}
示例6: discoverRunnersInDirectory
import jetbrains.buildServer.util.CollectionsUtil; //导入依赖的package包/类
@Override
protected @NotNull List<DiscoveredObject> discoverRunnersInDirectory(final @NotNull Element element, final @NotNull List<Element> filesList) {
final List<DiscoveredObject> discovered = new ArrayList<>();
for (final Element file: filesList){
if (file.getName().equalsIgnoreCase(CONFIGURESCR_NAME + ".ac") || file.getName().equalsIgnoreCase(CONFIGURESCR_NAME + ".in")
|| file.getName().equalsIgnoreCase(CONFIGURESCR_NAME)){
discovered.add(new DiscoveredObject(AutotoolsBuildConstants.TYPE, CollectionsUtil.asMap(AutotoolsBuildConstants.UI_SOURCE_PATH, element.getFullName())));
}
}
return discovered;
}
示例7: createNewClient
import jetbrains.buildServer.util.CollectionsUtil; //导入依赖的package包/类
@NotNull
@Override
public CloudClientEx createNewClient(@NotNull CloudState cloudState, @NotNull CloudClientParameters cloudClientParameters) {
try {
final KubeCloudClientParametersImpl kubeClientParams = KubeCloudClientParametersImpl.create(cloudClientParameters);
final KubeApiConnector apiConnector = KubeApiConnectorImpl.create(kubeClientParams, myAuthStrategies.get(kubeClientParams.getAuthStrategy()));
List<KubeCloudImage> images = CollectionsUtil.convertCollection(kubeClientParams.getImages(), kubeCloudImageData -> {
KubeCloudImageImpl kubeCloudImage = new KubeCloudImageImpl(kubeCloudImageData, apiConnector, myCache);
kubeCloudImage.populateInstances();
return kubeCloudImage;
});
return new KubeCloudClient(
myServerSettings.getServerUUID(),
cloudState.getProfileId(),
apiConnector,
images,
kubeClientParams,
myPodTemplateProviders,
myCache,
myUpdater);
} catch (Throwable ex){
if(ex instanceof KubernetesClientException){
final Throwable cause = ex.getCause();
if(cause != null) throw new CloudException(cause.getMessage(), cause);
else throw ex;
} else throw ex;
}
}
示例8: testGetPodTemplate
import jetbrains.buildServer.util.CollectionsUtil; //导入依赖的package包/类
@Test
public void testGetPodTemplate() throws Exception {
CloudInstanceUserData instanceTag = createInstanceTag();
KubeCloudClientParameters clientParams = m.mock(KubeCloudClientParameters.class);
KubeCloudImage image = m.mock(KubeCloudImage.class);
Deployment deployment = new DeploymentBuilder()
.withMetadata(new ObjectMetaBuilder()
.withLabels(CollectionsUtil.asMap("app", "nginx"))
.build())
.withSpec(new DeploymentSpecBuilder()
.withTemplate(new PodTemplateSpecBuilder()
.withMetadata(new ObjectMeta())
.withSpec(new PodSpecBuilder()
.withContainers(new ContainerBuilder()
.withName("nginx")
.withImage("nginx:1.7.9")
.withPorts(new ContainerPortBuilder()
.withHostPort(80)
.build())
.build())
.build())
.build())
.build())
.build();
m.checking(new Expectations(){{
allowing(clientParams).getNamespace(); will(returnValue("custom namespace"));
allowing(clientParams).getAuthStrategy(); will(returnValue(UnauthorizedAccessStrategy.ID));
allowing(image).getId(); will(returnValue("my image id"));
allowing(image).getName(); will(returnValue("my image name"));
allowing(image).getSourceDeploymentName(); will(returnValue("deploymentFoo"));
allowing(image).getAgentName(with("agent name")); will(returnValue("prefix agent name"));
allowing(myDeploymentContentProvider).findDeployment(with(any(String.class)), with(any(KubeCloudClientParameters.class))); will(returnValue(deployment));
}});
Pod podTemplate = myPodTemplateProvider.getPodTemplate(instanceTag, image, clientParams);
assertNotNull(podTemplate);
assertNotNull(podTemplate.getMetadata());
assertNotNull(podTemplate.getSpec());
}
开发者ID:JetBrains,项目名称:teamcity-kubernetes-plugin,代码行数:39,代码来源:DeploymentBuildAgentPodTemplateProviderTest.java
示例9: testShouldNotsetContainerName
import jetbrains.buildServer.util.CollectionsUtil; //导入依赖的package包/类
@Test
public void testShouldNotsetContainerName(){
CloudInstanceUserData instanceTag = createInstanceTag();
KubeCloudClientParameters clientParams = m.mock(KubeCloudClientParameters.class);
KubeCloudImage image = m.mock(KubeCloudImage.class);
Deployment deployment = new DeploymentBuilder()
.withMetadata(new ObjectMetaBuilder()
.withLabels(CollectionsUtil.asMap("app", "nginx"))
.build())
.withSpec(new DeploymentSpecBuilder()
.withTemplate(new PodTemplateSpecBuilder()
.withMetadata(new ObjectMeta())
.withSpec(new PodSpecBuilder()
.withContainers(new ContainerBuilder()
.withName("nginx")
.withImage("nginx:1.7.9")
.withPorts(new ContainerPortBuilder()
.withHostPort(80)
.build())
.build())
.build())
.build())
.build())
.build();
m.checking(new Expectations(){{
allowing(clientParams).getNamespace(); will(returnValue("custom namespace"));
allowing(image).getId(); will(returnValue("my image id"));
allowing(image).getName(); will(returnValue("my image name"));
allowing(image).getSourceDeploymentName(); will(returnValue("deploymentFoo"));
allowing(image).getAgentName(with("agent name")); will(returnValue("prefix agent name"));
allowing(myDeploymentContentProvider).findDeployment(with(any(String.class)), with(any(KubeCloudClientParameters.class))); will(returnValue(deployment));
}});
Pod podTemplate = myPodTemplateProvider.getPodTemplate(instanceTag, image, clientParams);
for(Container container : podTemplate.getSpec().getContainers()){
assertNotSame(container.getName(), "agent name");
}
}
开发者ID:JetBrains,项目名称:teamcity-kubernetes-plugin,代码行数:38,代码来源:DeploymentBuildAgentPodTemplateProviderTest.java
示例10: filterPaths
import jetbrains.buildServer.util.CollectionsUtil; //导入依赖的package包/类
@NotNull
public List<String> filterPaths(@NotNull List<String> paths) {
if (isIncludeAll()) return paths;
final Collection<PathNode> files = AntPatternTreeMatcher.scan(createPathTree(paths), myIncludePatterns, myExcludePatterns, AntPatternTreeMatcher.ScanOption.LEAFS_ONLY);
return CollectionsUtil.convertCollection(files, PathNode::getPath);
}
示例11: getTriggerPropertiesProcessor
import jetbrains.buildServer.util.CollectionsUtil; //导入依赖的package包/类
@NotNull
@Override
public PropertiesProcessor getTriggerPropertiesProcessor() {
return new PropertiesProcessor() {
@Override
public Collection<InvalidProperty> process(Map<String, String> properties) {
return CollectionsUtil.convertCollection(ParametersValidator.validateSettings(properties, false).entrySet(), new Converter<InvalidProperty, Map.Entry<String, String>>() {
@Override
public InvalidProperty createFrom(@NotNull Map.Entry<String, String> source) {
return new InvalidProperty(source.getKey(), source.getValue());
}
});
}
};
}
开发者ID:JetBrains,项目名称:teamcity-aws-codepipeline-plugin,代码行数:16,代码来源:CodePipelineBuildTriggerService.java
示例12: getActionTypeVersion
import jetbrains.buildServer.util.CollectionsUtil; //导入依赖的package包/类
@NotNull
private String getActionTypeVersion(@NotNull AWSCodePipelineClient codePipelineClient) {
final ActionType teamCityActionType = CollectionsUtil.findFirst(codePipelineClient.listActionTypes(new ListActionTypesRequest().withActionOwnerFilter(ActionOwner.Custom)).getActionTypes(), new Filter<ActionType>() {
@Override
public boolean accept(@NotNull ActionType data) {
return TEAMCITY_ACTION_PROVIDER.equals(data.getId().getProvider());
}
});
if (teamCityActionType == null) {
throw new BuildTriggerException("No registered " + TEAMCITY_ACTION_PROVIDER + " action type found in the AWS account");
}
return teamCityActionType.getId().getVersion();
}
开发者ID:JetBrains,项目名称:teamcity-aws-codepipeline-plugin,代码行数:14,代码来源:CodePipelineAsyncPolledBuildTrigger.java
示例13: getReferencedSourceFiles
import jetbrains.buildServer.util.CollectionsUtil; //导入依赖的package包/类
public Collection<File> getReferencedSourceFiles(File symbolsFile) {
final GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.setExePath(mySrcToolPath.getPath());
commandLine.addParameter(symbolsFile.getAbsolutePath());
commandLine.addParameter(DUMP_SOURCES_FROM_PDB_SWITCH);
final ExecResult execResult = SimpleCommandLineProcessRunner.runCommand(commandLine, null);
return CollectionsUtil.convertAndFilterNulls(Arrays.asList(execResult.getOutLines()), new Converter<File, String>() {
public File createFrom(@NotNull String source) {
final File file = new File(source);
if (file.isFile()) return file;
return null; //last string is not a source file path
}
});
}
示例14: isPathToArchive
import jetbrains.buildServer.util.CollectionsUtil; //导入依赖的package包/类
private boolean isPathToArchive(@NotNull final String path){
return CollectionsUtil.contains(myExtensions.getExtensions(ArchivePreprocessor.class), new Filter<ArchivePreprocessor>() {
@Override
public boolean accept(@NotNull ArchivePreprocessor data) {
return data.shouldProcess(path);
}
});
}
示例15: getDefaultRunnerProperties
import jetbrains.buildServer.util.CollectionsUtil; //导入依赖的package包/类
@Nullable
@Override
public Map<String, String> getDefaultRunnerProperties() {
return CollectionsUtil.asMap(
DotTraceBean.Shared.getMeasureTypeKey(), DotTraceBean.Shared.getMeasureTypes()[0].getValue(),
DotTraceBean.Shared.getProfileChildProcessesKey(), PROFILE_CHILD_PROCESSES_DEFAULT_VAL);
}