accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject svn commit: r1479211 - in /accumulo/trunk: ./ assemble/ core/ core/src/main/java/org/apache/accumulo/core/client/mock/ core/src/main/java/org/apache/accumulo/core/util/shell/ core/src/test/java/org/apache/accumulo/core/util/shell/ core/src/test/resourc...
Date Sat, 04 May 2013 22:44:19 GMT
Author: ctubbsii
Date: Sat May  4 22:44:19 2013
New Revision: 1479211

URL: http://svn.apache.org/r1479211
Log:
ACCUMULO-1348 merged patch to trunk

Added:
    accumulo/trunk/core/src/test/resources/shelltest.txt
      - copied unchanged from r1479204, accumulo/branches/1.5/core/src/test/resources/shelltest.txt
Modified:
    accumulo/trunk/   (props changed)
    accumulo/trunk/assemble/   (props changed)
    accumulo/trunk/core/   (props changed)
    accumulo/trunk/core/pom.xml
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockShell.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java
    accumulo/trunk/examples/   (props changed)
    accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java   (props changed)
    accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java 
 (props changed)
    accumulo/trunk/pom.xml   (props changed)
    accumulo/trunk/server/   (props changed)
    accumulo/trunk/src/   (props changed)

Propchange: accumulo/trunk/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5:r1479204

Propchange: accumulo/trunk/assemble/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/assemble:r1479204

Propchange: accumulo/trunk/core/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/core:r1479204

Modified: accumulo/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/pom.xml?rev=1479211&r1=1479210&r2=1479211&view=diff
==============================================================================
--- accumulo/trunk/core/pom.xml (original)
+++ accumulo/trunk/core/pom.xml Sat May  4 22:44:19 2013
@@ -109,6 +109,19 @@
     </dependency>
   </dependencies>
   <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.rat</groupId>
+          <artifactId>apache-rat-plugin</artifactId>
+          <configuration>
+            <excludes>
+              <exclude>src/test/resources/shelltest.txt</exclude>
+            </excludes>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockShell.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockShell.java?rev=1479211&r1=1479210&r2=1479211&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockShell.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockShell.java
Sat May  4 22:44:19 2013
@@ -78,8 +78,13 @@ public class MockShell extends Shell {
     
     if (execFile != null) {
       java.util.Scanner scanner = new java.util.Scanner(new File(execFile));
-      while (scanner.hasNextLine())
-        execCommand(scanner.nextLine(), true, isVerbose());
+      try {
+        while (scanner.hasNextLine() && !hasExited()) {
+          execCommand(scanner.nextLine(), true, isVerbose());
+        }
+      } finally {
+        scanner.close();
+      }
     } else if (execCommand != null) {
       for (String command : execCommand.split("\n")) {
         execCommand(command, true, isVerbose());

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java?rev=1479211&r1=1479210&r2=1479211&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java Sat May
 4 22:44:19 2013
@@ -250,7 +250,7 @@ public class Shell extends ShellOptions 
     if (sysUser == null)
       sysUser = "root";
     String user = cl.getOptionValue(usernameOption.getOpt(), sysUser);
-
+    
     String passw = cl.getOptionValue(passwOption.getOpt(), null);
     tabCompletion = !cl.hasOption(tabCompleteOption.getLongOpt());
     String[] loginOptions = cl.getOptionValues(loginOption.getOpt());
@@ -265,13 +265,13 @@ public class Shell extends ShellOptions 
       
       if (loginOptions == null && cl.hasOption(tokenOption.getOpt()))
         throw new IllegalArgumentException("Must supply '-" + loginOption.getOpt() + "' option
with '-" + tokenOption.getOpt() + "' option");
-
+      
       if (passw != null && cl.hasOption(tokenOption.getOpt()))
         throw new IllegalArgumentException("Can not supply '-" + passwOption.getOpt() + "'
option with '-" + tokenOption.getOpt() + "' option");
-
+      
       if (user == null)
         throw new MissingArgumentException(usernameOption);
-
+      
       if (loginOptions != null && cl.hasOption(tokenOption.getOpt())) {
         Properties props = new Properties();
         for (String loginOption : loginOptions)
@@ -283,7 +283,7 @@ public class Shell extends ShellOptions 
         this.token = Class.forName(cl.getOptionValue(tokenOption.getOpt())).asSubclass(AuthenticationToken.class).newInstance();
         this.token.init(props);
       }
-
+      
       if (!cl.hasOption(fakeOption.getLongOpt())) {
         DistributedTrace.enable(instance, new ZooReader(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut()),
"shell", InetAddress.getLocalHost()
             .getHostName());
@@ -447,8 +447,9 @@ public class Shell extends ShellOptions 
     if (execFile != null) {
       java.util.Scanner scanner = new java.util.Scanner(new File(execFile));
       try {
-        while (scanner.hasNextLine())
+        while (scanner.hasNextLine() && !hasExited()) {
           execCommand(scanner.nextLine(), true, isVerbose());
+        }
       } finally {
         scanner.close();
       }

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java?rev=1479211&r1=1479210&r2=1479211&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java Sat
May  4 22:44:19 2013
@@ -167,7 +167,7 @@ public class ShellTest {
   public void userTest() throws Exception {
     Shell.log.debug("Starting user test --------------------------");
     // Test cannot be done via junit because createuser only prompts for password
-    //    exec("createuser root", false, "user exists");
+    // exec("createuser root", false, "user exists");
   }
   
   @Test
@@ -214,4 +214,12 @@ public class ShellTest {
     exec("# foo", true, "Unknown command", false);
     exec("- foo", true, "Unknown command", true);
   }
+  
+  @Test
+  public void execFileTest() throws IOException {
+    Shell.log.debug("Starting exec file test --------------------------");
+    shell.config("--fake", "-u", "test", "-p", "secret", "-f", "src/test/resources/shelltest.txt");
+    assertEquals(0, shell.start());
+    assertGoodExit("Unknown command", false);
+  }
 }

Propchange: accumulo/trunk/examples/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/examples:r1479204

Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:r1479204

Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java:r1479204

Propchange: accumulo/trunk/pom.xml
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/pom.xml:r1479204

Propchange: accumulo/trunk/server/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/server:r1479204

Propchange: accumulo/trunk/src/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/src:r1479204



Mime
View raw message