keith-turner commented on a change in pull request #999: Create 'fluo remove'
command #991
URL: https://github.com/apache/fluo/pull/999#discussion_r161261361
##########
File path: modules/api/src/main/java/org/apache/fluo/api/client/FluoAdmin.java
##########
@@ -119,6 +119,15 @@ public TableExistsException() {
void initialize(InitializationOptions opts)
throws AlreadyInitializedException, TableExistsException;
+ /**
+ * Removes Fluo application, Accumulo table and shared configuration in
Zookeeper. Shared configuration
+ * consists of all properties except those with
+ * {@value org.apache.fluo.api.config.FluoConfiguration#CONNECTION_PREFIX}
prefix.
+ *
+ * @since 1.2.0
+ */
+ void remove();
Review comment:
A good place to add a test for remove would be the following
https://github.com/apache/fluo/blob/dbad51d8a0763dc6ee21cee30d446c40e94c9ed8/modules/integration/src/test/java/org/apache/fluo/integration/client/FluoAdminImplIT.java
You can see examples of initialization in exiting test
https://github.com/apache/fluo/blob/dbad51d8a0763dc6ee21cee30d446c40e94c9ed8/modules/integration/src/test/java/org/apache/fluo/integration/client/FluoAdminImplIT.java#L62
This test has an example of stoping the oracle. Remove should fail before
stopping the oracle and succeed after.
https://github.com/apache/fluo/blob/dbad51d8a0763dc6ee21cee30d446c40e94c9ed8/modules/integration/src/test/java/org/apache/fluo/integration/client/FluoAdminImplIT.java#L155
Below is outline of what I think a test may look like. Not sure if it
compiles. Also not sure if oserver.start() will have problems after reinit.
```java
@Test
public void testRemove() throws Exception {
try (FluoAdmin admin = new FluoAdminImpl(config)) {
admin.remove();
Assert.assertFail("expected remove to fail");
}catch(FluoException e) {
}
//TODO write some data
oserver.stop();
try (FluoAdmin admin = new FluoAdminImpl(config)) {
admin.remove();
}
try (FluoAdmin admin = new FluoAdminImpl(config)) {
//should succeed w/o clearing
InitializationOptions opts =
new
InitializationOptions().setClearZookeeper(false).setClearTable(false);
admin.initialize(opts);
}
//not sure if this will work properly
oserver.start();
//TODO verify empty
//TODO write data
//TODO read data
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services