fluo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] keith-turner commented on a change in pull request #1043: FLUO-1002 Create integration test for `FluoAdmin.remove()`
Date Mon, 09 Jul 2018 13:55:38 GMT
keith-turner commented on a change in pull request #1043: FLUO-1002 Create integration test
for `FluoAdmin.remove()`
URL: https://github.com/apache/fluo/pull/1043#discussion_r201009577
 
 

 ##########
 File path: modules/integration/src/test/java/org/apache/fluo/integration/client/FluoAdminImplIT.java
 ##########
 @@ -184,4 +191,72 @@ public void testInitializeLongChroot() throws Exception {
     }
   }
 
+  @Test
+  public void testRemove() throws Exception {
+
+    try (FluoAdmin admin = new FluoAdminImpl(config)) {
+      admin.remove();
+      fail("This should fail with the oracle server running");
+    } catch (FluoException e) {
+    }
+
+    // write/verify some data
+    String row = "Logicians";
+    Column fname = new Column("name", "first");
+    Column lname = new Column("name", "last");
+
+    try (FluoClient client = FluoFactory.newClient(config)) {
+      try (Transaction tx = client.newTransaction()) {
+        tx.set(row, fname, "Kurt");
+        tx.set(row, lname, "Godel");
+        tx.commit();
+      }
+      // read it for sanity
+      try (Snapshot snap = client.newSnapshot()) {
+        System.out.println("First name: " + snap.gets(row, fname));
+        System.out.println("Last name: " + snap.gets(row, lname));
+        System.out.println("Iterables size: " + Iterables.size(snap.scanner().build()));
+      }
+    }
+
+    oserver.stop();
+
+    try (FluoAdmin admin = new FluoAdminImpl(config)) {
+      admin.remove(); // pass with oracle stopped
+    }
+
+    try (FluoAdmin admin = new FluoAdminImpl(config)) {
+      InitializationOptions opts =
+          new InitializationOptions().setClearTable(false).setClearZookeeper(false);
+      admin.initialize(opts); 
+    }
+
+    oserver.start();
 
 Review comment:
   @kpm1985  I looked into this and found the problem.  The oserver object has an internal
Environment object which caches the application ID from before the init.  To get around this,
need to create a completely new Oracle Server. That can be done with the the following code.
   
   ```java
      //this will force reread of all info from zookeeper.
       Environment env2 = new Environment(config);
       OracleServer oserver2 = new OracleServer(env2);
       oserver2.start();
   ```
   
   At the end of the test, can do the following :
   
   ```java
       oserver2.stop();
       env2.close();
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message