use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl.WorkspaceImplBuilder in project che-server by eclipse-che.
the class KubernetesNamespaceFactoryTest method testEvalNamespaceUsesWorkspaceRecordedNamespaceIfWorkspaceRecordsIt.
@Test
public void testEvalNamespaceUsesWorkspaceRecordedNamespaceIfWorkspaceRecordsIt() throws Exception {
namespaceFactory = new KubernetesNamespaceFactory("che-<userid>", true, true, true, NAMESPACE_LABELS, NAMESPACE_ANNOTATIONS, emptySet(), clientFactory, cheClientFactory, userManager, preferenceManager, pool);
WorkspaceImpl workspace = new WorkspaceImplBuilder().setAttributes(ImmutableMap.of(Constants.WORKSPACE_INFRASTRUCTURE_NAMESPACE_ATTRIBUTE, "wkspcnmspc")).build();
String namespace = namespaceFactory.getNamespaceName(workspace);
assertEquals(namespace, "wkspcnmspc");
}
use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl.WorkspaceImplBuilder in project che-server by eclipse-che.
the class KubernetesNamespaceFactoryTest method testEvalNamespaceUsesNamespaceDefaultIfWorkspaceDoesntRecordNamespaceAndLegacyNamespaceDoesntExist.
@Test
public void testEvalNamespaceUsesNamespaceDefaultIfWorkspaceDoesntRecordNamespaceAndLegacyNamespaceDoesntExist() throws Exception {
namespaceFactory = new KubernetesNamespaceFactory("che-<userid>", true, true, true, NAMESPACE_LABELS, NAMESPACE_ANNOTATIONS, emptySet(), clientFactory, cheClientFactory, userManager, preferenceManager, pool);
WorkspaceImpl workspace = new WorkspaceImplBuilder().setId("workspace123").setAttributes(emptyMap()).build();
EnvironmentContext.getCurrent().setSubject(new SubjectImpl("jondoe", "123", null, false));
String namespace = namespaceFactory.getNamespaceName(workspace);
assertEquals(namespace, "che-123");
}
use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl.WorkspaceImplBuilder in project devspaces-images by redhat-developer.
the class KubernetesNamespaceFactoryTest method testEvalNamespaceUsesWorkspaceRecordedNamespaceIfWorkspaceRecordsIt.
@Test
public void testEvalNamespaceUsesWorkspaceRecordedNamespaceIfWorkspaceRecordsIt() throws Exception {
namespaceFactory = new KubernetesNamespaceFactory("che-<userid>", true, true, true, NAMESPACE_LABELS, NAMESPACE_ANNOTATIONS, emptySet(), clientFactory, cheClientFactory, userManager, preferenceManager, pool);
WorkspaceImpl workspace = new WorkspaceImplBuilder().setAttributes(ImmutableMap.of(Constants.WORKSPACE_INFRASTRUCTURE_NAMESPACE_ATTRIBUTE, "wkspcnmspc")).build();
String namespace = namespaceFactory.getNamespaceName(workspace);
assertEquals(namespace, "wkspcnmspc");
}
use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl.WorkspaceImplBuilder in project che-server by eclipse-che.
the class KubernetesNamespaceFactoryTest method testEvalNamespaceTreatsWorkspaceRecordedNamespaceLiterally.
@Test
public void testEvalNamespaceTreatsWorkspaceRecordedNamespaceLiterally() throws Exception {
namespaceFactory = new KubernetesNamespaceFactory("che-<userid>", true, true, true, NAMESPACE_LABELS, NAMESPACE_ANNOTATIONS, emptySet(), clientFactory, cheClientFactory, userManager, preferenceManager, pool);
WorkspaceImpl workspace = new WorkspaceImplBuilder().setAttributes(ImmutableMap.of(Constants.WORKSPACE_INFRASTRUCTURE_NAMESPACE_ATTRIBUTE, "ns34345")).build();
String namespace = namespaceFactory.getNamespaceName(workspace);
assertEquals(namespace, "ns34345");
}
use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl.WorkspaceImplBuilder in project devspaces-images by redhat-developer.
the class KubernetesNamespaceFactoryTest method testEvalNamespaceTreatsWorkspaceRecordedNamespaceLiterally.
@Test
public void testEvalNamespaceTreatsWorkspaceRecordedNamespaceLiterally() throws Exception {
namespaceFactory = new KubernetesNamespaceFactory("che-<userid>", true, true, true, NAMESPACE_LABELS, NAMESPACE_ANNOTATIONS, emptySet(), clientFactory, cheClientFactory, userManager, preferenceManager, pool);
WorkspaceImpl workspace = new WorkspaceImplBuilder().setAttributes(ImmutableMap.of(Constants.WORKSPACE_INFRASTRUCTURE_NAMESPACE_ATTRIBUTE, "ns34345")).build();
String namespace = namespaceFactory.getNamespaceName(workspace);
assertEquals(namespace, "ns34345");
}
Aggregations