You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2013/10/08 19:24:07 UTC

[2/3] git commit: ACCUMULO-1566 Simple unit test to ensure that values work as expected.

ACCUMULO-1566 Simple unit test to ensure that values work as expected.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ff58f6b1
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ff58f6b1
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ff58f6b1

Branch: refs/heads/master
Commit: ff58f6b15c36f5f33d0a296c9806b24ad8a94ab3
Parents: 0d85d60
Author: Josh Elser <el...@apache.org>
Authored: Mon Oct 7 23:30:18 2013 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Mon Oct 7 23:30:18 2013 -0400

----------------------------------------------------------------------
 .../core/client/impl/ScannerImplTest.java       | 50 ++++++++++++++++++++
 1 file changed, 50 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/ff58f6b1/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerImplTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerImplTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerImplTest.java
new file mode 100644
index 0000000..311bbf8
--- /dev/null
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerImplTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.client.impl;
+
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.client.mock.MockInstance;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.security.Credentials;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * 
+ */
+public class ScannerImplTest {
+
+  @Test
+  public void testValidReadaheadValues() {
+    MockInstance instance = new MockInstance();
+    Scanner s = new ScannerImpl(instance, new Credentials("root", new PasswordToken("")), "foo", new Authorizations());
+    s.setReadaheadThreshold(0);
+    s.setReadaheadThreshold(10);
+    s.setReadaheadThreshold(Long.MAX_VALUE);
+    
+    Assert.assertEquals(Long.MAX_VALUE, s.getReadaheadThreshold());
+  }
+  
+  @Test(expected = IllegalArgumentException.class)
+  public void testInValidReadaheadValues() {
+    MockInstance instance = new MockInstance();
+    Scanner s = new ScannerImpl(instance, new Credentials("root", new PasswordToken("")), "foo", new Authorizations());
+    s.setReadaheadThreshold(-1);
+  }
+
+}