use of org.eclipse.che.workspace.infrastructure.kubernetes.api.shared.dto.KubernetesNamespaceMetaDto in project che-server by eclipse-che.
the class KubernetesNamespaceServiceTest method shouldReturnNamespaces.
@Test
public void shouldReturnNamespaces() throws Exception {
KubernetesNamespaceMetaImpl namespaceMeta = new KubernetesNamespaceMetaImpl("ws-namespace", ImmutableMap.of("phase", "active", "default", "true"));
when(namespaceFactory.list()).thenReturn(singletonList(namespaceMeta));
final Response response = given().auth().basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD).when().get(SECURE_PATH + "/kubernetes/namespace");
assertEquals(response.getStatusCode(), 200);
List<KubernetesNamespaceMetaDto> namespaces = unwrapDtoList(response, KubernetesNamespaceMetaDto.class);
assertEquals(namespaces.size(), 1);
assertEquals(new KubernetesNamespaceMetaImpl(namespaces.get(0)), namespaceMeta);
verify(namespaceFactory).list();
}
use of org.eclipse.che.workspace.infrastructure.kubernetes.api.shared.dto.KubernetesNamespaceMetaDto in project che-server by eclipse-che.
the class KubernetesNamespaceServiceTest method shouldProvisionNamespace.
@Test
public void shouldProvisionNamespace() throws Exception {
// given
KubernetesNamespaceMetaImpl namespaceMeta = new KubernetesNamespaceMetaImpl("ws-namespace", ImmutableMap.of("phase", "active", "default", "true"));
when(namespaceProvisioner.provision(any(NamespaceResolutionContext.class))).thenReturn(namespaceMeta);
// when
final Response response = given().auth().basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD).when().post(SECURE_PATH + "/kubernetes/namespace/provision");
// then
assertEquals(response.getStatusCode(), 200);
KubernetesNamespaceMetaDto actual = unwrapDto(response, KubernetesNamespaceMetaDto.class);
assertEquals(actual.getName(), namespaceMeta.getName());
assertEquals(actual.getAttributes(), namespaceMeta.getAttributes());
verify(namespaceProvisioner).provision(any(NamespaceResolutionContext.class));
}
use of org.eclipse.che.workspace.infrastructure.kubernetes.api.shared.dto.KubernetesNamespaceMetaDto in project devspaces-images by redhat-developer.
the class KubernetesNamespaceServiceTest method shouldReturnNamespaces.
@Test
public void shouldReturnNamespaces() throws Exception {
KubernetesNamespaceMetaImpl namespaceMeta = new KubernetesNamespaceMetaImpl("ws-namespace", ImmutableMap.of("phase", "active", "default", "true"));
when(namespaceFactory.list()).thenReturn(singletonList(namespaceMeta));
final Response response = given().auth().basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD).when().get(SECURE_PATH + "/kubernetes/namespace");
assertEquals(response.getStatusCode(), 200);
List<KubernetesNamespaceMetaDto> namespaces = unwrapDtoList(response, KubernetesNamespaceMetaDto.class);
assertEquals(namespaces.size(), 1);
assertEquals(new KubernetesNamespaceMetaImpl(namespaces.get(0)), namespaceMeta);
verify(namespaceFactory).list();
}
use of org.eclipse.che.workspace.infrastructure.kubernetes.api.shared.dto.KubernetesNamespaceMetaDto in project devspaces-images by redhat-developer.
the class KubernetesNamespaceServiceTest method shouldProvisionNamespace.
@Test
public void shouldProvisionNamespace() throws Exception {
// given
KubernetesNamespaceMetaImpl namespaceMeta = new KubernetesNamespaceMetaImpl("ws-namespace", ImmutableMap.of("phase", "active", "default", "true"));
when(namespaceProvisioner.provision(any(NamespaceResolutionContext.class))).thenReturn(namespaceMeta);
// when
final Response response = given().auth().basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD).when().post(SECURE_PATH + "/kubernetes/namespace/provision");
// then
assertEquals(response.getStatusCode(), 200);
KubernetesNamespaceMetaDto actual = unwrapDto(response, KubernetesNamespaceMetaDto.class);
assertEquals(actual.getName(), namespaceMeta.getName());
assertEquals(actual.getAttributes(), namespaceMeta.getAttributes());
verify(namespaceProvisioner).provision(any(NamespaceResolutionContext.class));
}
Aggregations