Search in sources :

Example 6 with StackIcon

use of org.eclipse.che.api.workspace.server.stack.image.StackIcon in project che by eclipse.

the class StackDaoTest method shouldUpdateStack.

@Test(dependsOnMethods = "shouldGetById")
public void shouldUpdateStack() throws Exception {
    final StackImpl stack = stacks[0];
    stack.setName("new-name");
    stack.setCreator("new-creator");
    stack.setDescription("new-description");
    stack.setScope("new-scope");
    stack.getTags().clear();
    stack.getTags().add("new-tag");
    // Remove an existing component
    stack.getComponents().remove(1);
    // Add a new component
    stack.getComponents().add(new StackComponentImpl("component3", "component3-version"));
    // Update an existing component
    final StackComponentImpl component = stack.getComponents().get(0);
    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()));
    stackDao.update(stack);
    assertEquals(stackDao.getById(stack.getId()), new StackImpl(stack));
}
Also used : StackComponentImpl(org.eclipse.che.api.workspace.server.model.impl.stack.StackComponentImpl) StackImpl(org.eclipse.che.api.workspace.server.model.impl.stack.StackImpl) StackIcon(org.eclipse.che.api.workspace.server.stack.image.StackIcon) StackSourceImpl(org.eclipse.che.api.workspace.server.model.impl.stack.StackSourceImpl) Test(org.testng.annotations.Test)

Example 7 with StackIcon

use of org.eclipse.che.api.workspace.server.stack.image.StackIcon in project che by eclipse.

the class StackDaoTest method createStack.

private static StackImpl createStack(String id, String name) {
    final StackImpl stack = StackImpl.builder().setId(id).setName(name).setCreator("user123").setDescription(id + "-description").setScope(id + "-scope").setTags(asList(id + "-tag1", id + "-tag2")).setComponents(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();
    final WorkspaceConfigImpl config = createWorkspaceConfig("test");
    stack.setWorkspaceConfig(config);
    return stack;
}
Also used : StackComponentImpl(org.eclipse.che.api.workspace.server.model.impl.stack.StackComponentImpl) StackImpl(org.eclipse.che.api.workspace.server.model.impl.stack.StackImpl) StackIcon(org.eclipse.che.api.workspace.server.stack.image.StackIcon) WorkspaceConfigImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceConfigImpl) StackSourceImpl(org.eclipse.che.api.workspace.server.model.impl.stack.StackSourceImpl)

Aggregations

StackIcon (org.eclipse.che.api.workspace.server.stack.image.StackIcon)7 StackImpl (org.eclipse.che.api.workspace.server.model.impl.stack.StackImpl)4 GenerateLink (org.eclipse.che.api.core.rest.annotations.GenerateLink)3 StackComponentImpl (org.eclipse.che.api.workspace.server.model.impl.stack.StackComponentImpl)3 StackSourceImpl (org.eclipse.che.api.workspace.server.model.impl.stack.StackSourceImpl)3 ApiOperation (io.swagger.annotations.ApiOperation)2 ApiResponses (io.swagger.annotations.ApiResponses)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 WorkspaceConfigImpl (org.eclipse.che.api.workspace.server.model.impl.WorkspaceConfigImpl)2 IOException (java.io.IOException)1 Field (java.lang.reflect.Field)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 Consumes (javax.ws.rs.Consumes)1 GET (javax.ws.rs.GET)1 POST (javax.ws.rs.POST)1 UriBuilder (javax.ws.rs.core.UriBuilder)1 FileItem (org.apache.commons.fileupload.FileItem)1 NotFoundException (org.eclipse.che.api.core.NotFoundException)1