accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [25/31] git commit: Merge branch '1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT
Date Sun, 24 Nov 2013 00:33:56 GMT
Merge branch '1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT


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

Branch: refs/heads/master
Commit: fae82828f562b4a0cdd5182cb103da20638d47c5
Parents: 3a703d7 6caa159
Author: Josh Elser <elserj@apache.org>
Authored: Sat Nov 23 02:08:26 2013 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Sat Nov 23 02:08:26 2013 -0500

----------------------------------------------------------------------
 .../core/client/mapreduce/RangeInputSplitTest.java  | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/fae82828/core/src/test/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplitTest.java
----------------------------------------------------------------------
diff --cc core/src/test/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplitTest.java
index 6da07a5,0000000..62ea27b
mode 100644,000000..100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplitTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplitTest.java
@@@ -1,89 -1,0 +1,105 @@@
++/*
++ * 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.mapreduce;
 +
 +import java.io.ByteArrayInputStream;
 +import java.io.ByteArrayOutputStream;
 +import java.io.DataInputStream;
 +import java.io.DataOutputStream;
 +import java.io.IOException;
 +import java.util.Arrays;
 +import java.util.HashSet;
 +import java.util.Set;
 +
 +import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 +import org.apache.accumulo.core.data.Key;
 +import org.apache.accumulo.core.data.Range;
 +import org.apache.accumulo.core.security.Authorizations;
 +import org.apache.accumulo.core.util.Pair;
 +import org.apache.hadoop.io.Text;
 +import org.apache.log4j.Level;
 +import org.junit.Assert;
 +import org.junit.Test;
 +
 +public class RangeInputSplitTest {
 +
 +  @Test
 +  public void testSimpleWritable() throws IOException {
 +    RangeInputSplit split = new RangeInputSplit(new Range(new Key("a"), new Key("b")), new
String[]{"localhost"});
 +    
 +    ByteArrayOutputStream baos = new ByteArrayOutputStream();
 +    DataOutputStream dos = new DataOutputStream(baos);
 +    split.write(dos);
 +    
 +    RangeInputSplit newSplit = new RangeInputSplit();
 +    
 +    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
 +    DataInputStream dis = new DataInputStream(bais);
 +    newSplit.readFields(dis);
 +    
 +    Assert.assertEquals(split.getRange(), newSplit.getRange());
 +    Assert.assertTrue(Arrays.equals(split.getLocations(), newSplit.getLocations()));
 +  }
 +
 +  @Test
 +  public void testAllFieldsWritable() throws IOException {
 +    RangeInputSplit split = new RangeInputSplit(new Range(new Key("a"), new Key("b")), new
String[]{"localhost"});
 +    
 +    Set<Pair<Text,Text>> fetchedColumns = new HashSet<Pair<Text,Text>>();
 +    
 +    fetchedColumns.add(new Pair<Text,Text>(new Text("colf1"), new Text("colq1")));
 +    fetchedColumns.add(new Pair<Text,Text>(new Text("colf2"), new Text("colq2")));
 +    
 +    split.setAuths(new Authorizations("foo"));
 +    split.setOffline(true);
 +    split.setIsolatedScan(true);
 +    split.setUsesLocalIterators(true);
 +    split.setFetchedColumns(fetchedColumns);
 +    split.setToken(new PasswordToken("password"));
 +    split.setPrincipal("root");
 +    split.setInstanceName("instance");
 +    split.setMockInstance(true);
 +    split.setZooKeepers("localhost");
 +    split.setLogLevel(Level.WARN);
 +    
 +    ByteArrayOutputStream baos = new ByteArrayOutputStream();
 +    DataOutputStream dos = new DataOutputStream(baos);
 +    split.write(dos);
 +    
 +    RangeInputSplit newSplit = new RangeInputSplit();
 +    
 +    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
 +    DataInputStream dis = new DataInputStream(bais);
 +    newSplit.readFields(dis);
 +    
 +    Assert.assertEquals(split.getRange(), newSplit.getRange());
 +    Assert.assertArrayEquals(split.getLocations(), newSplit.getLocations());
 +    
 +    Assert.assertEquals(split.getAuths(), newSplit.getAuths());
 +    Assert.assertEquals(split.isOffline(), newSplit.isOffline());
 +    Assert.assertEquals(split.isIsolatedScan(), newSplit.isOffline());
 +    Assert.assertEquals(split.usesLocalIterators(), newSplit.usesLocalIterators());
 +    Assert.assertEquals(split.getFetchedColumns(), newSplit.getFetchedColumns());
 +    Assert.assertEquals(split.getToken(), newSplit.getToken());
 +    Assert.assertEquals(split.getPrincipal(), newSplit.getPrincipal());
 +    Assert.assertEquals(split.getInstanceName(), newSplit.getInstanceName());
 +    Assert.assertEquals(split.isMockInstance(), newSplit.isMockInstance());
 +    Assert.assertEquals(split.getZooKeepers(), newSplit.getZooKeepers());
 +    Assert.assertEquals(split.getLogLevel(), newSplit.getLogLevel());
 +  }
 +  
 +}


Mime
View raw message