diff --git a/assembly/assembly-wsmaster-war/src/main/resources/che-in-che.json b/assembly/assembly-wsmaster-war/src/main/resources/che-in-che.json index be92be51f02..e945e6fb5f0 100644 --- a/assembly/assembly-wsmaster-war/src/main/resources/che-in-che.json +++ b/assembly/assembly-wsmaster-war/src/main/resources/che-in-che.json @@ -22,10 +22,6 @@ "version": "3.3.9" } ], - "source": { - "type": "image", - "origin": "eclipse/che-dev:nightly" - }, "workspaceConfig": { "environments": { "default": { diff --git a/dashboard/src/app/stacks/stack-details/stack-validation.service.ts b/dashboard/src/app/stacks/stack-details/stack-validation.service.ts index d6f1842bb09..ba3b743a7e7 100644 --- a/dashboard/src/app/stacks/stack-details/stack-validation.service.ts +++ b/dashboard/src/app/stacks/stack-details/stack-validation.service.ts @@ -26,7 +26,7 @@ export class StackValidationService { */ getStackValidation(stack: che.IStack | {}): che.IValidation { let mandatoryKeys: Array = ['name', 'workspaceConfig']; - let additionalKeys: Array = ['description', 'projects', 'tags', 'creator', 'scope', 'components', 'source']; + let additionalKeys: Array = ['description', 'projects', 'tags', 'creator', 'scope', 'components']; let validKeys: Array = mandatoryKeys.concat(additionalKeys); let errors: Array = []; let isValid: boolean = true; diff --git a/dashboard/src/components/typings/che.d.ts b/dashboard/src/components/typings/che.d.ts index 447381672ff..db8ade2c423 100755 --- a/dashboard/src/components/typings/che.d.ts +++ b/dashboard/src/components/typings/che.d.ts @@ -264,7 +264,6 @@ declare namespace che { scope?: string; components?: Array; links?: Array; - source?: any; workspaceConfig: IWorkspaceConfig; } diff --git a/ide/che-core-ide-stacks/src/main/resources/stacks.json b/ide/che-core-ide-stacks/src/main/resources/stacks.json index c2c2aacf189..9a32a4738e1 100644 --- a/ide/che-core-ide-stacks/src/main/resources/stacks.json +++ b/ide/che-core-ide-stacks/src/main/resources/stacks.json @@ -22,10 +22,6 @@ "version": "8.0.24" } ], - "source": { - "type": "image", - "origin": "eclipse/centos_jdk8" - }, "workspaceConfig": { "environments": { "default": { @@ -110,10 +106,6 @@ "version": "8.0.24" } ], - "source": { - "type": "image", - "origin": "eclipse/ubuntu_jdk8" - }, "workspaceConfig": { "environments": { "default": { @@ -203,10 +195,6 @@ "version": "8.0.24" } ], - "source": { - "type": "image", - "origin": "eclipse/ubuntu_jdk8" - }, "workspaceConfig": { "environments": { "default": { @@ -273,10 +261,6 @@ "Subversion" ], "components": [], - "source": { - "type": "image", - "origin": "eclipse/ubuntu_jdk8" - }, "workspaceConfig": { "environments": { "default": { @@ -344,10 +328,6 @@ "version": "3.2.3" } ], - "source": { - "type": "image", - "origin": "eclipse/ubuntu_android" - }, "workspaceConfig": { "environments": { "default": { @@ -420,10 +400,6 @@ "version": "3.81" } ], - "source": { - "type": "image", - "origin": "eclipse/cpp_gcc" - }, "workspaceConfig": { "environments": { "default": { @@ -485,10 +461,6 @@ "version": "2.0.0-preview2-006497" } ], - "source": { - "type": "image", - "origin": "eclipse/dotnet_core" - }, "workspaceConfig": { "environments": { "default": { @@ -563,10 +535,6 @@ "version": "1.6.2" } ], - "source": { - "type": "image", - "origin": "eclipse/ubuntu_go" - }, "workspaceConfig": { "environments": { "default": { @@ -638,10 +606,6 @@ "name": "Hadoop" } ], - "source": { - "type": "image", - "origin": "eclipse/hadoop-dev" - }, "workspaceConfig": { "environments": { "default": { @@ -728,10 +692,6 @@ "version": "1.8.5" } ], - "source": { - "type": "image", - "origin": "eclipse/node" - }, "workspaceConfig": { "environments": { "default": { @@ -811,10 +771,6 @@ "version": "---" } ], - "source": { - "type": "image", - "origin": "eclipse/php" - }, "workspaceConfig": { "environments": { "default": { @@ -941,10 +897,6 @@ "version": "---" } ], - "source": { - "type": "image", - "origin": "eclipse/php:5.6" - }, "workspaceConfig": { "environments": { "default": { @@ -1056,10 +1008,6 @@ "version": "8.1.1" } ], - "source": { - "type": "image", - "origin": "eclipse/ubuntu_python:latest" - }, "workspaceConfig": { "environments": { "default": { @@ -1136,10 +1084,6 @@ "version": "1.11.2" } ], - "source": { - "type": "image", - "origin": "eclipse/ruby_rails" - }, "workspaceConfig": { "environments": { "default": { @@ -1209,10 +1153,6 @@ "version": "Jessie" } ], - "source": { - "type": "image", - "origin": "eclipse/debian_jdk8" - }, "workspaceConfig": { "environments": { "default": { @@ -1254,10 +1194,6 @@ "version": "Jessie" } ], - "source": { - "type": "image", - "origin": "eclipse/debian_jdk8" - }, "workspaceConfig": { "environments": { "default": { @@ -1320,10 +1256,6 @@ "version": "8.0.24" } ], - "source": { - "type": "image", - "origin": "eclipse/centos_jdk8" - }, "workspaceConfig": { "environments": { "default": { @@ -1405,10 +1337,6 @@ "version": "8.0.24" } ], - "source": { - "type": "image", - "origin": "eclipse/debian_jdk8" - }, "workspaceConfig": { "environments": { "default": { @@ -1484,10 +1412,6 @@ "version": "---" } ], - "source": { - "type": "image", - "origin": "eclipse/php:gae" - }, "workspaceConfig": { "environments": { "default": { @@ -1559,10 +1483,6 @@ "version": "8.1.1" } ], - "source": { - "type": "image", - "origin": "eclipse/ubuntu_python:2.7" - }, "workspaceConfig": { "environments": { "default": { @@ -1631,10 +1551,6 @@ "version": "1.9.37" } ], - "source": { - "type": "image", - "origin": "eclipse/ubuntu_python:gae_python2.7" - }, "workspaceConfig": { "environments": { "default": { @@ -1722,10 +1638,6 @@ "version": "---" } ], - "source": { - "type": "image", - "origin": "eclipse/selenium" - }, "workspaceConfig": { "environments": { "default": { @@ -1795,10 +1707,6 @@ "version": "1.7.3" } ], - "source": { - "type": "image", - "origin": "tomitribe/ubuntu_tomee_173_jdk8" - }, "workspaceConfig": { "environments": { "default": { @@ -1886,10 +1794,6 @@ "name": "default", "defaultEnv": "default", "description": null - }, - "source": { - "type": "image", - "origin": "eclipse/ubuntu_jdk8" } }, { @@ -1920,10 +1824,6 @@ "version": "---" } ], - "source": { - "type": "image", - "origin": "kaloyanraev/che-zendserver" - }, "workspaceConfig": { "environments": { "default": { @@ -2044,10 +1944,6 @@ "version": "3.2.0" } ], - "source": { - "type": "image", - "origin": "code/pio:latest" - }, "workspaceConfig": { "environments": { "default": { @@ -2158,10 +2054,6 @@ "name": "Maven", "version": "3.2.2" }], - "source": { - "type": "image", - "origin": "registry.centos.org/che-stacks/vertx" - }, "workspaceConfig": { "environments": { "default": { @@ -2263,10 +2155,6 @@ "version": "3.3" } ], - "source": { - "type": "image", - "origin": "registry.centos.org/che-stacks/spring-boot" - }, "workspaceConfig": { "name": "default", "defaultEnv": "default", @@ -2354,10 +2242,6 @@ "creator": "Dharmit Shah", "description": "Eclipse WildFly Swarm Stack on CentOS.", "scope": "advanced", - "source": { - "type": "image", - "origin": "registry.centos.org/che-stacks/wildfly-swarm" - }, "tags": [ "Java", "JDK", @@ -2440,10 +2324,6 @@ "name": "CentOS nodejs", "id": "nodejs4", "scope": "advanced", - "source": { - "type": "image", - "origin": "registry.centos.org/che-stacks/centos-nodejs" - }, "description": "CentOS Node Stack", "tags": [ "CentOS", @@ -2551,10 +2431,6 @@ "Git" ], "components": [], - "source": { - "type": "image", - "origin": "eclipse/kotlin" - }, "workspaceConfig": { "environments": { "default": { @@ -2600,10 +2476,6 @@ "version": "1.6.2" } ], - "source": { - "type": "image", - "origin": "registry.centos.org/che-stacks/centos-go" - }, "workspaceConfig": { "environments": { "default": { @@ -2662,10 +2534,6 @@ "Subversion" ], "components": [], - "source": { - "type": "image", - "origin": "registry.centos.org/che-stacks/centos-stack-base" - }, "workspaceConfig": { "environments": { "default": { @@ -2702,10 +2570,6 @@ "scope": "advanced", "name": "Ceylon with Java JavaScript Dart on CentOS", "id": "ceylon-java-javascript-dart-centos", - "source": { - "origin": "registry.centos.org/che-stacks/centos-ceylon-nodejs-dart", - "type": "image" - }, "components": [ { "version": "---", diff --git a/multiuser/integration-tests/che-multiuser-cascade-removal/src/test/java/org/eclipse/che/multiuser/integration/jpa/cascaderemoval/TestObjectsFactory.java b/multiuser/integration-tests/che-multiuser-cascade-removal/src/test/java/org/eclipse/che/multiuser/integration/jpa/cascaderemoval/TestObjectsFactory.java index 14eb03f613e..d232d2d42bd 100644 --- a/multiuser/integration-tests/che-multiuser-cascade-removal/src/test/java/org/eclipse/che/multiuser/integration/jpa/cascaderemoval/TestObjectsFactory.java +++ b/multiuser/integration-tests/che-multiuser-cascade-removal/src/test/java/org/eclipse/che/multiuser/integration/jpa/cascaderemoval/TestObjectsFactory.java @@ -27,7 +27,6 @@ import org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl; import org.eclipse.che.api.workspace.server.model.impl.stack.StackComponentImpl; import org.eclipse.che.api.workspace.server.model.impl.stack.StackImpl; -import org.eclipse.che.api.workspace.server.model.impl.stack.StackSourceImpl; import org.eclipse.che.api.workspace.server.stack.image.StackIcon; import org.eclipse.che.multiuser.permission.workspace.server.model.impl.WorkerImpl; import org.eclipse.che.multiuser.resource.spi.impl.FreeResourcesLimitImpl; @@ -105,7 +104,6 @@ public static StackImpl createStack(String id, String name) { asList( new StackComponentImpl(id + "-component1", id + "-component1-version"), new StackComponentImpl(id + "-component2", id + "-component2-version"))) - .setSource(new StackSourceImpl(id + "-type", id + "-origin")) .setStackIcon( new StackIcon(id + "-icon", id + "-media-type", "0x1234567890abcdef".getBytes())) .build(); diff --git a/multiuser/permission/che-multiuser-permission-workspace/src/test/java/org/eclipse/che/multiuser/permission/workspace/server/jpa/JpaStackDaoTest.java b/multiuser/permission/che-multiuser-permission-workspace/src/test/java/org/eclipse/che/multiuser/permission/workspace/server/jpa/JpaStackDaoTest.java index dff1d6a050c..9ce796a088b 100644 --- a/multiuser/permission/che-multiuser-permission-workspace/src/test/java/org/eclipse/che/multiuser/permission/workspace/server/jpa/JpaStackDaoTest.java +++ b/multiuser/permission/che-multiuser-permission-workspace/src/test/java/org/eclipse/che/multiuser/permission/workspace/server/jpa/JpaStackDaoTest.java @@ -61,29 +61,11 @@ public void setupEntities() throws Exception { stacks = new StackImpl[] { new StackImpl( - "stack1", - "st1", - null, - null, - null, - Arrays.asList("tag1", "tag2"), - null, - null, - null, - null), - new StackImpl("stack2", "st2", null, null, null, null, null, null, null, null), + "stack1", "st1", null, null, null, Arrays.asList("tag1", "tag2"), null, null, null), + new StackImpl("stack2", "st2", null, null, null, null, null, null, null), new StackImpl( - "stack3", - "st3", - null, - null, - null, - Arrays.asList("tag1", "tag2"), - null, - null, - null, - null), - new StackImpl("stack4", "st4", null, null, null, null, null, null, null, null) + "stack3", "st3", null, null, null, Arrays.asList("tag1", "tag2"), null, null, null), + new StackImpl("stack4", "st4", null, null, null, null, null, null, null) }; Injector injector = Guice.createInjector(new WorkspaceTckModule()); diff --git a/multiuser/permission/che-multiuser-permission-workspace/src/test/java/org/eclipse/che/multiuser/permission/workspace/server/jpa/JpaStackPermissionsDaoTest.java b/multiuser/permission/che-multiuser-permission-workspace/src/test/java/org/eclipse/che/multiuser/permission/workspace/server/jpa/JpaStackPermissionsDaoTest.java index b368cb4d292..443f52ccc45 100644 --- a/multiuser/permission/che-multiuser-permission-workspace/src/test/java/org/eclipse/che/multiuser/permission/workspace/server/jpa/JpaStackPermissionsDaoTest.java +++ b/multiuser/permission/che-multiuser-permission-workspace/src/test/java/org/eclipse/che/multiuser/permission/workspace/server/jpa/JpaStackPermissionsDaoTest.java @@ -64,8 +64,8 @@ public void setupEntities() throws Exception { stacks = new StackImpl[] { - new StackImpl("stack1", "st1", null, null, null, null, null, null, null, null), - new StackImpl("stack2", "st2", null, null, null, null, null, null, null, null) + new StackImpl("stack1", "st1", null, null, null, null, null, null, null), + new StackImpl("stack2", "st2", null, null, null, null, null, null, null) }; Injector injector = Guice.createInjector(new WorkspaceTckModule()); diff --git a/multiuser/permission/che-multiuser-permission-workspace/src/test/java/org/eclipse/che/multiuser/permission/workspace/server/spi/tck/StackPermissionsDaoTest.java b/multiuser/permission/che-multiuser-permission-workspace/src/test/java/org/eclipse/che/multiuser/permission/workspace/server/spi/tck/StackPermissionsDaoTest.java index 088aca5f27a..0e2d5cf6347 100644 --- a/multiuser/permission/che-multiuser-permission-workspace/src/test/java/org/eclipse/che/multiuser/permission/workspace/server/spi/tck/StackPermissionsDaoTest.java +++ b/multiuser/permission/che-multiuser-permission-workspace/src/test/java/org/eclipse/che/multiuser/permission/workspace/server/spi/tck/StackPermissionsDaoTest.java @@ -75,8 +75,8 @@ public void setUp() throws TckRepositoryException { wCfg.setDescription("description"); stackRepository.createAll( asList( - new StackImpl("stack1", "st1", null, null, null, null, wCfg, null, null, null), - new StackImpl("stack2", "st2", null, null, null, null, wCfg, null, null, null))); + new StackImpl("stack1", "st1", null, null, null, null, wCfg, null, null), + new StackImpl("stack2", "st2", null, null, null, null, wCfg, null, null))); permissionsRepository.createAll( Stream.of(permissions).map(StackPermissionsImpl::new).collect(Collectors.toList())); diff --git a/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/dto/stack/StackDto.java b/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/dto/stack/StackDto.java index 604e2679899..b437daea2ba 100644 --- a/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/dto/stack/StackDto.java +++ b/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/dto/stack/StackDto.java @@ -52,12 +52,6 @@ public interface StackDto extends Stack, Hyperlinks { StackDto withWorkspaceConfig(WorkspaceConfigDto workspaceConfigDto); - StackSourceDto getSource(); - - void setSource(StackSourceDto source); - - StackDto withSource(StackSourceDto source); - @Override List getComponents(); diff --git a/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/dto/stack/StackSourceDto.java b/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/dto/stack/StackSourceDto.java deleted file mode 100644 index eed9c1052de..00000000000 --- a/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/dto/stack/StackSourceDto.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.api.workspace.shared.dto.stack; - -import org.eclipse.che.api.workspace.shared.stack.StackSource; -import org.eclipse.che.dto.shared.DTO; - -/** @author Alexander Andrienko */ -@DTO -public interface StackSourceDto extends StackSource { - void setType(String type); - - StackSourceDto withType(String type); - - void setOrigin(String origin); - - StackSourceDto withOrigin(String origin); -} diff --git a/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/stack/Stack.java b/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/stack/Stack.java index 2530bce73eb..fa7fabdb81b 100644 --- a/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/stack/Stack.java +++ b/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/stack/Stack.java @@ -60,15 +60,6 @@ public interface Stack { @Nullable WorkspaceConfig getWorkspaceConfig(); - /** - * Return the source for the stack. (e.g. "type:recipe, origin: recipeLink", "type:script, - * origin:recipeScript") - * - * @see StackSource - */ - @Nullable - StackSource getSource(); - /** * Return the list of the components that stack consist of. * 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 c9e23f04929..a3e7f4a2a42 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 @@ -49,9 +49,7 @@ import org.eclipse.che.api.workspace.shared.dto.WorkspaceDto; import org.eclipse.che.api.workspace.shared.dto.stack.StackComponentDto; import org.eclipse.che.api.workspace.shared.dto.stack.StackDto; -import org.eclipse.che.api.workspace.shared.dto.stack.StackSourceDto; import org.eclipse.che.api.workspace.shared.stack.Stack; -import org.eclipse.che.api.workspace.shared.stack.StackSource; /** * Helps to convert to/from DTOs related to workspace. @@ -117,13 +115,6 @@ public static StackDto asDto(Stack stack) { workspaceConfigDto = asDto(stack.getWorkspaceConfig()); } - StackSourceDto stackSourceDto = null; - StackSource source = stack.getSource(); - if (source != null) { - stackSourceDto = - newDto(StackSourceDto.class).withType(source.getType()).withOrigin(source.getOrigin()); - } - List componentsDto = null; if (stack.getComponents() != null) { componentsDto = @@ -146,8 +137,7 @@ public static StackDto asDto(Stack stack) { .withScope(stack.getScope()) .withTags(stack.getTags()) .withComponents(componentsDto) - .withWorkspaceConfig(workspaceConfigDto) - .withSource(stackSourceDto); + .withWorkspaceConfig(workspaceConfigDto); } /** Converts {@link ProjectConfig} to {@link ProjectConfigDto}. */ diff --git a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/model/impl/stack/StackImpl.java b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/model/impl/stack/StackImpl.java index c07211a1eb7..bb23fa99e4d 100644 --- a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/model/impl/stack/StackImpl.java +++ b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/model/impl/stack/StackImpl.java @@ -86,8 +86,6 @@ public static StackBuilder builder() { @JoinColumn(name = "workspaceconfig_id") private WorkspaceConfigImpl workspaceConfig; - @Embedded private StackSourceImpl source; - @ElementCollection @CollectionTable(name = "stack_components", joinColumns = @JoinColumn(name = "stack_id")) private List components; @@ -105,7 +103,6 @@ public StackImpl(StackImpl stack) { stack.getCreator(), stack.getTags(), stack.getWorkspaceConfig(), - stack.getSource(), stack.getComponents(), stack.getStackIcon()); } @@ -119,7 +116,6 @@ public StackImpl(Stack stack) { stack.getCreator(), stack.getTags(), stack.getWorkspaceConfig(), - stack.getSource(), stack.getComponents(), null); } @@ -132,7 +128,6 @@ public StackImpl( String creator, List tags, WorkspaceConfig workspaceConfig, - StackSource source, List components, StackIcon stackIcon) { this.id = id; @@ -149,9 +144,6 @@ public StackImpl( if (workspaceConfig != null) { this.workspaceConfig = new WorkspaceConfigImpl(workspaceConfig); } - if (source != null) { - this.source = new StackSourceImpl(source); - } if (components != null) { this.components = components.stream().map(StackComponentImpl::new).collect(toList()); } @@ -223,15 +215,6 @@ public void setWorkspaceConfig(WorkspaceConfigImpl workspaceConfig) { this.workspaceConfig = workspaceConfig; } - @Override - public StackSourceImpl getSource() { - return source; - } - - public void setSource(StackSourceImpl source) { - this.source = source; - } - @Override public List getComponents() { if (components == null) { @@ -268,7 +251,6 @@ public boolean equals(Object obj) { && Objects.equals(creator, that.creator) && getTags().equals(that.getTags()) && Objects.equals(workspaceConfig, that.workspaceConfig) - && Objects.equals(source, that.source) && getComponents().equals(that.getComponents()) && Objects.equals(stackIcon, that.stackIcon); } @@ -283,7 +265,6 @@ public int hashCode() { hash = 31 * hash + Objects.hashCode(creator); hash = 31 * hash + getTags().hashCode(); hash = 31 * hash + Objects.hashCode(workspaceConfig); - hash = 31 * hash + Objects.hashCode(source); hash = 31 * hash + getComponents().hashCode(); hash = 31 * hash + Objects.hashCode(stackIcon); return hash; @@ -311,8 +292,6 @@ public String toString() { + tags + ", workspaceConfig=" + workspaceConfig - + ", source=" - + source + ", components=" + components + ", stackIcon=" @@ -390,16 +369,7 @@ public StackBuilder setStackIcon(StackIcon stackIcon) { public StackImpl build() { return new StackImpl( - id, - name, - description, - scope, - creator, - tags, - workspaceConfig, - source, - components, - stackIcon); + id, name, description, scope, creator, tags, workspaceConfig, components, stackIcon); } } } diff --git a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/model/impl/stack/StackSourceImpl.java b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/model/impl/stack/StackSourceImpl.java deleted file mode 100644 index c490c8b9065..00000000000 --- a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/model/impl/stack/StackSourceImpl.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.api.workspace.server.model.impl.stack; - -import java.util.Objects; -import javax.persistence.Column; -import javax.persistence.Embeddable; -import org.eclipse.che.api.workspace.shared.stack.StackSource; - -/** - * Implementation of {@link StackSource} - * - * @author Alexander Andrienko - */ -@Embeddable -public class StackSourceImpl implements StackSource { - - @Column(name = "type") - private String type; - - @Column(name = "origin") - private String origin; - - public StackSourceImpl() {} - - public StackSourceImpl(StackSource stackSource) { - this(stackSource.getType(), stackSource.getOrigin()); - } - - public StackSourceImpl(String type, String origin) { - this.type = type; - this.origin = origin; - } - - @Override - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - @Override - public String getOrigin() { - return origin; - } - - public void setOrigin(String origin) { - this.origin = origin; - } - - @Override - public String toString() { - return "StackSourceImpl{" + "type='" + type + '\'' + ", origin='" + origin + '\'' + '}'; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (!(obj instanceof StackSourceImpl)) { - return false; - } - StackSourceImpl another = (StackSourceImpl) obj; - return Objects.equals(type, another.type) && Objects.equals(origin, another.origin); - } - - @Override - public int hashCode() { - int hash = 7; - hash = 31 * hash + Objects.hashCode(type); - hash = 31 * hash + Objects.hashCode(origin); - return hash; - } -} diff --git a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/stack/StackService.java b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/stack/StackService.java index d23ac644956..c62830329cf 100644 --- a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/stack/StackService.java +++ b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/stack/StackService.java @@ -115,7 +115,6 @@ public Response createStack(@ApiParam("The new stack") final StackDto stackDto) .setCreator(userId) .setTags(stackDto.getTags()) .setWorkspaceConfig(stackDto.getWorkspaceConfig()) - .setSource(stackDto.getSource()) .setComponents(stackDto.getComponents()) .build(); stackDao.create(newStack); @@ -180,7 +179,6 @@ public StackDto updateStack( .setCreator(stack.getCreator()) .setTags(updateDto.getTags()) .setWorkspaceConfig(updateDto.getWorkspaceConfig()) - .setSource(updateDto.getSource()) .setComponents(updateDto.getComponents()) .build(); diff --git a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/stack/StackValidator.java b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/stack/StackValidator.java index fffe44fe263..2814c3c8774 100644 --- a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/stack/StackValidator.java +++ b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/stack/StackValidator.java @@ -46,10 +46,6 @@ public void check(Stack stack) throws BadRequestException, ServerException, NotF || !stack.getScope().equals("general") && !stack.getScope().equals("advanced")) { throw new BadRequestException("Required non-null scope value: 'general' or 'advanced'"); } - if (stack.getSource() == null && stack.getWorkspaceConfig() == null) { - throw new BadRequestException( - "Stack source required. You must specify either 'workspaceConfig' or 'stackSource'"); - } if (stack.getWorkspaceConfig() == null) { throw new BadRequestException("Workspace config required"); } diff --git a/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/spi/tck/StackDaoTest.java b/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/spi/tck/StackDaoTest.java index a9e24eb4d51..50f3b2976e9 100644 --- a/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/spi/tck/StackDaoTest.java +++ b/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/spi/tck/StackDaoTest.java @@ -35,7 +35,6 @@ import org.eclipse.che.api.workspace.server.model.impl.WorkspaceConfigImpl; import org.eclipse.che.api.workspace.server.model.impl.stack.StackComponentImpl; import org.eclipse.che.api.workspace.server.model.impl.stack.StackImpl; -import org.eclipse.che.api.workspace.server.model.impl.stack.StackSourceImpl; import org.eclipse.che.api.workspace.server.spi.StackDao; import org.eclipse.che.api.workspace.server.stack.image.StackIcon; import org.eclipse.che.commons.test.tck.TckListener; @@ -213,11 +212,6 @@ public void shouldUpdateStack() throws Exception { component.setName("new-name"); component.setVersion("new-version"); - // Updating source - final StackSourceImpl source = stack.getSource(); - source.setType("new-type"); - source.setOrigin("new-source"); - // Set a new icon stack.setStackIcon(new StackIcon("new-name", "new-media", "new-data".getBytes())); @@ -302,7 +296,6 @@ private static StackImpl createStack(String id, String name) { asList( new StackComponentImpl(id + "-component1", id + "-component1-version"), new StackComponentImpl(id + "-component2", id + "-component2-version"))) - .setSource(new StackSourceImpl(id + "-type", id + "-origin")) .setStackIcon( new StackIcon(id + "-icon", id + "-media-type", "0x1234567890abcdef".getBytes())) .build(); diff --git a/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/stack/StackServiceTest.java b/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/stack/StackServiceTest.java index 4a24c08930b..88b72734db8 100644 --- a/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/stack/StackServiceTest.java +++ b/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/stack/StackServiceTest.java @@ -47,12 +47,10 @@ import org.eclipse.che.api.workspace.server.model.impl.WorkspaceConfigImpl; import org.eclipse.che.api.workspace.server.model.impl.stack.StackComponentImpl; import org.eclipse.che.api.workspace.server.model.impl.stack.StackImpl; -import org.eclipse.che.api.workspace.server.model.impl.stack.StackSourceImpl; import org.eclipse.che.api.workspace.server.spi.StackDao; import org.eclipse.che.api.workspace.server.stack.image.StackIcon; import org.eclipse.che.api.workspace.shared.dto.stack.StackComponentDto; import org.eclipse.che.api.workspace.shared.dto.stack.StackDto; -import org.eclipse.che.api.workspace.shared.dto.stack.StackSourceDto; import org.eclipse.che.api.workspace.shared.stack.Stack; import org.eclipse.che.api.workspace.shared.stack.StackComponent; import org.eclipse.che.commons.env.EnvironmentContext; @@ -119,11 +117,9 @@ public class StackServiceTest { private StackDto stackDto; private StackImpl stackImpl; private StackImpl foreignStack; - private StackSourceImpl stackSourceImpl; private List componentsImpl; private StackIcon stackIcon; - private StackSourceDto stackSourceDto; private List componentsDto; @Mock StackDao stackDao; @@ -141,7 +137,6 @@ public void setUp() throws NoSuchFieldException, IllegalAccessException { byte[] fileContent = STACK_ID.getBytes(); stackIcon = new StackIcon(ICON_MEDIA_TYPE, "image/svg+xml", fileContent); componentsImpl = singletonList(new StackComponentImpl(COMPONENT_NAME, COMPONENT_VERSION)); - stackSourceImpl = new StackSourceImpl(SOURCE_TYPE, SOURCE_ORIGIN); CommandImpl command = new CommandImpl(COMMAND_NAME, COMMAND_LINE, COMMAND_TYPE); EnvironmentImpl environment = new EnvironmentImpl(null, null); @@ -153,7 +148,6 @@ public void setUp() throws NoSuchFieldException, IllegalAccessException { .setEnvironments(singletonMap(ENVIRONMENT_NAME, environment)) .build(); - stackSourceDto = newDto(StackSourceDto.class).withType(SOURCE_TYPE).withOrigin(SOURCE_ORIGIN); StackComponentDto stackComponentDto = newDto(StackComponentDto.class).withName(COMPONENT_NAME).withVersion(COMPONENT_VERSION); componentsDto = singletonList(stackComponentDto); @@ -167,7 +161,6 @@ public void setUp() throws NoSuchFieldException, IllegalAccessException { .withScope(SCOPE) .withCreator(CREATOR) .withTags(tags) - .withSource(stackSourceDto) .withComponents(componentsDto); stackImpl = @@ -178,7 +171,6 @@ public void setUp() throws NoSuchFieldException, IllegalAccessException { .setScope(SCOPE) .setCreator(CREATOR) .setTags(tags) - .setSource(stackSourceImpl) .setComponents(componentsImpl) .setWorkspaceConfig(workspaceConfig) .setStackIcon(stackIcon) @@ -192,7 +184,6 @@ public void setUp() throws NoSuchFieldException, IllegalAccessException { .setScope(SCOPE) .setCreator(FOREIGN_CREATOR) .setTags(tags) - .setSource(stackSourceImpl) .setComponents(componentsImpl) .setWorkspaceConfig(workspaceConfig) .setStackIcon(stackIcon) @@ -230,8 +221,6 @@ public void newStackShouldBeCreatedForUser() throws ConflictException, ServerExc assertEquals(stackDtoDescriptor.getComponents(), stackDto.getComponents()); - assertEquals(stackDtoDescriptor.getSource(), stackDto.getSource()); - assertEquals(stackDtoDescriptor.getScope(), stackDto.getScope()); assertEquals(stackDtoDescriptor.getLinks().size(), 2); @@ -255,8 +244,6 @@ public void newStackShouldBeCreatedForUser() throws ConflictException, ServerExc // public void shouldThrowBadRequestExceptionOnCreateStackWithEmptyName() { // StackComponentDto stackComponentDto = // newDto(StackComponentDto.class).withName("Java").withVersion("1.8.45"); - // StackSourceDto stackSourceDto = - // newDto(StackSourceDto.class).withType("image").withOrigin("codenvy/ubuntu_jdk8"); // StackDto stackDto = newDto(StackDto.class).withId(USER_ID) // .withDescription("") // .withScope("Simple java stack for generation @@ -265,7 +252,6 @@ public void newStackShouldBeCreatedForUser() throws ConflictException, ServerExc // .withCreator("che") // // .withComponents(singletonList(stackComponentDto)) - // .withSource(stackSourceDto); // // Response response = given().auth() // .basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD) @@ -303,8 +289,6 @@ public void stackByIdShouldBeReturned() throws NotFoundException, ServerExceptio result.getComponents().get(0).getName(), stackImpl.getComponents().get(0).getName()); assertEquals( result.getComponents().get(0).getVersion(), stackImpl.getComponents().get(0).getVersion()); - assertEquals(result.getSource().getType(), stackImpl.getSource().getType()); - assertEquals(result.getSource().getOrigin(), stackImpl.getSource().getOrigin()); assertEquals(result.getCreator(), stackImpl.getCreator()); } @@ -321,7 +305,6 @@ public void stackShouldBeUpdated() throws NotFoundException, ServerException, Co .withScope(updatedScope) .withCreator(CREATOR) .withTags(tags) - .withSource(stackSourceDto) .withComponents(componentsDto); StackImpl updateStack = new StackImpl(stackImpl); @@ -354,8 +337,6 @@ public void stackShouldBeUpdated() throws NotFoundException, ServerException, Co assertEquals( result.getComponents().get(0).getVersion(), updatedStackDto.getComponents().get(0).getVersion()); - assertEquals(result.getSource().getType(), updatedStackDto.getSource().getType()); - assertEquals(result.getSource().getOrigin(), updatedStackDto.getSource().getOrigin()); assertEquals(result.getCreator(), updatedStackDto.getCreator()); verify(stackDao).update(any()); @@ -374,7 +355,6 @@ public void creatorShouldNotBeUpdated() .withScope(SCOPE) .withCreator("creator changed") .withTags(tags) - .withSource(stackSourceDto) .withComponents(componentsDto); when(stackDao.getById(anyString())).thenReturn(foreignStack); @@ -403,8 +383,6 @@ public void creatorShouldNotBeUpdated() assertEquals( result.getComponents().get(0).getVersion(), updatedStackDto.getComponents().get(0).getVersion()); - assertEquals(result.getSource().getType(), updatedStackDto.getSource().getType()); - assertEquals(result.getSource().getOrigin(), updatedStackDto.getSource().getOrigin()); assertEquals(result.getCreator(), FOREIGN_CREATOR); verify(stackDao).update(any()); diff --git a/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/stack/StackValidatorTest.java b/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/stack/StackValidatorTest.java index 5034fd24ef2..7a6d840ee70 100644 --- a/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/stack/StackValidatorTest.java +++ b/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/stack/StackValidatorTest.java @@ -21,7 +21,6 @@ import org.eclipse.che.api.workspace.shared.dto.WorkspaceConfigDto; import org.eclipse.che.api.workspace.shared.dto.stack.StackComponentDto; import org.eclipse.che.api.workspace.shared.dto.stack.StackDto; -import org.eclipse.che.api.workspace.shared.dto.stack.StackSourceDto; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.testng.MockitoTestNGListener; @@ -101,11 +100,6 @@ public void shouldNotValidateIfStackScopeIsNotGeneralOrAdvanced() throws Excepti validator.check(createStack().withScope("not-valid")); } - @Test - public void shouldValidateIfSourceIsWorkspaceConfigAndStackSourceIsNull() throws Exception { - validator.check(createStack().withSource(null)); - } - @Test( expectedExceptions = BadRequestException.class, expectedExceptionsMessageRegExp = "Workspace config required" @@ -114,15 +108,6 @@ public void shouldValidateIfSourceIsStackSourceAndWorkspaceConfigIsNull() throws validator.check(createStack().withWorkspaceConfig(null)); } - @Test( - expectedExceptions = BadRequestException.class, - expectedExceptionsMessageRegExp = - "Stack source required. You must specify either 'workspaceConfig' or 'stackSource'" - ) - public void shouldNotValidateIfWorkspaceConfigAndSourceAreNull() throws Exception { - validator.check(createStack().withSource(null).withWorkspaceConfig(null)); - } - @Test public void shouldNotcheck() throws Exception { validator.check(createStack()); @@ -137,8 +122,6 @@ private static StackDto createStack() { .withCreator("user123") .withTags(new ArrayList<>(Collections.singletonList("latest"))) .withWorkspaceConfig(newDto(WorkspaceConfigDto.class)) - .withSource( - newDto(StackSourceDto.class).withType("recipe").withOrigin("FROM codenvy/ubuntu_jdk8")) .withComponents( new ArrayList<>( Collections.singletonList( diff --git a/wsmaster/che-core-api-workspace/src/test/resources/stacks.json b/wsmaster/che-core-api-workspace/src/test/resources/stacks.json index 898373251f4..5436f78e2ef 100644 --- a/wsmaster/che-core-api-workspace/src/test/resources/stacks.json +++ b/wsmaster/che-core-api-workspace/src/test/resources/stacks.json @@ -28,10 +28,6 @@ "version": "8.0.24" } ], - "source": { - "type": "image", - "origin": "codenvy/ubuntu_jdk8" - }, "workspaceConfig": { "environments": { "default" : { @@ -111,10 +107,6 @@ "version": "---" } ], - "source": { - "type": "image", - "origin": "codenvy/node" - }, "workspaceConfig": { "environments": { "default" : { @@ -191,10 +183,6 @@ "version": "---" } ], - "source": { - "type": "image", - "origin": "codenvy/node" - }, "workspaceConfig": { "environments": { "default" : { @@ -271,10 +259,6 @@ "version": "---" } ], - "source": { - "type": "image", - "origin": "codenvy/node" - }, "workspaceConfig": { "environments": { "default" : { @@ -351,10 +335,6 @@ "version": "---" } ], - "source": { - "type": "image", - "origin": "codenvy/node" - }, "workspaceConfig": { "environments": { "default" : { diff --git a/wsmaster/che-core-sql-schema/src/main/resources/che-schema/6.0.0/12__remove_stack_sources.sql b/wsmaster/che-core-sql-schema/src/main/resources/che-schema/6.0.0/12__remove_stack_sources.sql new file mode 100644 index 00000000000..eff01d50864 --- /dev/null +++ b/wsmaster/che-core-sql-schema/src/main/resources/che-schema/6.0.0/12__remove_stack_sources.sql @@ -0,0 +1,13 @@ +-- +-- Copyright (c) 2012-2018 Red Hat, Inc. +-- All rights reserved. This program and the accompanying materials +-- are made available under the terms of the Eclipse Public License v1.0 +-- which accompanies this distribution, and is available at +-- http://www.eclipse.org/legal/epl-v10.html +-- +-- Contributors: +-- Red Hat, Inc. - initial API and implementation +-- + +ALTER TABLE stack DROP COLUMN type; +ALTER TABLE stack DROP COLUMN origin; diff --git a/wsmaster/integration-tests/cascade-removal/src/test/java/org/eclipse/che/core/db/jpa/TestObjectsFactory.java b/wsmaster/integration-tests/cascade-removal/src/test/java/org/eclipse/che/core/db/jpa/TestObjectsFactory.java index 3626ff60b21..97cd598f6bb 100644 --- a/wsmaster/integration-tests/cascade-removal/src/test/java/org/eclipse/che/core/db/jpa/TestObjectsFactory.java +++ b/wsmaster/integration-tests/cascade-removal/src/test/java/org/eclipse/che/core/db/jpa/TestObjectsFactory.java @@ -34,7 +34,6 @@ import org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl; import org.eclipse.che.api.workspace.server.model.impl.stack.StackComponentImpl; import org.eclipse.che.api.workspace.server.model.impl.stack.StackImpl; -import org.eclipse.che.api.workspace.server.model.impl.stack.StackSourceImpl; import org.eclipse.che.api.workspace.server.stack.image.StackIcon; /** @@ -149,7 +148,6 @@ public static StackImpl createStack(String id, String name) { asList( new StackComponentImpl(id + "-component1", id + "-component1-version"), new StackComponentImpl(id + "-component2", id + "-component2-version"))) - .setSource(new StackSourceImpl(id + "-type", id + "-origin")) .setStackIcon( new StackIcon(id + "-icon", id + "-media-type", "0x1234567890abcdef".getBytes())) .build();