Search in sources :

Example 11 with NamespaceResolutionContext

use of org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext in project che-server by eclipse-che.

the class UserPermissionConfiguratorTest method setUp.

@BeforeMethod
public void setUp() throws InfrastructureException {
    configurator = new UserPermissionConfigurator(TEST_CLUSTER_ROLES, clientFactory);
    serverMock = new KubernetesServer(true, true);
    serverMock.before();
    client = spy(serverMock.getClient());
    lenient().when(clientFactory.create()).thenReturn(client);
    namespaceResolutionContext = new NamespaceResolutionContext(TEST_WORKSPACE_ID, TEST_USER_ID, TEST_USERNAME);
}
Also used : NamespaceResolutionContext(org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext) KubernetesServer(io.fabric8.kubernetes.client.server.mock.KubernetesServer) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 12 with NamespaceResolutionContext

use of org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext in project che-server by eclipse-che.

the class UserProfileConfiguratorTest method setUp.

@BeforeMethod
public void setUp() throws InfrastructureException, NotFoundException, ServerException {
    context = new NamespaceResolutionContext(null, USER_ID, USER_NAME);
    kubernetesServer = new KubernetesServer(true, true);
    kubernetesServer.before();
    when(userManager.getById(USER_ID)).thenReturn(new UserImpl(USER_ID, USER_EMAIL, USER_NAME));
    when(clientFactory.create()).thenReturn(kubernetesServer.getClient());
}
Also used : NamespaceResolutionContext(org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext) UserImpl(org.eclipse.che.api.user.server.model.impl.UserImpl) KubernetesServer(io.fabric8.kubernetes.client.server.mock.KubernetesServer) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 13 with NamespaceResolutionContext

use of org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext in project devspaces-images by redhat-developer.

the class PreferencesConfigMapConfiguratorTest method setUp.

@BeforeMethod
public void setUp() throws InfrastructureException {
    configurator = new PreferencesConfigMapConfigurator(clientFactory);
    serverMock = new KubernetesServer(true, true);
    serverMock.before();
    KubernetesClient client = spy(serverMock.getClient());
    when(clientFactory.create()).thenReturn(client);
    namespaceResolutionContext = new NamespaceResolutionContext(TEST_WORKSPACE_ID, TEST_USER_ID, TEST_USERNAME);
}
Also used : NamespaceResolutionContext(org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext) KubernetesClient(io.fabric8.kubernetes.client.KubernetesClient) KubernetesServer(io.fabric8.kubernetes.client.server.mock.KubernetesServer) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 14 with NamespaceResolutionContext

use of org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext in project devspaces-images by redhat-developer.

the class SshKeysConfiguratorTest method setUp.

@BeforeMethod
public void setUp() throws InfrastructureException, NotFoundException, ServerException {
    context = new NamespaceResolutionContext(null, USER_ID, USER_NAME);
    kubernetesServer = new KubernetesServer(true, true);
    kubernetesServer.before();
    when(sshManager.getPairs(USER_ID, "vcs")).thenReturn(Collections.singletonList(sshPair));
    when(clientFactory.create()).thenReturn(kubernetesServer.getClient());
}
Also used : NamespaceResolutionContext(org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext) KubernetesServer(io.fabric8.kubernetes.client.server.mock.KubernetesServer) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 15 with NamespaceResolutionContext

use of org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext in project devspaces-images by redhat-developer.

the class UserPreferencesConfiguratorTest method setUp.

@BeforeMethod
public void setUp() throws InfrastructureException, NotFoundException, ServerException {
    context = new NamespaceResolutionContext(null, USER_ID, USER_NAME);
    kubernetesServer = new KubernetesServer(true, true);
    kubernetesServer.before();
    Map<String, String> preferences = new HashMap<>();
    preferences.put("preference-name", "preference");
    lenient().when(userManager.getById(USER_ID)).thenReturn(new UserImpl(USER_ID, USER_EMAIL, USER_NAME));
    lenient().when(namespaceFactory.evaluateNamespaceName(any())).thenReturn(USER_NAMESPACE);
    lenient().when(clientFactory.create()).thenReturn(kubernetesServer.getClient());
    lenient().when(preferenceManager.find(USER_ID)).thenReturn(preferences);
}
Also used : NamespaceResolutionContext(org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext) HashMap(java.util.HashMap) UserImpl(org.eclipse.che.api.user.server.model.impl.UserImpl) KubernetesServer(io.fabric8.kubernetes.client.server.mock.KubernetesServer) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

NamespaceResolutionContext (org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext)56 Test (org.testng.annotations.Test)30 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)16 KubernetesServer (io.fabric8.kubernetes.client.server.mock.KubernetesServer)14 BeforeMethod (org.testng.annotations.BeforeMethod)14 HashMap (java.util.HashMap)8 KubernetesNamespaceMetaImpl (org.eclipse.che.workspace.infrastructure.kubernetes.api.server.impls.KubernetesNamespaceMetaImpl)8 WorkspaceImpl (org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl)6 InfrastructureException (org.eclipse.che.api.workspace.server.spi.InfrastructureException)6 KubernetesNamespaceMeta (org.eclipse.che.workspace.infrastructure.kubernetes.api.shared.KubernetesNamespaceMeta)6 KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)4 RuntimeIdentity (org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity)4 UserImpl (org.eclipse.che.api.user.server.model.impl.UserImpl)4 RuntimeIdentityImpl (org.eclipse.che.api.workspace.server.model.impl.RuntimeIdentityImpl)4 DevfileImpl (org.eclipse.che.api.workspace.server.model.impl.devfile.DevfileImpl)4 SubjectImpl (org.eclipse.che.commons.subject.SubjectImpl)4 NamespaceConfigurator (org.eclipse.che.workspace.infrastructure.kubernetes.namespace.configurator.NamespaceConfigurator)4 Namespace (io.fabric8.kubernetes.api.model.Namespace)2 NamespaceBuilder (io.fabric8.kubernetes.api.model.NamespaceBuilder)2 Project (io.fabric8.openshift.api.model.Project)2