Search in sources :

Example 21 with IBuildConfig

use of com.openshift.restclient.model.IBuildConfig in project jbosstools-openshift by jbosstools.

the class ImportApplicationWizardModel method getApplicationName.

@Override
public String getApplicationName() {
    String appName = null;
    IBuildConfig buildConfig = getSelectedBuildConfig();
    if (buildConfig != null) {
        appName = buildConfig.getName();
    }
    return appName;
}
Also used : IBuildConfig(com.openshift.restclient.model.IBuildConfig)

Example 22 with IBuildConfig

use of com.openshift.restclient.model.IBuildConfig in project jbosstools-openshift by jbosstools.

the class ProjectTreeSorterTest method mockBuildConfig.

private IBuildConfig mockBuildConfig(String name, String uri, String toString) {
    IBuildConfig config = Mockito.mock(IBuildConfig.class);
    when(config.getKind()).thenReturn(ResourceKind.BUILD_CONFIG);
    when(config.getName()).thenReturn(name);
    when(config.getSourceURI()).thenReturn(uri);
    when(config.toString()).thenReturn(toString);
    return config;
}
Also used : IBuildConfig(com.openshift.restclient.model.IBuildConfig)

Example 23 with IBuildConfig

use of com.openshift.restclient.model.IBuildConfig in project jbosstools-openshift by jbosstools.

the class OpenShiftExplorerLabelProviderTest method getStyledTextForABuildConfig.

@Test
public void getStyledTextForABuildConfig() {
    IBuildConfig buildConfig = givenAResource(IBuildConfig.class, ResourceKind.BUILD_CONFIG);
    when(buildConfig.getSourceURI()).thenReturn("git://somplace.com/foo/bar.git");
    StyledString actual = provider.getStyledText(buildConfig);
    assertEquals(buildConfig.getName() + " git://somplace.com/foo/bar.git", actual.getString());
}
Also used : IBuildConfig(com.openshift.restclient.model.IBuildConfig) StyledString(org.eclipse.jface.viewers.StyledString) Test(org.junit.Test)

Example 24 with IBuildConfig

use of com.openshift.restclient.model.IBuildConfig in project jbosstools-openshift by jbosstools.

the class ResourceDetailsContentProviderTest method shouldReturnUnknownResourcePropertyGivenBuildConfigBuildStrategyIsNull.

@Test
public void shouldReturnUnknownResourcePropertyGivenBuildConfigBuildStrategyIsNull() {
    // given
    IBuildConfig bc = ResourceMocks.createBuildConfig("42", null, null, null, null, null, null, null);
    // when
    Object[] children = contentProvider.getChildren(bc);
    // then
    ResourceProperty property = getResourceProperty(ResourceDetailsContentProvider.LABEL_STRATEGY, children);
    assertThat(property).isNotNull();
    assertThat(property.isUnknownValue()).isTrue();
}
Also used : ResourceProperty(org.jboss.tools.openshift.internal.ui.wizard.newapp.ResourceDetailsContentProvider.ResourceProperty) IBuildConfig(com.openshift.restclient.model.IBuildConfig) Test(org.junit.Test)

Example 25 with IBuildConfig

use of com.openshift.restclient.model.IBuildConfig in project jbosstools-openshift by jbosstools.

the class CreateApplicationFromImageJob method addToGeneratedResources.

@Override
protected void addToGeneratedResources(Map<String, IResource> resources, final Connection connection, final String name, final IProject project) {
    IBuildConfigBuilder builder = connection.getResourceBuilder(IBuildConfigBuilder.class);
    IBuildConfig bc = builder.named(name).inNamespace(project.getName()).fromGitSource().fromGitUrl(buildConfigModel.getGitRepositoryUrl()).usingGitReference(buildConfigModel.getGitReference()).inContextDir(buildConfigModel.getContextDir()).end().usingSourceStrategy().fromImageStreamTag(buildConfigModel.getBuilderImageName()).inNamespace(buildConfigModel.getBuilderImageNamespace()).withEnvVars(createEnvVars()).end().buildOnSourceChange(buildConfigModel.isConfigWebHook()).buildOnConfigChange(buildConfigModel.isConfigChangeTrigger()).buildOnImageChange(buildConfigModel.isImageChangeTrigger()).toImageStreamTag(new DockerImageURI(name).getNameAndTag()).build();
    resources.put(ResourceKind.BUILD_CONFIG, bc);
}
Also used : DockerImageURI(com.openshift.restclient.images.DockerImageURI) IBuildConfig(com.openshift.restclient.model.IBuildConfig) IBuildConfigBuilder(com.openshift.restclient.model.build.IBuildConfigBuilder)

Aggregations

IBuildConfig (com.openshift.restclient.model.IBuildConfig)29 Test (org.junit.Test)12 IService (com.openshift.restclient.model.IService)5 IResource (com.openshift.restclient.model.IResource)4 Collection (java.util.Collection)4 DockerImageURI (com.openshift.restclient.images.DockerImageURI)3 IProject (com.openshift.restclient.model.IProject)3 ISourceBuildStrategy (com.openshift.restclient.model.build.ISourceBuildStrategy)3 IRoute (com.openshift.restclient.model.route.IRoute)3 ResourceKind (com.openshift.restclient.ResourceKind)2 IDeploymentConfig (com.openshift.restclient.model.IDeploymentConfig)2 IBuildStrategy (com.openshift.restclient.model.build.IBuildStrategy)2 ICustomBuildStrategy (com.openshift.restclient.model.build.ICustomBuildStrategy)2 IDockerBuildStrategy (com.openshift.restclient.model.build.IDockerBuildStrategy)2 IWebhookTrigger (com.openshift.restclient.model.build.IWebhookTrigger)2 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 IStatus (org.eclipse.core.runtime.IStatus)2