Search in sources :

Example 1 with WorkspaceRemovedEvent

use of org.eclipse.che.api.workspace.shared.event.WorkspaceRemovedEvent in project che-server by eclipse-che.

the class RemoveProjectOnWorkspaceRemoveTest method shouldInvokeDeleteIfManagedMethodOnWorkspaceRemovedEvent.

@Test
public void shouldInvokeDeleteIfManagedMethodOnWorkspaceRemovedEvent() throws Exception {
    removeProjectOnWorkspaceRemove.onEvent(new WorkspaceRemovedEvent(workspace));
    verify(projectFactory).deleteIfManaged(workspace);
}
Also used : WorkspaceRemovedEvent(org.eclipse.che.api.workspace.shared.event.WorkspaceRemovedEvent) Test(org.testng.annotations.Test)

Example 2 with WorkspaceRemovedEvent

use of org.eclipse.che.api.workspace.shared.event.WorkspaceRemovedEvent in project che-server by eclipse-che.

the class JpaWorkspaceDao method remove.

@Override
public Optional<WorkspaceImpl> remove(String id) throws ServerException {
    requireNonNull(id, "Required non-null id");
    Optional<WorkspaceImpl> workspaceOpt;
    try {
        workspaceOpt = doRemove(id);
        workspaceOpt.ifPresent(workspace -> eventService.publish(new WorkspaceRemovedEvent(workspace)));
    } catch (RuntimeException x) {
        throw new ServerException(x.getLocalizedMessage(), x);
    }
    return workspaceOpt;
}
Also used : WorkspaceImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl) ServerException(org.eclipse.che.api.core.ServerException) BeforeWorkspaceRemovedEvent(org.eclipse.che.api.workspace.server.event.BeforeWorkspaceRemovedEvent) WorkspaceRemovedEvent(org.eclipse.che.api.workspace.shared.event.WorkspaceRemovedEvent)

Example 3 with WorkspaceRemovedEvent

use of org.eclipse.che.api.workspace.shared.event.WorkspaceRemovedEvent in project che-server by eclipse-che.

the class RemoveNamespaceOnWorkspaceRemoveTest method shouldRemoveNamespaceIfManagedOnWorkspaceRemovedEventIfNamespaceIsManaged.

@Test
public void shouldRemoveNamespaceIfManagedOnWorkspaceRemovedEventIfNamespaceIsManaged() throws Exception {
    removeNamespaceOnWorkspaceRemove.onEvent(new WorkspaceRemovedEvent(workspace));
    verify(namespaceFactory).deleteIfManaged(eq(workspace));
}
Also used : WorkspaceRemovedEvent(org.eclipse.che.api.workspace.shared.event.WorkspaceRemovedEvent) Test(org.testng.annotations.Test)

Example 4 with WorkspaceRemovedEvent

use of org.eclipse.che.api.workspace.shared.event.WorkspaceRemovedEvent in project devspaces-images by redhat-developer.

the class RemoveProjectOnWorkspaceRemoveTest method shouldInvokeDeleteIfManagedMethodOnWorkspaceRemovedEvent.

@Test
public void shouldInvokeDeleteIfManagedMethodOnWorkspaceRemovedEvent() throws Exception {
    removeProjectOnWorkspaceRemove.onEvent(new WorkspaceRemovedEvent(workspace));
    verify(projectFactory).deleteIfManaged(workspace);
}
Also used : WorkspaceRemovedEvent(org.eclipse.che.api.workspace.shared.event.WorkspaceRemovedEvent) Test(org.testng.annotations.Test)

Example 5 with WorkspaceRemovedEvent

use of org.eclipse.che.api.workspace.shared.event.WorkspaceRemovedEvent in project devspaces-images by redhat-developer.

the class RemoveNamespaceOnWorkspaceRemoveTest method shouldRemoveNamespaceIfManagedOnWorkspaceRemovedEventIfNamespaceIsManaged.

@Test
public void shouldRemoveNamespaceIfManagedOnWorkspaceRemovedEventIfNamespaceIsManaged() throws Exception {
    removeNamespaceOnWorkspaceRemove.onEvent(new WorkspaceRemovedEvent(workspace));
    verify(namespaceFactory).deleteIfManaged(eq(workspace));
}
Also used : WorkspaceRemovedEvent(org.eclipse.che.api.workspace.shared.event.WorkspaceRemovedEvent) Test(org.testng.annotations.Test)

Aggregations

WorkspaceRemovedEvent (org.eclipse.che.api.workspace.shared.event.WorkspaceRemovedEvent)8 ServerException (org.eclipse.che.api.core.ServerException)4 BeforeWorkspaceRemovedEvent (org.eclipse.che.api.workspace.server.event.BeforeWorkspaceRemovedEvent)4 WorkspaceImpl (org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl)4 Test (org.testng.annotations.Test)4