Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 50DB818FB6 for ; Wed, 29 Jul 2015 22:19:44 +0000 (UTC) Received: (qmail 19376 invoked by uid 500); 29 Jul 2015 22:19:44 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 19312 invoked by uid 500); 29 Jul 2015 22:19:44 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 19075 invoked by uid 99); 29 Jul 2015 22:19:44 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Jul 2015 22:19:44 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E2EC4E0006; Wed, 29 Jul 2015 22:19:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jbellis@apache.org To: commits@cassandra.apache.org Date: Wed, 29 Jul 2015 22:19:44 -0000 Message-Id: <498d02755a994f658e30c235fff4368b@git.apache.org> In-Reply-To: <43648b4e61844020bec7be4d3bd384cc@git.apache.org> References: <43648b4e61844020bec7be4d3bd384cc@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/6] cassandra git commit: Revert "Materialized Views" http://git-wip-us.apache.org/repos/asf/cassandra/blob/24d185d7/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java b/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java index f5a9edf..8d12e1b 100644 --- a/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java +++ b/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java @@ -33,6 +33,7 @@ import org.apache.cassandra.io.sstable.format.SSTableReader; import org.junit.BeforeClass; import org.junit.Test; +import org.apache.cassandra.AbstractReadCommandBuilder; import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.config.*; import org.apache.cassandra.Util; http://git-wip-us.apache.org/repos/asf/cassandra/blob/24d185d7/test/unit/org/apache/cassandra/db/view/MaterializedViewUtilsTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/view/MaterializedViewUtilsTest.java b/test/unit/org/apache/cassandra/db/view/MaterializedViewUtilsTest.java deleted file mode 100644 index 299c911..0000000 --- a/test/unit/org/apache/cassandra/db/view/MaterializedViewUtilsTest.java +++ /dev/null @@ -1,115 +0,0 @@ - -/* - * 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.cassandra.db.view; - -import java.net.InetAddress; -import java.util.HashMap; -import java.util.Map; - -import org.junit.BeforeClass; -import org.junit.Test; - -import junit.framework.Assert; -import org.apache.cassandra.config.DatabaseDescriptor; -import org.apache.cassandra.config.Schema; -import org.apache.cassandra.db.Keyspace; -import org.apache.cassandra.dht.OrderPreservingPartitioner.StringToken; -import org.apache.cassandra.exceptions.ConfigurationException; -import org.apache.cassandra.locator.IEndpointSnitch; -import org.apache.cassandra.locator.NetworkTopologyStrategy; -import org.apache.cassandra.locator.PropertyFileSnitch; -import org.apache.cassandra.locator.TokenMetadata; -import org.apache.cassandra.schema.KeyspaceMetadata; -import org.apache.cassandra.schema.KeyspaceParams; -import org.apache.cassandra.service.StorageService; - -public class MaterializedViewUtilsTest -{ - @BeforeClass - public static void setUp() throws ConfigurationException - { - IEndpointSnitch snitch = new PropertyFileSnitch(); - DatabaseDescriptor.setEndpointSnitch(snitch); - Keyspace.setInitialized(); - } - - @Test - public void testGetIndexNaturalEndpoint() throws Exception - { - TokenMetadata metadata = StorageService.instance.getTokenMetadata(); - metadata.clearUnsafe(); - - // DC1 - metadata.updateNormalToken(new StringToken("A"), InetAddress.getByName("127.0.0.1")); - metadata.updateNormalToken(new StringToken("C"), InetAddress.getByName("127.0.0.2")); - - // DC2 - metadata.updateNormalToken(new StringToken("B"), InetAddress.getByName("127.0.0.4")); - metadata.updateNormalToken(new StringToken("D"), InetAddress.getByName("127.0.0.5")); - - Map replicationMap = new HashMap<>(); - replicationMap.put(KeyspaceParams.Replication.CLASS, NetworkTopologyStrategy.class.getName()); - - replicationMap.put("DC1", "1"); - replicationMap.put("DC2", "1"); - - Keyspace.clear("Keyspace1"); - KeyspaceMetadata meta = KeyspaceMetadata.create("Keyspace1", KeyspaceParams.create(false, replicationMap)); - Schema.instance.setKeyspaceMetadata(meta); - - InetAddress naturalEndpoint = MaterializedViewUtils.getViewNaturalEndpoint("Keyspace1", - new StringToken("CA"), - new StringToken("BB")); - - Assert.assertEquals(InetAddress.getByName("127.0.0.2"), naturalEndpoint); - } - - - @Test - public void testLocalHostPreference() throws Exception - { - TokenMetadata metadata = StorageService.instance.getTokenMetadata(); - metadata.clearUnsafe(); - - // DC1 - metadata.updateNormalToken(new StringToken("A"), InetAddress.getByName("127.0.0.1")); - metadata.updateNormalToken(new StringToken("C"), InetAddress.getByName("127.0.0.2")); - - // DC2 - metadata.updateNormalToken(new StringToken("B"), InetAddress.getByName("127.0.0.4")); - metadata.updateNormalToken(new StringToken("D"), InetAddress.getByName("127.0.0.5")); - - Map replicationMap = new HashMap<>(); - replicationMap.put(KeyspaceParams.Replication.CLASS, NetworkTopologyStrategy.class.getName()); - - replicationMap.put("DC1", "2"); - replicationMap.put("DC2", "2"); - - Keyspace.clear("Keyspace1"); - KeyspaceMetadata meta = KeyspaceMetadata.create("Keyspace1", KeyspaceParams.create(false, replicationMap)); - Schema.instance.setKeyspaceMetadata(meta); - - InetAddress naturalEndpoint = MaterializedViewUtils.getViewNaturalEndpoint("Keyspace1", - new StringToken("CA"), - new StringToken("BB")); - - Assert.assertEquals(InetAddress.getByName("127.0.0.1"), naturalEndpoint); - } -}