-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REP-45 Add option to delete replication data through UI
- Loading branch information
1 parent
f017cb0
commit 65c3768
Showing
58 changed files
with
1,234 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
.../org/codice/ditto/replication/admin/query/replications/persist/DeleteReplicationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/** | ||
* Copyright (c) Connexta | ||
* | ||
* <p>This is free software: you can redistribute it and/or modify it under the terms of the GNU | ||
* Lesser General Public License as published by the Free Software Foundation, either version 3 of | ||
* the License, or any later version. | ||
* | ||
* <p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. A copy of the GNU Lesser General Public | ||
* License is distributed along with this program and can be found at | ||
* <http://www.gnu.org/licenses/lgpl.html>. | ||
*/ | ||
package org.codice.ditto.replication.admin.query.replications.persist; | ||
|
||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.mockito.Mockito.times; | ||
import static org.mockito.Mockito.verify; | ||
import static org.mockito.Mockito.when; | ||
|
||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import org.codice.ddf.admin.api.report.ErrorMessage; | ||
import org.codice.ddf.admin.api.report.FunctionReport; | ||
import org.codice.ditto.replication.admin.query.ReplicationMessages; | ||
import org.codice.ditto.replication.admin.query.ReplicationUtils; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.Mock; | ||
import org.mockito.runners.MockitoJUnitRunner; | ||
|
||
@RunWith(MockitoJUnitRunner.class) | ||
public class DeleteReplicationTest { | ||
|
||
private static final String ID = "abc123"; | ||
|
||
DeleteReplication deleteReplication; | ||
|
||
Map<String, Object> args; | ||
|
||
@Mock ReplicationUtils utils; | ||
|
||
@Before | ||
public void setup() { | ||
deleteReplication = new DeleteReplication(utils); | ||
args = new HashMap<>(); | ||
args.put("id", ID); | ||
} | ||
|
||
@Test | ||
public void testValidateNoConfig() { | ||
when(utils.configExists(ID)).thenReturn(false); | ||
FunctionReport report = | ||
deleteReplication.execute(args, Collections.singletonList(DeleteReplication.FIELD_NAME)); | ||
assertThat(report.getErrorMessages().size(), is(1)); | ||
assertThat( | ||
((ErrorMessage) report.getErrorMessages().get(0)).getCode(), | ||
is(ReplicationMessages.CONFIG_DOES_NOT_EXIST)); | ||
} | ||
|
||
@Test | ||
public void testGetFunctionErrorCodes() { | ||
assertThat( | ||
deleteReplication | ||
.getFunctionErrorCodes() | ||
.contains(ReplicationMessages.CONFIG_DOES_NOT_EXIST), | ||
is(true)); | ||
} | ||
|
||
@Test | ||
public void testDeleteDataArgDefaultsToFalse() { | ||
when(utils.configExists(ID)).thenReturn(true); | ||
FunctionReport report = | ||
deleteReplication.execute(args, Collections.singletonList(DeleteReplication.FIELD_NAME)); | ||
assertThat(report.getErrorMessages().size(), is(0)); | ||
verify(utils, times(1)).markConfigDeleted(ID, false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...on-api-impl/src/main/java/org/codice/ditto/replication/api/impl/MetacardConfigLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Oops, something went wrong.