use of com.openshift.restclient.model.IDeploymentConfig in project jbosstools-openshift by jbosstools.
the class ResourceUtilsTest method shouldReturnNullGivenNoDCNameSelectorNorRCisFoundForService.
@Test
public void shouldReturnNullGivenNoDCNameSelectorNorRCisFoundForService() throws CoreException {
// given
Connection connection = ResourceMocks.create3ProjectsConnection();
IService service = ResourceMocks.PROJECT2_SERVICES[0];
// when
IDeploymentConfig dc = ResourceUtils.getDeploymentConfigFor(service, connection);
// then
assertThat(dc).isNull();
}
use of com.openshift.restclient.model.IDeploymentConfig in project jbosstools-openshift by jbosstools.
the class ResourceUtilsTest method shouldReturnDeploymentConfigForServiceByNameGivenServiceHasDCNameSelector.
@Test
public void shouldReturnDeploymentConfigForServiceByNameGivenServiceHasDCNameSelector() throws CoreException {
// given
Connection connection = ResourceMocks.create3ProjectsConnection();
IService service = ResourceMocks.PROJECT2_SERVICES[1];
// when
IDeploymentConfig dc = ResourceUtils.getDeploymentConfigFor(service, connection);
// then
assertThat(dc).isEqualTo(ResourceMocks.PROJECT2_DEPLOYMENTCONFIGS[2]);
}
use of com.openshift.restclient.model.IDeploymentConfig in project jbosstools-openshift by jbosstools.
the class DeployImageJobTest method shouldNotUpdateIfNoImageChangeTrigger.
@Test
public void shouldNotUpdateIfNoImageChangeTrigger() {
givenAConnection();
givenTheImageStreamExistsTo("myimagename");
IDeploymentConfig dc = createResource(IDeploymentConfig.class, ResourceKind.DEPLOYMENT_CONFIG);
when(dc.getTriggers()).thenReturn(Collections.EMPTY_LIST);
when(connection.getResource(ResourceKind.DEPLOYMENT_CONFIG, project.getName(), parameters.getResourceName())).thenReturn(dc);
assertFalse(job.updateTriggerIfUpdate(connection, project.getName(), parameters.getResourceName()));
}
use of com.openshift.restclient.model.IDeploymentConfig in project jbosstools-openshift by jbosstools.
the class OpenShiftExplorerLabelProviderTest method getStyledTextForADeploymentConfig.
@Test
public void getStyledTextForADeploymentConfig() {
IDeploymentConfig config = givenAResource(IDeploymentConfig.class, ResourceKind.DEPLOYMENT_CONFIG);
Map<String, String> selector = new HashMap<>();
selector.put("name", "foo");
selector.put("deployment", "bar");
when(config.getReplicaSelector()).thenReturn(selector);
assertEquals(config.getName() + " selector: deployment=bar,name=foo", provider.getStyledText(config).getString());
}
use of com.openshift.restclient.model.IDeploymentConfig in project jbosstools-openshift by jbosstools.
the class ServerResourceViewModelWithDeploymentConfigTest method shouldReturnNewSelectedDeploymentConfigIfLoadResourcesWithConnection.
@Test
public void shouldReturnNewSelectedDeploymentConfigIfLoadResourcesWithConnection() {
// given
IResource selectedDeploymentConfig = model.getResource();
Connection connection = ResourceMocks.createConnection("https://localhost:8181", "ops@42.org");
ConnectionsRegistrySingleton.getInstance().add(connection);
try {
IProject project = ResourceMocks.createResource(IProject.class, ResourceKind.PROJECT);
when(connection.getResources(ResourceKind.PROJECT)).thenReturn(Collections.singletonList(project));
IDeploymentConfig deploymentConfig = ResourceMocks.createResource(IDeploymentConfig.class, ResourceKind.DEPLOYMENT_CONFIG);
when(project.getResources(ResourceKind.DEPLOYMENT_CONFIG)).thenReturn(Collections.singletonList(deploymentConfig));
// when
model.loadResources(connection);
// then
IResource newSelectedDeploymentConfig = model.getResource();
assertThat(selectedDeploymentConfig).isNotEqualTo(newSelectedDeploymentConfig);
} finally {
ConnectionsRegistrySingleton.getInstance().remove(connection);
}
}
Aggregations