Search in sources :

Example 1 with WorkspaceRemovedEvent

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

the class WorkspaceSshKeysTest method shouldRemoveSshKeyPairWhenWorkspaceIsRemoved.

/**
     * Ensure that when a workspace is removed, any associated ssh keypair is removed on sshManager
     */
@Test
public void shouldRemoveSshKeyPairWhenWorkspaceIsRemoved() throws Exception {
    // given
    workspaceRemovedEventEventSubscriber.onEvent(new WorkspaceRemovedEvent(this.workspace));
    // then
    verify(sshManager).removePair(eq(USER_ID), eq("workspace"), eq(WORKSPACE_ID));
}
Also used : WorkspaceRemovedEvent(org.eclipse.che.api.workspace.server.event.WorkspaceRemovedEvent) Test(org.testng.annotations.Test)

Example 2 with WorkspaceRemovedEvent

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

the class JpaWorkspaceDao method remove.

@Override
public void remove(String id) throws ServerException {
    requireNonNull(id, "Required non-null id");
    try {
        Optional<WorkspaceImpl> workspaceOpt = doRemove(id);
        workspaceOpt.ifPresent(workspace -> eventService.publish(new WorkspaceRemovedEvent(workspace)));
    } catch (RuntimeException x) {
        throw new ServerException(x.getLocalizedMessage(), x);
    }
}
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.server.event.WorkspaceRemovedEvent)

Aggregations

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