You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2015/07/30 00:19:44 UTC
[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<String, String> 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<String, String> 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);
- }
-}