@Test public void shouldRemoveProjectionViaFederationManager() throws Exception { testRoot.addNode("child1"); session.save(); federationManager.createProjection( "/testRoot", SOURCE_NAME, MockConnector.DOC1_LOCATION, "federated1"); federationManager.createProjection( "/testRoot", SOURCE_NAME, MockConnector.DOC2_LOCATION, "federated2"); federationManager.removeProjection("/testRoot/federated2"); assertNodeFound("/testRoot/federated1"); assertNodeFound("/testRoot/child1"); assertNodeNotFound("/testRoot/federated2"); federationManager.removeProjection("/testRoot/federated1"); assertNodeNotFound("/testRoot/federation1"); assertNodeFound("/testRoot/child1"); }
@Test public void removeProjectionViaFederationManagerShouldNotDeleteExternalNode() throws Exception { federationManager.createProjection( "/testRoot", SOURCE_NAME, MockConnector.DOC2_LOCATION, "projection1"); federationManager.createProjection( "/testRoot", SOURCE_NAME, MockConnector.DOC2_LOCATION, "projection2"); federationManager.removeProjection("/testRoot/projection1"); assertNodeFound("/testRoot/projection2/federated3"); }
@Test(expected = PathNotFoundException.class) public void shouldNotRemoveProjectionIfPathInvalid() throws Exception { federationManager.createProjection( "/testRoot", SOURCE_NAME, MockConnector.DOC1_LOCATION, "federated1"); federationManager.removeProjection("/testRoot/federated"); }
@Test(expected = IllegalArgumentException.class) public void shouldNotRemoveProjectionUsingRootPath() throws Exception { federationManager.createProjection( "/testRoot", SOURCE_NAME, MockConnector.DOC1_LOCATION, "federated1"); federationManager.removeProjection("/"); }