CPD Results

The following document contains the results of PMD's CPD 4.3.

Duplications

FileLine
org/apache/accumulo/test/functional/ConstraintTest.java152
org/apache/accumulo/test/functional/ConstraintTest.java192
    iter = scanner.iterator();
    entry = iter.next();
    
    if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1"))
        || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("123a".getBytes()))) {
      throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue());
    }
    
    if (iter.hasNext()) {
      entry = iter.next();
      throw new Exception("Unexpected extra key or value " + entry.getKey() + " " + entry.getValue());
    }
    
    // add a constraint that references a non-existant class
    getConnector().tableOperations().setProperty("ct", Property.TABLE_CONSTRAINT_PREFIX + "1", "com.foobar.nonExistantClass");
FileLine
org/apache/accumulo/fate/zookeeper/ZooLockTest.java159
org/apache/accumulo/fate/zookeeper/ZooLockTest.java192
  public void testDeleteLock() throws Exception {
    accumulo.getZooKeepers();
    
    String parent = "/zltest-" + this.hashCode() + "-l" + pdCount++;
    
    ZooReaderWriter zk = ZooReaderWriter.getInstance(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes());
    zk.mkdirs(parent);
    
    ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes(), parent);

    Assert.assertFalse(zl.isLocked());
    
    TestALW lw = new TestALW();
    
    zl.lockAsync(lw, "test1".getBytes());
    
    lw.waitForChanges(1);

    Assert.assertTrue(lw.locked);
    Assert.assertTrue(zl.isLocked());
    Assert.assertNull(lw.exception);
    Assert.assertNull(lw.reason);
FileLine
org/apache/accumulo/test/randomwalk/concurrent/Compact.java31
org/apache/accumulo/test/randomwalk/concurrent/Merge.java31
public class Compact extends Test {
  
  @Override
  public void visit(State state, Properties props) throws Exception {
    Connector conn = state.getConnector();
    
    Random rand = (Random) state.get("rand");
    
    @SuppressWarnings("unchecked")
    List<String> tableNames = (List<String>) state.get("tables");
    
    String tableName = tableNames.get(rand.nextInt(tableNames.size()));
    
    // TODO need to sometimes do null start and end ranges
    
    TreeSet<Text> range = new TreeSet<Text>();
    range.add(new Text(String.format("%016x", Math.abs(rand.nextLong()))));
    range.add(new Text(String.format("%016x", Math.abs(rand.nextLong()))));
    
    try {
FileLine
org/apache/accumulo/test/functional/ConstraintTest.java127
org/apache/accumulo/test/functional/ConstraintTest.java296
    scanner.setRange(new Range(new Text("r1")));
    
    Iterator<Entry<Key,Value>> iter = scanner.iterator();
    Entry<Key,Value> entry = iter.next();
    
    if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1"))
        || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("123".getBytes()))) {
      throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue());
    }
FileLine
org/apache/accumulo/test/randomwalk/concurrent/BulkImport.java60
org/apache/accumulo/test/randomwalk/shard/BulkInsert.java62
        Key key = new Key(m.getRow(), cu.getColumnFamily(), cu.getColumnQualifier(), cu.getColumnVisibility(), 42, false, false);
        Value val = new Value(cu.getValue(), false);
        
        try {
          writer.append(key, val);
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
    }
    
    @Override
    public void addMutations(Iterable<Mutation> iterable) throws MutationsRejectedException {
      for (Mutation mutation : iterable)
        addMutation(mutation);
    }
    
    @Override
    public void flush() throws MutationsRejectedException {}
    
    @Override
    public void close() throws MutationsRejectedException {
      try {
        writer.close();
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
    
  }
  
  @Override
  public void visit(State state, Properties props) throws Exception {
FileLine
org/apache/accumulo/test/randomwalk/concurrent/ChangePermissions.java33
org/apache/accumulo/test/randomwalk/concurrent/CheckPermission.java30
public class ChangePermissions extends Test {
  
  @Override
  public void visit(State state, Properties props) throws Exception {
    Connector conn = state.getConnector();
    
    Random rand = (Random) state.get("rand");
    
    @SuppressWarnings("unchecked")
    List<String> userNames = (List<String>) state.get("users");
    String userName = userNames.get(rand.nextInt(userNames.size()));
    
    @SuppressWarnings("unchecked")
    List<String> tableNames = (List<String>) state.get("tables");
    String tableName = tableNames.get(rand.nextInt(tableNames.size()));
    
    try {
      if (rand.nextBoolean())
FileLine
org/apache/accumulo/test/randomwalk/multitable/CopyTool.java43
org/apache/accumulo/test/randomwalk/sequential/MapRedVerifyTool.java74
      m.put(key.getColumnFamily(), key.getColumnQualifier(), val);
      output.write(null, m);
    }
  }
  
  @Override
  public int run(String[] args) throws Exception {
    Job job = new Job(getConf(), this.getClass().getSimpleName());
    job.setJarByClass(this.getClass());
    
    if (job.getJar() == null) {
      log.error("M/R requires a jar file!  Run mvn package.");
      return 1;
    }
    
    job.setInputFormatClass(AccumuloInputFormat.class);
    AccumuloInputFormat.setConnectorInfo(job, args[0], new PasswordToken().setPassword(args[1].getBytes(Charset.forName("UTF-8"))));
    AccumuloInputFormat.setInputTableName(job, args[2]);
    AccumuloInputFormat.setScanAuthorizations(job, Constants.NO_AUTHS);
FileLine
org/apache/accumulo/test/functional/NativeMapTest.java178
org/apache/accumulo/test/functional/NativeMapTest.java228
    for (int i = 0; i < num; i++) {
      for (int j = 0; j < num; j++) {
        for (int k = 0; k < num; k++) {
          for (int l = 0; l < num; l++) {
            for (int ts = 0; ts < num; ts++) {
              Key key = nk(i, j, k, l, ts, true);
              Value value = new Value((i + "_" + j + "_" + k + "_" + l + "_" + ts + "_" + true + "_" + run).getBytes());
FileLine
org/apache/accumulo/test/functional/NativeMapTest.java575
org/apache/accumulo/test/functional/NativeMapTest.java593
    Iterator<Entry<Key,Value>> iter = nm.iterator();
    for (int i = 0; i < 256; i++) {
      for (int j = 0; j < 256; j++) {
        byte row[] = new byte[] {'r', (byte) (0xff & i), (byte) (0xff & j)};
        byte data[] = new byte[] {'v', (byte) (0xff & i), (byte) (0xff & j)};
        
        Key k = new Key(row, emptyBytes, emptyBytes, emptyBytes, 1);
        Value v = new Value(data);
FileLine
org/apache/accumulo/test/functional/NativeMapTest.java563
org/apache/accumulo/test/functional/NativeMapTest.java576
org/apache/accumulo/test/functional/NativeMapTest.java595
    for (int i = 0; i < 256; i++) {
      for (int j = 0; j < 256; j++) {
        byte row[] = new byte[] {'r', (byte) (0xff & i), (byte) (0xff & j)};
        byte data[] = new byte[] {'v', (byte) (0xff & i), (byte) (0xff & j)};
        
        Key k = new Key(row, emptyBytes, emptyBytes, emptyBytes, 1);
        Value v = new Value(data);