http://git-wip-us.apache.org/repos/asf/accumulo/blob/6aa47cf9/test/src/main/java/org/apache/accumulo/test/proxy/TBinaryProxyIT.java ---------------------------------------------------------------------- diff --cc test/src/main/java/org/apache/accumulo/test/proxy/TBinaryProxyIT.java index 6359d1e,0000000..7500361 mode 100644,000000..100644 --- a/test/src/main/java/org/apache/accumulo/test/proxy/TBinaryProxyIT.java +++ b/test/src/main/java/org/apache/accumulo/test/proxy/TBinaryProxyIT.java @@@ -1,33 -1,0 +1,35 @@@ +/* + * 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.test.proxy; + ++import org.apache.accumulo.harness.SharedMiniClusterBase; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.junit.BeforeClass; + +/** + * + */ +public class TBinaryProxyIT extends SimpleProxyBase { + + @BeforeClass + public static void setProtocol() throws Exception { ++ SharedMiniClusterBase.startMiniCluster(); + SimpleProxyBase.factory = new TBinaryProtocol.Factory(); + setUpProxy(); + } + +}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6aa47cf9/test/src/main/java/org/apache/accumulo/test/proxy/TCompactProxyIT.java ---------------------------------------------------------------------- diff --cc test/src/main/java/org/apache/accumulo/test/proxy/TCompactProxyIT.java index a92414a,0000000..157574b mode 100644,000000..100644 --- a/test/src/main/java/org/apache/accumulo/test/proxy/TCompactProxyIT.java +++ b/test/src/main/java/org/apache/accumulo/test/proxy/TCompactProxyIT.java @@@ -1,32 -1,0 +1,34 @@@ +/* + * 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.test.proxy; + ++import org.apache.accumulo.harness.SharedMiniClusterBase; +import org.apache.thrift.protocol.TCompactProtocol; +import org.junit.BeforeClass; + +/** + * + */ +public class TCompactProxyIT extends SimpleProxyBase { + + @BeforeClass + public static void setProtocol() throws Exception { ++ SharedMiniClusterBase.startMiniCluster(); + SimpleProxyBase.factory = new TCompactProtocol.Factory(); + setUpProxy(); + } +} http://git-wip-us.apache.org/repos/asf/accumulo/blob/6aa47cf9/test/src/main/java/org/apache/accumulo/test/proxy/TJsonProtocolProxyIT.java ---------------------------------------------------------------------- diff --cc test/src/main/java/org/apache/accumulo/test/proxy/TJsonProtocolProxyIT.java index 5fcbf53,0000000..d8b91c4 mode 100644,000000..100644 --- a/test/src/main/java/org/apache/accumulo/test/proxy/TJsonProtocolProxyIT.java +++ b/test/src/main/java/org/apache/accumulo/test/proxy/TJsonProtocolProxyIT.java @@@ -1,33 -1,0 +1,35 @@@ +/* + * 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.test.proxy; + ++import org.apache.accumulo.harness.SharedMiniClusterBase; +import org.apache.thrift.protocol.TJSONProtocol; +import org.junit.BeforeClass; + +/** + * + */ +public class TJsonProtocolProxyIT extends SimpleProxyBase { + + @BeforeClass + public static void setProtocol() throws Exception { ++ SharedMiniClusterBase.startMiniCluster(); + SimpleProxyBase.factory = new TJSONProtocol.Factory(); + setUpProxy(); + } + +} http://git-wip-us.apache.org/repos/asf/accumulo/blob/6aa47cf9/test/src/main/java/org/apache/accumulo/test/proxy/TTupleProxyIT.java ---------------------------------------------------------------------- diff --cc test/src/main/java/org/apache/accumulo/test/proxy/TTupleProxyIT.java index cdecf2c,0000000..2f792f6 mode 100644,000000..100644 --- a/test/src/main/java/org/apache/accumulo/test/proxy/TTupleProxyIT.java +++ b/test/src/main/java/org/apache/accumulo/test/proxy/TTupleProxyIT.java @@@ -1,33 -1,0 +1,35 @@@ +/* + * 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.test.proxy; + ++import org.apache.accumulo.harness.SharedMiniClusterBase; +import org.apache.thrift.protocol.TTupleProtocol; +import org.junit.BeforeClass; + +/** + * + */ +public class TTupleProxyIT extends SimpleProxyBase { + + @BeforeClass + public static void setProtocol() throws Exception { ++ SharedMiniClusterBase.startMiniCluster(); + SimpleProxyBase.factory = new TTupleProtocol.Factory(); + setUpProxy(); + } + +} http://git-wip-us.apache.org/repos/asf/accumulo/blob/6aa47cf9/test/src/main/java/org/apache/accumulo/test/replication/StatusCombinerMacIT.java ---------------------------------------------------------------------- diff --cc test/src/main/java/org/apache/accumulo/test/replication/StatusCombinerMacIT.java index 59bfab0,0000000..03663a2 mode 100644,000000..100644 --- a/test/src/main/java/org/apache/accumulo/test/replication/StatusCombinerMacIT.java +++ b/test/src/main/java/org/apache/accumulo/test/replication/StatusCombinerMacIT.java @@@ -1,117 -1,0 +1,129 @@@ +/* + * 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.test.replication; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +import org.apache.accumulo.cluster.ClusterUser; +import org.apache.accumulo.core.client.BatchWriter; +import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.Scanner; +import org.apache.accumulo.core.client.admin.TableOperations; +import org.apache.accumulo.core.conf.Property; +import org.apache.accumulo.core.data.Key; +import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope; +import org.apache.accumulo.core.metadata.MetadataTable; +import org.apache.accumulo.core.metadata.schema.MetadataSchema; +import org.apache.accumulo.core.protobuf.ProtobufUtil; +import org.apache.accumulo.core.replication.ReplicationSchema.StatusSection; +import org.apache.accumulo.core.replication.ReplicationTable; +import org.apache.accumulo.core.security.TablePermission; +import org.apache.accumulo.harness.SharedMiniClusterBase; +import org.apache.accumulo.server.replication.StatusUtil; +import org.apache.accumulo.server.replication.proto.Replication.Status; +import org.apache.accumulo.server.util.ReplicationTableUtil; ++import org.junit.AfterClass; +import org.junit.Assert; ++import org.junit.BeforeClass; +import org.junit.Test; + +import com.google.common.collect.Iterables; + +public class StatusCombinerMacIT extends SharedMiniClusterBase { + + @Override + public int defaultTimeoutSeconds() { + return 60; + } + ++ @BeforeClass ++ public static void setup() throws Exception { ++ SharedMiniClusterBase.startMiniCluster(); ++ } ++ ++ @AfterClass ++ public static void teardown() throws Exception { ++ SharedMiniClusterBase.stopMiniCluster(); ++ } ++ + @Test + public void testCombinerSetOnMetadata() throws Exception { + TableOperations tops = getConnector().tableOperations(); + Map<String,EnumSet<IteratorScope>> iterators = tops.listIterators(MetadataTable.NAME); + + Assert.assertTrue(iterators.containsKey(ReplicationTableUtil.COMBINER_NAME)); + EnumSet<IteratorScope> scopes = iterators.get(ReplicationTableUtil.COMBINER_NAME); + Assert.assertEquals(3, scopes.size()); + Assert.assertTrue(scopes.contains(IteratorScope.scan)); + Assert.assertTrue(scopes.contains(IteratorScope.minc)); + Assert.assertTrue(scopes.contains(IteratorScope.majc)); + + Iterable<Entry<String,String>> propIter = tops.getProperties(MetadataTable.NAME); + HashMap<String,String> properties = new HashMap<>(); + for (Entry<String,String> entry : propIter) { + properties.put(entry.getKey(), entry.getValue()); + } + + for (IteratorScope scope : scopes) { + String key = Property.TABLE_ITERATOR_PREFIX.getKey() + scope.name() + "." + ReplicationTableUtil.COMBINER_NAME + ".opt.columns"; + Assert.assertTrue("Properties did not contain key : " + key, properties.containsKey(key)); + Assert.assertEquals(MetadataSchema.ReplicationSection.COLF.toString(), properties.get(key)); + } + } + + @Test + public void test() throws Exception { + Connector conn = getConnector(); + ClusterUser user = getAdminUser(); + + ReplicationTable.setOnline(conn); + conn.securityOperations().grantTablePermission(user.getPrincipal(), ReplicationTable.NAME, TablePermission.WRITE); + BatchWriter bw = ReplicationTable.getBatchWriter(conn); + long createTime = System.currentTimeMillis(); + try { + Mutation m = new Mutation("file:/accumulo/wal/HW10447.local+56808/93cdc17e-7521-44fa-87b5-37f45bcb92d3"); + StatusSection.add(m, "1", StatusUtil.fileCreatedValue(createTime)); + bw.addMutation(m); + } finally { + bw.close(); + } + + Scanner s = ReplicationTable.getScanner(conn); + Entry<Key,Value> entry = Iterables.getOnlyElement(s); + Assert.assertEquals(StatusUtil.fileCreatedValue(createTime), entry.getValue()); + + bw = ReplicationTable.getBatchWriter(conn); + try { + Mutation m = new Mutation("file:/accumulo/wal/HW10447.local+56808/93cdc17e-7521-44fa-87b5-37f45bcb92d3"); + StatusSection.add(m, "1", ProtobufUtil.toValue(StatusUtil.replicated(Long.MAX_VALUE))); + bw.addMutation(m); + } finally { + bw.close(); + } + + s = ReplicationTable.getScanner(conn); + entry = Iterables.getOnlyElement(s); + Status stat = Status.parseFrom(entry.getValue().get()); + Assert.assertEquals(Long.MAX_VALUE, stat.getBegin()); + } + +}