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));
}
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;
}
Aggregations