Package org.apache.accumulo.core.data

Examples of org.apache.accumulo.core.data.ColumnUpdate


 
  private void _mutate(Mutation mutation, int mutationCount) {
   
    List<ColumnUpdate> updates = mutation.getUpdates();
    if (updates.size() == 1) {
      ColumnUpdate update = updates.get(0);
      singleUpdate(nmPointer, mutation.getRow(), update.getColumnFamily(), update.getColumnQualifier(), update.getColumnVisibility(), update.getTimestamp(),
          update.isDeleted(), update.getValue(), mutationCount);
    } else if (updates.size() > 1) {
      long uid = startUpdate(nmPointer, mutation.getRow());
      for (ColumnUpdate update : updates) {
        update(nmPointer, uid, update.getColumnFamily(), update.getColumnQualifier(), update.getColumnVisibility(), update.getTimestamp(), update.isDeleted(),
            update.getValue(), mutationCount);
      }
     
    }
  }
View Full Code Here


    List<ColumnUpdate> updates = m.getUpdates();
   
    assertEquals(2, updates.size());
   
    assertEquals("r1", new String(m.getRow()));
    ColumnUpdate cu = updates.get(0);
   
    assertEquals("cf1", new String(cu.getColumnFamily()));
    assertEquals("cq1", new String(cu.getColumnQualifier()));
    assertEquals("", new String(cu.getColumnVisibility()));
    assertFalse(cu.hasTimestamp());
    assertEquals(42l, cu.getTimestamp());
   
    ServerMutation m2 = new ServerMutation();
    ReflectionUtils.copy(CachedConfiguration.getInstance(), m, m2);
   
    updates = m2.getUpdates();
   
    assertEquals(2, updates.size());
    assertEquals("r1", new String(m2.getRow()));
   
    cu = updates.get(0);
    assertEquals("cf1", new String(cu.getColumnFamily()));
    assertEquals("cq1", new String(cu.getColumnQualifier()));
    assertFalse(cu.hasTimestamp());
    assertEquals(42l, cu.getTimestamp());
   
    cu = updates.get(1);
   
    assertEquals("r1", new String(m2.getRow()));
    assertEquals("cf2", new String(cu.getColumnFamily()));
    assertEquals("cq2", new String(cu.getColumnQualifier()));
    assertTrue(cu.hasTimestamp());
    assertEquals(56, cu.getTimestamp());
   
   
  }
View Full Code Here

 
  private void _mutate(Mutation mutation, int mutationCount) {
   
    List<ColumnUpdate> updates = mutation.getUpdates();
    if (updates.size() == 1) {
      ColumnUpdate update = updates.get(0);
      singleUpdate(nmPointer, mutation.getRow(), update.getColumnFamily(), update.getColumnQualifier(), update.getColumnVisibility(), update.getTimestamp(),
          update.isDeleted(), update.getValue(), mutationCount);
    } else if (updates.size() > 1) {
      long uid = startUpdate(nmPointer, mutation.getRow());
      for (ColumnUpdate update : updates) {
        update(nmPointer, uid, update.getColumnFamily(), update.getColumnQualifier(), update.getColumnVisibility(), update.getTimestamp(), update.isDeleted(),
            update.getValue(), mutationCount);
      }
     
    }
  }
View Full Code Here

                Arrays.equals(m.getRow(), ((String) t.get(0)).getBytes()));

        List<ColumnUpdate> colUpdates = m.getUpdates();
        Assert.assertEquals(1, colUpdates.size());

        ColumnUpdate colUpdate = colUpdates.get(0);
        Assert.assertTrue("CF not equal",
                Arrays.equals(colUpdate.getColumnFamily(), "col".getBytes()));
        Assert.assertTrue("CQ not equal",
                Arrays.equals(colUpdate.getColumnQualifier(), new byte[0]));
        Assert.assertTrue("Values not equal",
                Arrays.equals(colUpdate.getValue(), "value".getBytes()));
    }
View Full Code Here

                Arrays.equals(m.getRow(), ((String) t.get(0)).getBytes()));

        List<ColumnUpdate> colUpdates = m.getUpdates();
        Assert.assertEquals(1, colUpdates.size());

        ColumnUpdate colUpdate = colUpdates.get(0);
        Assert.assertTrue("CF not equal",
                Arrays.equals(colUpdate.getColumnFamily(), "col".getBytes()));
        Assert.assertTrue("CQ not equal", Arrays.equals(
                colUpdate.getColumnQualifier(), "qual".getBytes()));
        Assert.assertTrue("Values not equal",
                Arrays.equals(colUpdate.getValue(), "value".getBytes()));
    }
View Full Code Here

                Arrays.equals(m.getRow(), ((String) t.get(0)).getBytes()));

        List<ColumnUpdate> colUpdates = m.getUpdates();
        Assert.assertEquals(4, colUpdates.size());

        ColumnUpdate colUpdate = colUpdates.get(0);
        Assert.assertTrue("CF not equal",
                Arrays.equals(colUpdate.getColumnFamily(), "col1".getBytes()));
        Assert.assertTrue("CQ not equal",
                Arrays.equals(colUpdate.getColumnQualifier(), new byte[0]));
        Assert.assertTrue("Values not equal",
                Arrays.equals(colUpdate.getValue(), "value1".getBytes()));

        colUpdate = colUpdates.get(1);
        Assert.assertTrue("CF not equal",
                Arrays.equals(colUpdate.getColumnFamily(), "col1".getBytes()));
        Assert.assertTrue("CQ not equal", Arrays.equals(
                colUpdate.getColumnQualifier(), "qual".getBytes()));
        Assert.assertTrue("Values not equal",
                Arrays.equals(colUpdate.getValue(), "value2".getBytes()));

        colUpdate = colUpdates.get(2);
        Assert.assertTrue("CF not equal",
                Arrays.equals(colUpdate.getColumnFamily(), "col2".getBytes()));
        Assert.assertTrue("CQ not equal", Arrays.equals(
                colUpdate.getColumnQualifier(), "qual".getBytes()));
        Assert.assertTrue("Values not equal",
                Arrays.equals(colUpdate.getValue(), "value3".getBytes()));

        colUpdate = colUpdates.get(3);
        Assert.assertTrue("CF not equal",
                Arrays.equals(colUpdate.getColumnFamily(), "col2".getBytes()));
        Assert.assertTrue("CQ not equal",
                Arrays.equals(colUpdate.getColumnQualifier(), new byte[0]));
        Assert.assertTrue("Values not equal",
                Arrays.equals(colUpdate.getValue(), "value4".getBytes()));
    }
View Full Code Here

                Arrays.equals(m.getRow(), ((String) t.get(0)).getBytes()));

        List<ColumnUpdate> colUpdates = m.getUpdates();
        Assert.assertEquals(1, colUpdates.size());

        ColumnUpdate colUpdate = colUpdates.get(0);
        Assert.assertTrue("CF not equal",
                Arrays.equals(colUpdate.getColumnFamily(), "col".getBytes()));
        Assert.assertTrue("CQ not equal",
                Arrays.equals(colUpdate.getColumnQualifier(), new byte[0]));
        Assert.assertTrue("Values not equal",
                Arrays.equals(colUpdate.getValue(), "value1".getBytes()));
    }
View Full Code Here

                Arrays.equals(m.getRow(), ((String) t.get(0)).getBytes()));

        List<ColumnUpdate> colUpdates = m.getUpdates();
        Assert.assertEquals(1, colUpdates.size());

        ColumnUpdate update = colUpdates.get(0);
        Assert.assertEquals("col1", new String(update.getColumnFamily()));
        Assert.assertEquals("", new String(update.getColumnQualifier()));
        Assert.assertEquals("value1", new String(update.getValue()));
    }
View Full Code Here

                Arrays.equals(m.getRow(), ((String) t.get(0)).getBytes()));

        List<ColumnUpdate> colUpdates = m.getUpdates();
        Assert.assertEquals(2, colUpdates.size());

        ColumnUpdate update = colUpdates.get(0);
        Assert.assertEquals("col1", new String(update.getColumnFamily()));
        Assert.assertEquals("", new String(update.getColumnQualifier()));
        Assert.assertEquals("value1", new String(update.getValue()));

        update = colUpdates.get(1);
        Assert.assertEquals("col2", new String(update.getColumnFamily()));
        Assert.assertEquals("", new String(update.getColumnQualifier()));
        Assert.assertArrayEquals(storage.objToBytes(map, DataType.MAP),
                update.getValue());
    }
View Full Code Here

                Arrays.equals(m.getRow(), ((String) t.get(0)).getBytes()));

        List<ColumnUpdate> colUpdates = m.getUpdates();
        Assert.assertEquals(5, colUpdates.size());

        ColumnUpdate update = colUpdates.get(0);
        Assert.assertEquals("col1", new String(update.getColumnFamily()));
        Assert.assertEquals("", new String(update.getColumnQualifier()));
        Assert.assertEquals("value1", new String(update.getValue()));

        Map<Entry<String, String>, String> expectations = Maps.newHashMap();
        expectations.put(Maps.immutableEntry("col2", "mapcol1"), "mapval1");
        expectations.put(Maps.immutableEntry("col2", "mapcol2"), "mapval2");
        expectations.put(Maps.immutableEntry("col2", "mapcol3"), "mapval3");
        expectations.put(Maps.immutableEntry("col2", "mapcol4"), "mapval4");

        for (int i = 1; i < 5; i++) {
            update = colUpdates.get(i);
            Entry<String, String> key = Maps.immutableEntry(
                    new String(update.getColumnFamily()),
                    new String(update.getColumnQualifier()));
            String value = new String(update.getValue());
            Assert.assertTrue("Did not find expected key: " + key,
                    expectations.containsKey(key));

            String actual = expectations.remove(key);
            Assert.assertEquals(value, actual);
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.data.ColumnUpdate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.