@SuppressWarnings("deprecation") @Test(timeout = 30000) public void test() throws Exception { org.apache.accumulo.core.client.Connector conn = accumulo.getConnector("root", "superSecret"); conn.tableOperations().create("table1", new NewTableConfiguration()); conn.securityOperations().createLocalUser("user1", new PasswordToken("pass1")); conn.securityOperations().changeUserAuthorizations("user1", new Authorizations("A", "B")); conn.securityOperations().grantTablePermission("user1", "table1", TablePermission.WRITE); conn.securityOperations().grantTablePermission("user1", "table1", TablePermission.READ); IteratorSetting is = new IteratorSetting(10, SummingCombiner.class); SummingCombiner.setEncodingType(is, LongCombiner.Type.STRING); SummingCombiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("META", "COUNT"))); conn.tableOperations().attachIterator("table1", is); org.apache.accumulo.core.client.Connector uconn = accumulo.getConnector("user1", "pass1"); BatchWriter bw = uconn.createBatchWriter("table1", new BatchWriterConfig()); UUID uuid = UUID.randomUUID(); Mutation m = new Mutation(uuid.toString()); m.put("META", "SIZE", new ColumnVisibility("A|B"), "8"); m.put("META", "CRC", new ColumnVisibility("A|B"), "456"); m.put("META", "COUNT", new ColumnVisibility("A|B"), "1"); m.put("DATA", "IMG", new ColumnVisibility("A&B"), "ABCDEFGH"); bw.addMutation(m); bw.flush(); m = new Mutation(uuid.toString()); m.put("META", "COUNT", new ColumnVisibility("A|B"), "1"); m.put("META", "CRC", new ColumnVisibility("A|B"), "123"); bw.addMutation(m); bw.close(); int count = 0; Scanner scanner = uconn.createScanner("table1", new Authorizations("A")); for (Entry<Key,Value> entry : scanner) { if (entry.getKey().getColumnQualifierData().toString().equals("COUNT")) { assertEquals("2", entry.getValue().toString()); } else if (entry.getKey().getColumnQualifierData().toString().equals("SIZE")) { assertEquals("8", entry.getValue().toString()); } else if (entry.getKey().getColumnQualifierData().toString().equals("CRC")) { assertEquals("123", entry.getValue().toString()); } else { fail(); } count++; } assertEquals(3, count); count = 0; scanner = uconn.createScanner("table1", new Authorizations("A", "B")); for (Entry<Key,Value> entry : scanner) { if (entry.getKey().getColumnQualifierData().toString().equals("IMG")) { assertEquals("ABCDEFGH", entry.getValue().toString()); } count++; } assertEquals(4, count); conn.tableOperations().delete("table1"); }
@Deprecated(since = "2.0.0") public org.apache.accumulo.core.client.Connector getConnector(String user, String passwd) throws AccumuloException, AccumuloSecurityException { return org.apache.accumulo.core.client.Connector .from(impl.createAccumuloClient(user, new PasswordToken(passwd))); }
MiniAccumuloCluster { @Deprecated(since = "2.0.0") public org.apache.accumulo.core.client.Connector getConnector(String user, String passwd) throws AccumuloException, AccumuloSecurityException { return org.apache.accumulo.core.client.Connector .from(impl.createAccumuloClient(user, new PasswordToken(passwd))); } }
MiniAccumuloCluster { @Deprecated(since = "2.0.0") public org.apache.accumulo.core.client.Connector getConnector(String user, String passwd) throws AccumuloException, AccumuloSecurityException { return org.apache.accumulo.core.client.Connector .from(impl.createAccumuloClient(user, new PasswordToken(passwd))); } private  MiniAccumuloCluster(MiniAccumuloConfigImpl config);  MiniAccumuloCluster(File dir, String rootPassword);  MiniAccumuloCluster(MiniAccumuloConfig config); }
MiniAccumuloCluster { @Deprecated(since = "2.0.0") public org.apache.accumulo.core.client.Connector getConnector(String user, String passwd) throws AccumuloException, AccumuloSecurityException { return org.apache.accumulo.core.client.Connector .from(impl.createAccumuloClient(user, new PasswordToken(passwd))); } private  MiniAccumuloCluster(MiniAccumuloConfigImpl config);  MiniAccumuloCluster(File dir, String rootPassword);  MiniAccumuloCluster(MiniAccumuloConfig config); void start(); Set<Pair<ServerType,Integer>> getDebugPorts(); String getInstanceName(); String getZooKeepers(); void stop(); MiniAccumuloConfig getConfig(); @Deprecated(since = "2.0.0") org.apache.accumulo.core.client.Connector getConnector(String user, String passwd); AccumuloClient createAccumuloClient(String user, AuthenticationToken token); @Deprecated(since = "2.0.0") org.apache.accumulo.core.client.ClientConfiguration getClientConfig(); Properties getClientProperties(); static Properties getClientProperties(File directory); }
MiniAccumuloCluster { @Deprecated(since = "2.0.0") public org.apache.accumulo.core.client.Connector getConnector(String user, String passwd) throws AccumuloException, AccumuloSecurityException { return org.apache.accumulo.core.client.Connector .from(impl.createAccumuloClient(user, new PasswordToken(passwd))); } private  MiniAccumuloCluster(MiniAccumuloConfigImpl config);  MiniAccumuloCluster(File dir, String rootPassword);  MiniAccumuloCluster(MiniAccumuloConfig config); void start(); Set<Pair<ServerType,Integer>> getDebugPorts(); String getInstanceName(); String getZooKeepers(); void stop(); MiniAccumuloConfig getConfig(); @Deprecated(since = "2.0.0") org.apache.accumulo.core.client.Connector getConnector(String user, String passwd); AccumuloClient createAccumuloClient(String user, AuthenticationToken token); @Deprecated(since = "2.0.0") org.apache.accumulo.core.client.ClientConfiguration getClientConfig(); Properties getClientProperties(); static Properties getClientProperties(File directory);  }