use of com.openshift.restclient.model.IBuildConfig in project jbosstools-openshift by jbosstools.
the class ImportApplicationWizardModelTest method shouldReturnNullWhenCallingGetSelectedBuildConfigIfNoBuildConfigIsSelected.
@Test
public void shouldReturnNullWhenCallingGetSelectedBuildConfigIfNoBuildConfigIsSelected() {
// given
model.setSelectedItem(p2);
// when
IBuildConfig bc = model.getSelectedBuildConfig();
// then
assertThat(bc).isNull();
}
use of com.openshift.restclient.model.IBuildConfig in project jbosstools-openshift by jbosstools.
the class ServiceResourceMapper method getRelatedBuilds.
private static Collection<IBuild> getRelatedBuilds(Collection<IResource> resources, Collection<String> dcImageRefs, Collection<IBuildConfig> buildConfigs) {
Collection<IBuild> result = new HashSet<>();
Collection<String> bcNames = buildConfigs.stream().map(bc -> bc.getName()).collect(Collectors.toSet());
resources.forEach(r -> {
if (r instanceof IBuild) {
IBuild build = (IBuild) r;
if (bcNames.contains(r.getLabels().get(OpenShiftAPIAnnotations.BUILD_CONFIG_NAME)) || dcImageRefs.contains(imageRef(build))) {
result.add((IBuild) r);
}
}
});
return result;
}
use of com.openshift.restclient.model.IBuildConfig in project jbosstools-openshift by jbosstools.
the class ImportApplicationWizardModelTest method shouldReturnSelectedBuildConfig.
@Test
public void shouldReturnSelectedBuildConfig() {
// given
model.setSelectedItem(p2_bc1);
// when
IBuildConfig bc = model.getSelectedBuildConfig();
// then
assertThat(bc).isEqualTo(p2_bc1);
}
use of com.openshift.restclient.model.IBuildConfig in project jbosstools-openshift by jbosstools.
the class ImportApplicationWizardModel method update.
private void update(Connection connection, Object selectedItem, String cloneDestination, boolean useDefaultCloneDestination, IProject project, boolean reuseGitRepo, boolean checkoutBranchReusedRepo, String gitContextDir) {
this.connectionItem = updateConnection(connection);
this.project = project;
Object oldSelectedItem = this.selectedItem;
updateSelectedItem(selectedItem);
updateUseDefaultCloneDestination(useDefaultCloneDestination);
updateCloneDestination(cloneDestination);
IBuildConfig buildConfig = getBuildConfig(selectedItem);
String repoName = updateRepoName(buildConfig);
String oldRepoPath = this.repoPath;
String newRepoPath = updateRepoPath(cloneDestination, repoName);
reuseGitRepo = updateReuseGitRepo(reuseGitRepo, newRepoPath, oldRepoPath);
String gitRef = updateGitRef(getGitRef(buildConfig));
Repository repository = updateRepository(newRepoPath, oldRepoPath);
boolean isRepositoryAtGitRef = updateIsRepositoryAtGitRef(gitRef, repository);
updateCheckoutBranchReusedRepo(checkoutBranchReusedRepo, isRepositoryAtGitRef);
updateGitContextDir(gitContextDir, buildConfig, getBuildConfig(oldSelectedItem));
}
use of com.openshift.restclient.model.IBuildConfig in project jbosstools-openshift by jbosstools.
the class ResourceDetailsLabelProviderTest method getStyledTextForResourceWithoutParams.
@Test
public void getStyledTextForResourceWithoutParams() {
IBuildConfig buildConfig = mock(IBuildConfig.class);
when(buildConfig.getKind()).thenReturn(ResourceKind.BUILD_CONFIG);
when(buildConfig.getName()).thenReturn("build-config-name");
assertEquals(ResourceKind.BUILD_CONFIG + " build-config-name", labelsProvider.getStyledText(buildConfig).toString());
}
Aggregations