diff --git a/agents/go-agents/bootstrapper/booter/booter_test.go b/agents/go-agents/bootstrapper/booter/booter_test.go index 7a9b6d86241..0827d510e95 100644 --- a/agents/go-agents/bootstrapper/booter/booter_test.go +++ b/agents/go-agents/bootstrapper/booter/booter_test.go @@ -26,7 +26,6 @@ var ( testRuntimeID = RuntimeID{ Workspace: "my-workspace", Environment: "my-env", - OwnerName: "me", OwnerId: "id", } testMachineName = "my-machine" diff --git a/agents/go-agents/bootstrapper/booter/events.go b/agents/go-agents/bootstrapper/booter/events.go index 2ce8b4f0b30..9f308b06634 100644 --- a/agents/go-agents/bootstrapper/booter/events.go +++ b/agents/go-agents/bootstrapper/booter/events.go @@ -79,9 +79,6 @@ type RuntimeID struct { // Environment is a name of environment e.g. "default". Environment string `json:"envName"` - // OwnerName is the name of user who is runtime owner. - OwnerName string `json:"ownerName"` - // OwnerId is an identifier of user who is runtime owner. OwnerId string `json:"ownerId"` } diff --git a/agents/go-agents/bootstrapper/cfg/cfg.go b/agents/go-agents/bootstrapper/cfg/cfg.go index 041c307def7..174c93de486 100644 --- a/agents/go-agents/bootstrapper/cfg/cfg.go +++ b/agents/go-agents/bootstrapper/cfg/cfg.go @@ -97,7 +97,7 @@ func init() { &runtimeIDRaw, "runtime-id", "", - "The identifier of the runtime in format 'workspace:environment:ownerName:ownerId'", + "The identifier of the runtime in format 'workspace:environment:ownerId'", ) flag.StringVar( &MachineName, @@ -155,10 +155,10 @@ func Parse() { log.Fatal("Runtime ID required(set it with -runtime-id argument)") } parts := strings.Split(runtimeIDRaw, ":") - if len(parts) != 4 { - log.Fatalf("Expected runtime id to be in format 'workspace:env:ownerName:ownerId'") + if len(parts) != 3 { + log.Fatalf("Expected runtime id to be in format 'workspace:env:ownerId'") } - RuntimeID = booter.RuntimeID{Workspace: parts[0], Environment: parts[1], OwnerName: parts[2], OwnerId: parts[3]} + RuntimeID = booter.RuntimeID{Workspace: parts[0], Environment: parts[1], OwnerId: parts[2]} // machine-name if len(MachineName) == 0 { @@ -182,7 +182,6 @@ func Print() { log.Print(" Runtime ID:") log.Printf(" Workspace: %s", RuntimeID.Workspace) log.Printf(" Environment: %s", RuntimeID.Environment) - log.Printf(" OwnerName: %s", RuntimeID.OwnerName) log.Printf(" OwnerId: %s", RuntimeID.OwnerId) log.Printf(" Machine name: %s", MachineName) log.Printf(" Installer timeout: %dseconds", InstallerTimeoutSec) diff --git a/core/che-core-api-model/src/main/java/org/eclipse/che/api/core/model/workspace/runtime/RuntimeIdentity.java b/core/che-core-api-model/src/main/java/org/eclipse/che/api/core/model/workspace/runtime/RuntimeIdentity.java index 0cb0ef2dfc0..490be2842b7 100644 --- a/core/che-core-api-model/src/main/java/org/eclipse/che/api/core/model/workspace/runtime/RuntimeIdentity.java +++ b/core/che-core-api-model/src/main/java/org/eclipse/che/api/core/model/workspace/runtime/RuntimeIdentity.java @@ -16,7 +16,5 @@ public interface RuntimeIdentity { String getEnvName(); - String getOwnerName(); - String getOwnerId(); } diff --git a/infrastructures/docker/infrastructure/src/main/java/org/eclipse/che/workspace/infrastructure/docker/Labels.java b/infrastructures/docker/infrastructure/src/main/java/org/eclipse/che/workspace/infrastructure/docker/Labels.java index 3a763ea5a20..3307da39a2d 100644 --- a/infrastructures/docker/infrastructure/src/main/java/org/eclipse/che/workspace/infrastructure/docker/Labels.java +++ b/infrastructures/docker/infrastructure/src/main/java/org/eclipse/che/workspace/infrastructure/docker/Labels.java @@ -89,7 +89,6 @@ public Serializer machineName(String name) { public Serializer runtimeId(RuntimeIdentity runtimeId) { labels.put(LABEL_WORKSPACE_ID, runtimeId.getWorkspaceId()); labels.put(LABEL_WORKSPACE_ENV, runtimeId.getEnvName()); - labels.put(LABEL_WORKSPACE_OWNER, runtimeId.getOwnerName()); labels.put(LABEL_WORKSPACE_OWNER_ID, runtimeId.getOwnerId()); return this; } @@ -161,7 +160,6 @@ public RuntimeIdentity runtimeId() { return new RuntimeIdentityImpl( labels.get(LABEL_WORKSPACE_ID), labels.get(LABEL_WORKSPACE_ENV), - labels.get(LABEL_WORKSPACE_OWNER), labels.get(LABEL_WORKSPACE_OWNER_ID)); } diff --git a/infrastructures/docker/infrastructure/src/main/java/org/eclipse/che/workspace/infrastructure/docker/bootstrap/DockerBootstrapper.java b/infrastructures/docker/infrastructure/src/main/java/org/eclipse/che/workspace/infrastructure/docker/bootstrap/DockerBootstrapper.java index c48f385750d..381bfc68687 100644 --- a/infrastructures/docker/infrastructure/src/main/java/org/eclipse/che/workspace/infrastructure/docker/bootstrap/DockerBootstrapper.java +++ b/infrastructures/docker/infrastructure/src/main/java/org/eclipse/che/workspace/infrastructure/docker/bootstrap/DockerBootstrapper.java @@ -86,10 +86,9 @@ protected void doBootstrapAsync(String installerWebsocketEndpoint, String output + machineName + " -runtime-id " + String.format( - "%s:%s:%s:%s", + "%s:%s:%s", runtimeIdentity.getWorkspaceId(), runtimeIdentity.getEnvName(), - runtimeIdentity.getOwnerName(), runtimeIdentity.getOwnerId()) + " -push-endpoint " + installerWebsocketEndpoint diff --git a/infrastructures/docker/infrastructure/src/main/java/org/eclipse/che/workspace/infrastructure/docker/environment/DockerEnvironmentNormalizer.java b/infrastructures/docker/infrastructure/src/main/java/org/eclipse/che/workspace/infrastructure/docker/environment/DockerEnvironmentNormalizer.java index b4d6d4425ca..3b7d13ec696 100644 --- a/infrastructures/docker/infrastructure/src/main/java/org/eclipse/che/workspace/infrastructure/docker/environment/DockerEnvironmentNormalizer.java +++ b/infrastructures/docker/infrastructure/src/main/java/org/eclipse/che/workspace/infrastructure/docker/environment/DockerEnvironmentNormalizer.java @@ -40,11 +40,12 @@ public void normalize(DockerEnvironment dockerEnvironment, RuntimeIdentity ident Map containers = dockerEnvironment.getContainers(); for (Map.Entry containerEntry : containers.entrySet()) { DockerContainerConfig containerConfig = containerEntry.getValue(); + containerConfig.setContainerName( containerNameGenerator.generateContainerName( identity.getWorkspaceId(), containerConfig.getId(), - identity.getOwnerName(), + identity.getOwnerId(), containerEntry.getKey())); } normalizeNames(dockerEnvironment); diff --git a/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/DockerInternalRuntimeTest.java b/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/DockerInternalRuntimeTest.java index 945aa7bb2a3..eae48fb1f03 100644 --- a/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/DockerInternalRuntimeTest.java +++ b/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/DockerInternalRuntimeTest.java @@ -86,8 +86,7 @@ */ public class DockerInternalRuntimeTest { - private static final RuntimeIdentity IDENTITY = - new RuntimeIdentityImpl("ws1", "env1", "usr1", "id1"); + private static final RuntimeIdentity IDENTITY = new RuntimeIdentityImpl("ws1", "env1", "id1"); private static final String DEV_MACHINE = "DEV_MACHINE"; private static final String DB_MACHINE = "DB_MACHINE"; private static final String SERVER_1 = "serv1"; diff --git a/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/LabelsTest.java b/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/LabelsTest.java index 9ab1dd536d7..c937d0a884c 100644 --- a/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/LabelsTest.java +++ b/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/LabelsTest.java @@ -43,7 +43,7 @@ public void serialization() { Map serialized = Labels.newSerializer() .machineName("dev-machine") - .runtimeId(new RuntimeIdentityImpl("workspace123", "my-env", "owner", "id")) + .runtimeId(new RuntimeIdentityImpl("workspace123", "my-env", "id")) .server( "my-server1/http", new ServerConfigImpl("8000/tcp", "http", "/api/info", emptyMap())) @@ -59,7 +59,6 @@ public void serialization() { .put("org.eclipse.che.machine.name", "dev-machine") .put("org.eclipse.che.workspace.id", "workspace123") .put("org.eclipse.che.workspace.env", "my-env") - .put("org.eclipse.che.workspace.owner", "owner") .put("org.eclipse.che.workspace.owner.id", "id") .put("org.eclipse.che.server.my-server1/http.port", "8000/tcp") .put("org.eclipse.che.server.my-server1/http.protocol", "http") @@ -90,7 +89,6 @@ public void deserialization() { .put("org.eclipse.che.machine.name", "dev-machine") .put("org.eclipse.che.workspace.id", "workspace123") .put("org.eclipse.che.workspace.env", "my-env") - .put("org.eclipse.che.workspace.owner", "owner") .put("org.eclipse.che.workspace.owner.id", "id") .put("org.eclipse.che.server.my-server1/http.port", "8000/tcp") .put("org.eclipse.che.server.my-server1/http.protocol", "http") @@ -123,7 +121,6 @@ public void deserialization() { RuntimeIdentity runtimeId = deserializer.runtimeId(); assertEquals(runtimeId.getWorkspaceId(), "workspace123", "workspace id"); assertEquals(runtimeId.getEnvName(), "my-env", "workspace environment name"); - assertEquals(runtimeId.getOwnerName(), "owner", "workspace owner name"); assertEquals(runtimeId.getOwnerId(), "id", "workspace owner id"); Map servers = deserializer.servers(); diff --git a/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/container/DockerContainersTest.java b/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/container/DockerContainersTest.java index f81a64d796e..7095aa62faf 100644 --- a/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/container/DockerContainersTest.java +++ b/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/container/DockerContainersTest.java @@ -48,8 +48,8 @@ public class DockerContainersTest { @Test public void findsIdentifiers() throws Exception { - RuntimeIdentity id1 = new RuntimeIdentityImpl("workspace123", "default", "test", "id"); - RuntimeIdentity id2 = new RuntimeIdentityImpl("workspace234", "default", "test", "id"); + RuntimeIdentity id1 = new RuntimeIdentityImpl("workspace123", "default", "id"); + RuntimeIdentity id2 = new RuntimeIdentityImpl("workspace234", "default", "id"); List entries = asList(mockContainer(id1, "container1"), mockContainer(id2, "container2")); @@ -81,7 +81,7 @@ public void findsIdentifiers() throws Exception { @Test public void findContainers() throws Exception { - RuntimeIdentity id = new RuntimeIdentityImpl("workspace123", "default", "test", "id"); + RuntimeIdentity id = new RuntimeIdentityImpl("workspace123", "default", "id"); ContainerListEntry entry1 = mockContainer(id, "container1"); ContainerListEntry entry2 = mockContainer(id, "container2"); @@ -113,7 +113,7 @@ public void findContainers() throws Exception { throws Exception { when(docker.listContainers(anyObject())).thenThrow(new IOException("oops")); - containers.find(new RuntimeIdentityImpl("workspace123", "default", "test", "id")); + containers.find(new RuntimeIdentityImpl("workspace123", "default", "id")); } private ContainerListEntry mockContainer(RuntimeIdentity runtimeId, String containerId) diff --git a/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/local/installer/WsAgentServerConfigProvisionerTest.java b/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/local/installer/WsAgentServerConfigProvisionerTest.java index 7282bd7e728..b61e3068071 100644 --- a/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/local/installer/WsAgentServerConfigProvisionerTest.java +++ b/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/local/installer/WsAgentServerConfigProvisionerTest.java @@ -36,7 +36,7 @@ @Listeners(MockitoTestNGListener.class) public class WsAgentServerConfigProvisionerTest { private static final RuntimeIdentity RUNTIME_IDENTITY = - new RuntimeIdentityImpl("wsId", "env", "owner", "id"); + new RuntimeIdentityImpl("wsId", "env", "id"); private static final String MACHINE_1_NAME = "machine1"; private static final String MACHINE_2_NAME = "machine2"; diff --git a/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/local/projects/BindMountProjectsVolumeProvisionerTest.java b/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/local/projects/BindMountProjectsVolumeProvisionerTest.java index 55927c5a9d1..cbcf8f2f181 100644 --- a/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/local/projects/BindMountProjectsVolumeProvisionerTest.java +++ b/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/local/projects/BindMountProjectsVolumeProvisionerTest.java @@ -41,7 +41,7 @@ public class BindMountProjectsVolumeProvisionerTest { private static final String WORKSPACE_ID = "wsId"; private static final RuntimeIdentity RUNTIME_IDENTITY = - new RuntimeIdentityImpl(WORKSPACE_ID, "env", "owner", "id"); + new RuntimeIdentityImpl(WORKSPACE_ID, "env", "id"); private static final String MACHINE_1_NAME = "machine1"; private static final String MACHINE_2_NAME = "machine2"; private static final String MACHINE_3_NAME = "machine3"; diff --git a/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/server/mapping/SinglePortUrlRewriterTest.java b/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/server/mapping/SinglePortUrlRewriterTest.java index 125915dcc94..86e42205060 100644 --- a/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/server/mapping/SinglePortUrlRewriterTest.java +++ b/infrastructures/docker/infrastructure/src/test/java/org/eclipse/che/workspace/infrastructure/docker/server/mapping/SinglePortUrlRewriterTest.java @@ -47,7 +47,7 @@ public static Object[][] urlRewritingTestProvider() { return new Object[][] { // External IP { - new RuntimeIdentityImpl("ws123", null, null, null), + new RuntimeIdentityImpl("ws123", null, null), "172.12.0.2", "127.0.0.1", "machine1", @@ -58,7 +58,7 @@ public static Object[][] urlRewritingTestProvider() { }, // Internal IP, protocol, path param { - new RuntimeIdentityImpl("ws123", null, null, null), + new RuntimeIdentityImpl("ws123", null, null), "127.0.0.1", null, "machine1", @@ -69,7 +69,7 @@ public static Object[][] urlRewritingTestProvider() { }, // Without machine name { - new RuntimeIdentityImpl("ws123", null, null, null), + new RuntimeIdentityImpl("ws123", null, null), "127.0.0.1", null, null, @@ -80,7 +80,7 @@ public static Object[][] urlRewritingTestProvider() { }, // Without server { - new RuntimeIdentityImpl("ws123", null, null, null), + new RuntimeIdentityImpl("ws123", null, null), "127.0.0.1", null, "machine1", @@ -101,7 +101,6 @@ public void shouldThrowExceptionWhenRewritingFails() throws Exception { Provider provider = () -> new SinglePortHostnameBuilder("172.12.0.2", "127.0.0.1", null); SinglePortUrlRewriter rewriter = new SinglePortUrlRewriter(8080, provider); - rewriter.rewriteURL( - new RuntimeIdentityImpl("ws123", null, null, null), "machine1", "server", ":"); + rewriter.rewriteURL(new RuntimeIdentityImpl("ws123", null, null), "machine1", "server", ":"); } } diff --git a/infrastructures/kubernetes/src/main/java/org/eclipse/che/workspace/infrastructure/kubernetes/bootstrapper/KubernetesBootstrapper.java b/infrastructures/kubernetes/src/main/java/org/eclipse/che/workspace/infrastructure/kubernetes/bootstrapper/KubernetesBootstrapper.java index b84b5bf8437..03c1a1c0393 100644 --- a/infrastructures/kubernetes/src/main/java/org/eclipse/che/workspace/infrastructure/kubernetes/bootstrapper/KubernetesBootstrapper.java +++ b/infrastructures/kubernetes/src/main/java/org/eclipse/che/workspace/infrastructure/kubernetes/bootstrapper/KubernetesBootstrapper.java @@ -92,10 +92,9 @@ protected void doBootstrapAsync(String installerWebsocketEndpoint, String output + kubernetesMachine.getName() + " -runtime-id " + String.format( - "%s:%s:%s:%s", + "%s:%s:%s", runtimeIdentity.getWorkspaceId(), runtimeIdentity.getEnvName(), - runtimeIdentity.getOwnerName(), runtimeIdentity.getOwnerId()) + " -push-endpoint " + installerWebsocketEndpoint diff --git a/infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/KubernetesInternalRuntimeTest.java b/infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/KubernetesInternalRuntimeTest.java index 8b0a768834a..1f23fc9bcdd 100644 --- a/infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/KubernetesInternalRuntimeTest.java +++ b/infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/KubernetesInternalRuntimeTest.java @@ -126,7 +126,7 @@ public class KubernetesInternalRuntimeTest { private static final String M2_NAME = POD_NAME + '/' + CONTAINER_NAME_2; private static final RuntimeIdentity IDENTITY = - new RuntimeIdentityImpl(WORKSPACE_ID, "env1", "usr1", "id1"); + new RuntimeIdentityImpl(WORKSPACE_ID, "env1", "id1"); @Mock private KubernetesRuntimeContext context; @Mock private EventService eventService; diff --git a/infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/CommonPVCStrategyTest.java b/infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/CommonPVCStrategyTest.java index 6f96713f20e..9d05ef525e4 100644 --- a/infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/CommonPVCStrategyTest.java +++ b/infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/CommonPVCStrategyTest.java @@ -81,7 +81,7 @@ public class CommonPVCStrategyTest { private static final String[] WORKSPACE_SUBPATHS = {"/projects", "/logs"}; private static final RuntimeIdentity IDENTITY = - new RuntimeIdentityImpl(WORKSPACE_ID, "env1", "usr1", "id1"); + new RuntimeIdentityImpl(WORKSPACE_ID, "env1", "id1"); @Mock private Pod pod; @Mock private Pod pod2; diff --git a/infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/UniqueWorkspacePVCStrategyTest.java b/infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/UniqueWorkspacePVCStrategyTest.java index 9d824970bf2..edf1bc64b4f 100644 --- a/infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/UniqueWorkspacePVCStrategyTest.java +++ b/infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/UniqueWorkspacePVCStrategyTest.java @@ -83,7 +83,7 @@ public class UniqueWorkspacePVCStrategyTest { private static final String VOLUME_2_NAME = "vol2"; private static final RuntimeIdentity IDENTITY = - new RuntimeIdentityImpl(WORKSPACE_ID, "env1", "usr1", "id1"); + new RuntimeIdentityImpl(WORKSPACE_ID, "env1", "id1"); @Mock private KubernetesEnvironment k8sEnv; @Mock private KubernetesClientFactory clientFactory; diff --git a/infrastructures/openshift/src/test/java/org/eclipse/che/workspace/infrastructure/openshift/OpenShiftInternalRuntimeTest.java b/infrastructures/openshift/src/test/java/org/eclipse/che/workspace/infrastructure/openshift/OpenShiftInternalRuntimeTest.java index 5158e36664e..bae47d34312 100644 --- a/infrastructures/openshift/src/test/java/org/eclipse/che/workspace/infrastructure/openshift/OpenShiftInternalRuntimeTest.java +++ b/infrastructures/openshift/src/test/java/org/eclipse/che/workspace/infrastructure/openshift/OpenShiftInternalRuntimeTest.java @@ -102,7 +102,7 @@ public class OpenShiftInternalRuntimeTest { private static final String M2_NAME = POD_NAME + '/' + CONTAINER_NAME_2; private static final RuntimeIdentity IDENTITY = - new RuntimeIdentityImpl(WORKSPACE_ID, "env1", "usr1", "id1"); + new RuntimeIdentityImpl(WORKSPACE_ID, "env1", "id1"); @Mock private OpenShiftRuntimeContext context; @Mock private EventService eventService; diff --git a/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/dto/RuntimeIdentityDto.java b/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/dto/RuntimeIdentityDto.java index 3fe72af6b36..fd8898282c3 100644 --- a/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/dto/RuntimeIdentityDto.java +++ b/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/dto/RuntimeIdentityDto.java @@ -27,11 +27,6 @@ public interface RuntimeIdentityDto extends RuntimeIdentity { RuntimeIdentityDto withEnvName(String envName); - @Override - String getOwnerName(); - - RuntimeIdentityDto withOwnerName(String ownerName); - @Override String getOwnerId(); diff --git a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/DtoConverter.java b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/DtoConverter.java index 34beb3e77a8..05ae601413b 100644 --- a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/DtoConverter.java +++ b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/DtoConverter.java @@ -246,7 +246,6 @@ public static RuntimeIdentityDto asDto(RuntimeIdentity identity) { return newDto(RuntimeIdentityDto.class) .withWorkspaceId(identity.getWorkspaceId()) .withEnvName(identity.getEnvName()) - .withOwnerName(identity.getOwnerName()) .withOwnerId(identity.getOwnerId()); } diff --git a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/WorkspaceRuntimes.java b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/WorkspaceRuntimes.java index a4c28175c80..8273483981f 100644 --- a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/WorkspaceRuntimes.java +++ b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/WorkspaceRuntimes.java @@ -206,8 +206,7 @@ public CompletableFuture startAsync( } Subject subject = EnvironmentContext.getCurrent().getSubject(); - RuntimeIdentity runtimeId = - new RuntimeIdentityImpl(workspaceId, envName, subject.getUserName(), subject.getUserId()); + RuntimeIdentity runtimeId = new RuntimeIdentityImpl(workspaceId, envName, subject.getUserId()); try { InternalEnvironment internalEnv = createInternalEnvironment(environment); RuntimeContext runtimeContext = infrastructure.prepare(runtimeId, internalEnv); diff --git a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/bootstrap/AbstractBootstrapper.java b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/bootstrap/AbstractBootstrapper.java index 155a83c575d..21bdb0de22b 100644 --- a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/bootstrap/AbstractBootstrapper.java +++ b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/bootstrap/AbstractBootstrapper.java @@ -55,7 +55,6 @@ public AbstractBootstrapper( RuntimeIdentityDto runtimeId = event.getRuntimeId(); if (event.getMachineName().equals(machineName) && runtimeIdentity.getEnvName().equals(runtimeId.getEnvName()) - && runtimeIdentity.getOwnerName().equals(runtimeId.getOwnerName()) && runtimeIdentity.getWorkspaceId().equals(runtimeId.getWorkspaceId())) { finishEventFuture.complete(event); diff --git a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/model/impl/RuntimeIdentityImpl.java b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/model/impl/RuntimeIdentityImpl.java index 59beb0567fb..d33332f97b9 100644 --- a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/model/impl/RuntimeIdentityImpl.java +++ b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/model/impl/RuntimeIdentityImpl.java @@ -17,13 +17,11 @@ public final class RuntimeIdentityImpl implements RuntimeIdentity { private final String workspaceId; private final String envName; - private final String ownerName; private final String ownerId; - public RuntimeIdentityImpl(String workspaceId, String envName, String ownerName, String ownerId) { + public RuntimeIdentityImpl(String workspaceId, String envName, String ownerId) { this.workspaceId = workspaceId; this.envName = envName; - this.ownerName = ownerName; this.ownerId = ownerId; } @@ -37,11 +35,6 @@ public String getEnvName() { return envName; } - @Override - public String getOwnerName() { - return ownerName; - } - @Override public String getOwnerId() { return ownerId; @@ -65,8 +58,8 @@ public String toString() { + workspaceId + " environment: " + envName - + " owner: " - + ownerName + + " ownerId: " + + ownerId + " }"; } } diff --git a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/spi/InternalRuntime.java b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/spi/InternalRuntime.java index 5b85862ec4d..5d220f49851 100644 --- a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/spi/InternalRuntime.java +++ b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/spi/InternalRuntime.java @@ -60,7 +60,7 @@ public String getActiveEnv() { @Override public String getOwner() { - return context.getIdentity().getOwnerName(); + return context.getIdentity().getOwnerId(); } @Override diff --git a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/spi/RuntimeStartInterruptedException.java b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/spi/RuntimeStartInterruptedException.java index 29fc62af27e..7fb03b0c5fb 100644 --- a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/spi/RuntimeStartInterruptedException.java +++ b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/spi/RuntimeStartInterruptedException.java @@ -24,7 +24,7 @@ public class RuntimeStartInterruptedException extends InfrastructureException { public RuntimeStartInterruptedException(RuntimeIdentity identity) { super( format( - "Runtime start for identity 'workspace: %s, environment: %s, owner: %s' is interrupted", - identity.getWorkspaceId(), identity.getEnvName(), identity.getOwnerName())); + "Runtime start for identity 'workspace: %s, environment: %s, ownerId: %s' is interrupted", + identity.getWorkspaceId(), identity.getEnvName(), identity.getOwnerId())); } } diff --git a/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/WorkspaceManagerTest.java b/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/WorkspaceManagerTest.java index 933c3d9c9e4..ce09046b524 100644 --- a/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/WorkspaceManagerTest.java +++ b/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/WorkspaceManagerTest.java @@ -527,11 +527,7 @@ private void mockRuntimeStatus(WorkspaceImpl workspace, WorkspaceStatus status) private TestInternalRuntime mockRuntime(WorkspaceImpl workspace, WorkspaceStatus status) throws Exception { RuntimeIdentity identity = - new RuntimeIdentityImpl( - workspace.getId(), - workspace.getConfig().getDefaultEnv(), - workspace.getNamespace(), - "id"); + new RuntimeIdentityImpl(workspace.getId(), workspace.getConfig().getDefaultEnv(), "id"); // doAnswer(inv -> { // final WorkspaceImpl ws = (WorkspaceImpl)inv.getArguments()[0]; // ws.setStatus(status); diff --git a/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/WorkspaceRuntimesTest.java b/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/WorkspaceRuntimesTest.java index 962676bd591..c56554aeea5 100644 --- a/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/WorkspaceRuntimesTest.java +++ b/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/WorkspaceRuntimesTest.java @@ -101,7 +101,7 @@ public void setUp() throws Exception { @Test public void runtimeIsRecovered() throws Exception { - RuntimeIdentity identity = new RuntimeIdentityImpl("workspace123", "my-env", "me", "myId"); + RuntimeIdentity identity = new RuntimeIdentityImpl("workspace123", "my-env", "myId"); mockWorkspace(identity); RuntimeContext context = mockContext(identity); @@ -119,7 +119,7 @@ public void runtimeIsRecovered() throws Exception { @Test public void runtimeIsNotRecoveredIfNoWorkspaceFound() throws Exception { - RuntimeIdentity identity = new RuntimeIdentityImpl("workspace123", "my-env", "me", "myId"); + RuntimeIdentity identity = new RuntimeIdentityImpl("workspace123", "my-env", "myId"); when(workspaceDao.get(identity.getWorkspaceId())).thenThrow(new NotFoundException("no!")); // try recover @@ -130,7 +130,7 @@ public void runtimeIsNotRecoveredIfNoWorkspaceFound() throws Exception { @Test public void runtimeIsNotRecoveredIfNoEnvironmentFound() throws Exception { - RuntimeIdentity identity = new RuntimeIdentityImpl("workspace123", "my-env", "me", "myId"); + RuntimeIdentity identity = new RuntimeIdentityImpl("workspace123", "my-env", "myId"); WorkspaceImpl workspace = mockWorkspace(identity); when(workspace.getConfig().getEnvironments()).thenReturn(emptyMap()); @@ -142,7 +142,7 @@ public void runtimeIsNotRecoveredIfNoEnvironmentFound() throws Exception { @Test public void runtimeIsNotRecoveredIfInfraPreparationFailed() throws Exception { - RuntimeIdentity identity = new RuntimeIdentityImpl("workspace123", "my-env", "me", "myId"); + RuntimeIdentity identity = new RuntimeIdentityImpl("workspace123", "my-env", "myId"); mockWorkspace(identity); InternalEnvironment internalEnvironment = mock(InternalEnvironment.class); @@ -160,7 +160,7 @@ public void runtimeIsNotRecoveredIfInfraPreparationFailed() throws Exception { @Test public void runtimeIsNotRecoveredIfAnotherRuntimeWithTheSameIdentityAlreadyExists() throws Exception { - RuntimeIdentity identity = new RuntimeIdentityImpl("workspace123", "my-env", "me", "myId"); + RuntimeIdentity identity = new RuntimeIdentityImpl("workspace123", "my-env", "myId"); mockWorkspace(identity); RuntimeContext context = mockContext(identity); @@ -203,7 +203,6 @@ public void attributesIsSetWhenRuntimeAbnormallyStopped() throws Exception { DtoFactory.newDto(RuntimeIdentityDto.class) .withWorkspaceId("workspace123") .withEnvName("my-env") - .withOwnerName("me") .withOwnerId("myId"); mockWorkspace(identity); mockContext(identity); diff --git a/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/hc/probe/WorkspaceProbesFactoryTest.java b/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/hc/probe/WorkspaceProbesFactoryTest.java index 43ba3fe15e5..d073287909a 100644 --- a/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/hc/probe/WorkspaceProbesFactoryTest.java +++ b/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/hc/probe/WorkspaceProbesFactoryTest.java @@ -43,7 +43,7 @@ public class WorkspaceProbesFactoryTest { private static final ServerImpl SERVER = new ServerImpl().withUrl("https://localhost:4040/path1"); private static final RuntimeIdentity IDENTITY = - new RuntimeIdentityImpl(WORKSPACE_ID, "default", "usr1", "id1"); + new RuntimeIdentityImpl(WORKSPACE_ID, "default", "id1"); @Mock private MachineTokenProvider tokenProvider; diff --git a/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/spi/InternalRuntimeTest.java b/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/spi/InternalRuntimeTest.java index 9d184ddc57a..381994d0ef2 100644 --- a/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/spi/InternalRuntimeTest.java +++ b/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/spi/InternalRuntimeTest.java @@ -630,7 +630,7 @@ private static class TestInternalRuntime extends InternalRuntime public TestInternalRuntime(URLRewriter urlRewriter, boolean running) throws ValidationException, InfrastructureException { super( - new TestRuntimeContext(null, new RuntimeIdentityImpl("ws", "env", "owner", "id"), null), + new TestRuntimeContext(null, new RuntimeIdentityImpl("ws", "env", "id"), null), urlRewriter, emptyList(), running); diff --git a/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/spi/provision/env/EnvVarEnvironmentProvisionerTest.java b/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/spi/provision/env/EnvVarEnvironmentProvisionerTest.java index ba2c20f8ac3..70828af5f1c 100644 --- a/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/spi/provision/env/EnvVarEnvironmentProvisionerTest.java +++ b/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/spi/provision/env/EnvVarEnvironmentProvisionerTest.java @@ -42,7 +42,7 @@ public class EnvVarEnvironmentProvisionerTest { private static final RuntimeIdentity RUNTIME_IDENTITY = - new RuntimeIdentityImpl("testWsId", "testEnv", "testOwner", "testOwnerId"); + new RuntimeIdentityImpl("testWsId", "testEnv", "testOwnerId"); @Mock private EnvVarProvider provider1; @Mock private EnvVarProvider provider2;