You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by md...@apache.org on 2014/04/29 18:35:11 UTC
git commit: ACCUMULO-2755 fix merge
Repository: accumulo
Updated Branches:
refs/heads/master eb6028b9b -> f20f629f6
ACCUMULO-2755 fix merge
The new shell module
Means this test to move
Knowing your home: zen.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/f20f629f
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/f20f629f
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/f20f629f
Branch: refs/heads/master
Commit: f20f629f6230c2c2669d0c23b12d830a9d9c1aca
Parents: eb6028b
Author: Mike Drob <md...@cloudera.com>
Authored: Tue Apr 29 12:33:46 2014 -0400
Committer: Mike Drob <md...@cloudera.com>
Committed: Tue Apr 29 12:33:46 2014 -0400
----------------------------------------------------------------------
.../util/shell/command/HistoryCommandTest.java | 90 --------------------
.../shell/command/HistoryCommandTest.java | 90 ++++++++++++++++++++
2 files changed, 90 insertions(+), 90 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f20f629f/core/src/test/java/org/apache/accumulo/core/util/shell/command/HistoryCommandTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/util/shell/command/HistoryCommandTest.java b/core/src/test/java/org/apache/accumulo/core/util/shell/command/HistoryCommandTest.java
deleted file mode 100644
index 4d379cc..0000000
--- a/core/src/test/java/org/apache/accumulo/core/util/shell/command/HistoryCommandTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.core.util.shell.command;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-import jline.console.ConsoleReader;
-import jline.console.history.History;
-import jline.console.history.MemoryHistory;
-
-import org.apache.accumulo.core.util.shell.Shell;
-import org.apache.accumulo.core.util.shell.commands.HistoryCommand;
-import org.apache.commons.cli.CommandLine;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Test;
-
-public class HistoryCommandTest {
-
- HistoryCommand command;
- CommandLine cl;
-
- ByteArrayOutputStream baos;
- ConsoleReader reader;
- Shell shell;
-
- @Before
- public void setUp() throws Exception {
- command = new HistoryCommand();
- command.getOptions(); // Make sure everything is initialized
-
- cl = createMock(CommandLine.class);
- expect(cl.hasOption("c")).andReturn(false);
- expect(cl.hasOption("np")).andReturn(true);
- replay(cl);
-
- History history = new MemoryHistory();
- history.add("foo");
- history.add("bar");
-
- baos = new ByteArrayOutputStream();
-
- String input = String.format("!1%n"); // Construct a platform dependent new-line
- reader = new ConsoleReader(new ByteArrayInputStream(input.getBytes()), baos);
- reader.setHistory(history);
-
- shell = new Shell(reader, null);
- }
-
- @Test
- public void testCorrectNumbering() throws IOException {
- command.execute("", cl, shell);
- reader.flush();
-
- assertTrue(baos.toString().contains("2: bar"));
- }
-
- @Test
- public void testEventExpansion() throws IOException {
- // If we use an unsupported terminal, then history expansion doesn't work because JLine can't do magic buffer manipulations.
- // This has been observed to be the case on certain versions of Eclipse. However, mvn is usually fine.
- Assume.assumeTrue(reader.getTerminal().isSupported());
-
- reader.readLine();
-
- assertTrue(baos.toString().trim().endsWith("foo"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f20f629f/shell/src/test/java/org/apache/accumulo/shell/command/HistoryCommandTest.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/accumulo/shell/command/HistoryCommandTest.java b/shell/src/test/java/org/apache/accumulo/shell/command/HistoryCommandTest.java
new file mode 100644
index 0000000..fcb76db
--- /dev/null
+++ b/shell/src/test/java/org/apache/accumulo/shell/command/HistoryCommandTest.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.shell.command;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import jline.console.ConsoleReader;
+import jline.console.history.History;
+import jline.console.history.MemoryHistory;
+
+import org.apache.accumulo.shell.Shell;
+import org.apache.accumulo.shell.commands.HistoryCommand;
+import org.apache.commons.cli.CommandLine;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.Test;
+
+public class HistoryCommandTest {
+
+ HistoryCommand command;
+ CommandLine cl;
+
+ ByteArrayOutputStream baos;
+ ConsoleReader reader;
+ Shell shell;
+
+ @Before
+ public void setUp() throws Exception {
+ command = new HistoryCommand();
+ command.getOptions(); // Make sure everything is initialized
+
+ cl = createMock(CommandLine.class);
+ expect(cl.hasOption("c")).andReturn(false);
+ expect(cl.hasOption("np")).andReturn(true);
+ replay(cl);
+
+ History history = new MemoryHistory();
+ history.add("foo");
+ history.add("bar");
+
+ baos = new ByteArrayOutputStream();
+
+ String input = String.format("!1%n"); // Construct a platform dependent new-line
+ reader = new ConsoleReader(new ByteArrayInputStream(input.getBytes()), baos);
+ reader.setHistory(history);
+
+ shell = new Shell(reader, null);
+ }
+
+ @Test
+ public void testCorrectNumbering() throws IOException {
+ command.execute("", cl, shell);
+ reader.flush();
+
+ assertTrue(baos.toString().contains("2: bar"));
+ }
+
+ @Test
+ public void testEventExpansion() throws IOException {
+ // If we use an unsupported terminal, then history expansion doesn't work because JLine can't do magic buffer manipulations.
+ // This has been observed to be the case on certain versions of Eclipse. However, mvn is usually fine.
+ Assume.assumeTrue(reader.getTerminal().isSupported());
+
+ reader.readLine();
+
+ assertTrue(baos.toString().trim().endsWith("foo"));
+ }
+
+}