Search in sources :

Example 11 with IBuildConfig

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

the class ResourceDetailsLabelProviderTest method getStyledTextForResourceWithParams.

@Test
public void getStyledTextForResourceWithParams() {
    IBuildConfig buildConfig = mock(IBuildConfig.class);
    when(buildConfig.getKind()).thenReturn(ResourceKind.BUILD_CONFIG);
    when(buildConfig.getName()).thenReturn("named by ${name} ${surname}");
    assertEquals(ResourceKind.BUILD_CONFIG + " named by Dmitrii Bocharov", labelsProvider.getStyledText(buildConfig).toString());
}
Also used : IBuildConfig(com.openshift.restclient.model.IBuildConfig) Test(org.junit.Test)

Example 12 with IBuildConfig

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

the class ServerSettingsWizardPageModelTest method testGetEapOpenshiftProfile.

@Test
public void testGetEapOpenshiftProfile() {
    DockerImageURI image = mock(DockerImageURI.class);
    when(image.getName()).thenReturn("super-puper-eap-name");
    ISourceBuildStrategy buildStrategy = mock(ISourceBuildStrategy.class);
    when(buildStrategy.getImage()).thenReturn(image);
    IBuildConfig buildConfig = (IBuildConfig) connection.getResources(ResourceKind.BUILD_CONFIG, ResourceMocks.PROJECT2.getName()).get(1);
    when(buildConfig.getBuildStrategy()).thenReturn(buildStrategy);
    assertEquals("openshift3.eap", this.model.getProfileId());
}
Also used : ISourceBuildStrategy(com.openshift.restclient.model.build.ISourceBuildStrategy) DockerImageURI(com.openshift.restclient.images.DockerImageURI) IBuildConfig(com.openshift.restclient.model.IBuildConfig) Test(org.junit.Test)

Example 13 with IBuildConfig

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

the class WebhookUtilTest method testEmptyWebHooks.

@Test
public void testEmptyWebHooks() {
    IBuildConfig buildConfig = givenBuildConfigWithTriggers();
    List<IWebhookTrigger> webHooks = WebhookUtil.getWebHooks(buildConfig);
    assertNotNull(webHooks);
    assertEquals(0, webHooks.size());
}
Also used : IWebhookTrigger(com.openshift.restclient.model.build.IWebhookTrigger) IBuildConfig(com.openshift.restclient.model.IBuildConfig) Test(org.junit.Test)

Example 14 with IBuildConfig

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

the class WebhookUtilTest method testGetWebHooks.

@Test
public void testGetWebHooks() {
    IBuildConfig buildConfig = givenBuildConfigWithTriggers(genericTrigger(), imageChangeTrigger(), githubTrigger());
    List<IWebhookTrigger> webHooks = WebhookUtil.getWebHooks(buildConfig);
    assertEquals(2, webHooks.size());
    assertNotNull(webHooks);
    assertEquals(BuildTriggerType.GENERIC, webHooks.get(0).getType());
    assertEquals(BuildTriggerType.GITHUB, webHooks.get(1).getType());
}
Also used : IWebhookTrigger(com.openshift.restclient.model.build.IWebhookTrigger) IBuildConfig(com.openshift.restclient.model.IBuildConfig) Test(org.junit.Test)

Example 15 with IBuildConfig

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

the class OpenshiftEapProfileDetector method getBuildConfig.

private IBuildConfig getBuildConfig(IConnection connection, IResource resource) {
    if (resource == null || resource.getProject() == null || !(connection instanceof Connection)) {
        return null;
    }
    Connection connectionInstance = (Connection) connection;
    List<IBuildConfig> buildConfigs = connectionInstance.getResources(ResourceKind.BUILD_CONFIG, resource.getProject().getName());
    if (buildConfigs == null) {
        return null;
    }
    return ResourceUtils.getBuildConfigFor(resource, buildConfigs);
}
Also used : IBuildConfig(com.openshift.restclient.model.IBuildConfig) Connection(org.jboss.tools.openshift.core.connection.Connection) IConnection(org.jboss.tools.openshift.common.core.connection.IConnection)

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