Search in sources :

Example 6 with WorkspaceImplBuilder

use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl.WorkspaceImplBuilder in project devspaces-images by redhat-developer.

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");
}
Also used : WorkspaceImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl) WorkspaceImplBuilder(org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl.WorkspaceImplBuilder) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) SubjectImpl(org.eclipse.che.commons.subject.SubjectImpl) Test(org.testng.annotations.Test)

Aggregations

WorkspaceImpl (org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl)6 WorkspaceImplBuilder (org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl.WorkspaceImplBuilder)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)6 Test (org.testng.annotations.Test)6 SubjectImpl (org.eclipse.che.commons.subject.SubjectImpl)2