aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/core/api/src/test/java/org/onosproject/store
diff options
context:
space:
mode:
authorCNlucius <lukai1@huawei.com>2016-09-13 11:40:12 +0800
committerCNlucius <lukai1@huawei.com>2016-09-13 11:41:53 +0800
commitb731e2f1dd0972409b136aebc7b463dd72c9cfad (patch)
tree5107d7d80c19ad8076c2c97c2b5ef8d1cf3ab903 /framework/src/onos/core/api/src/test/java/org/onosproject/store
parentee93993458266114c29271a481ef9ce7ce621b2a (diff)
ONOSFW-171
O/S-SFC-ONOS scenario documentation Change-Id: I51ae1cf736ea24ab6680f8edca1b2bf5dd598365 Signed-off-by: CNlucius <lukai1@huawei.com>
Diffstat (limited to 'framework/src/onos/core/api/src/test/java/org/onosproject/store')
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/cluster/messaging/ClusterCommunicationServiceAdapter.java88
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/cluster/messaging/ClusterMessageTest.java82
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/cluster/messaging/EndpointTest.java68
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/cluster/messaging/MessageSubjectTest.java64
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/persistence/PersistenceServiceAdapter.java36
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/persistence/TestPersistenceService.java57
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/service/AtomicValueEventTest.java71
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/service/ConsistentMapAdapter.java149
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/service/DatabaseUpdateTest.java126
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/service/EventuallyConsistentMapAdapter.java111
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/service/EventuallyConsistentMapEventTest.java82
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/service/MapEventTest.java60
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/service/MultiValuedTimestampTest.java93
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/service/SetEventTest.java75
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/service/StorageServiceAdapter.java56
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestAtomicCounter.java95
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestConsistentMap.java287
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestEventuallyConsistentMap.java239
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestStorageService.java55
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/service/VersionedTest.java83
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/service/WallClockTimestampTest.java66
21 files changed, 0 insertions, 2043 deletions
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/cluster/messaging/ClusterCommunicationServiceAdapter.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/cluster/messaging/ClusterCommunicationServiceAdapter.java
deleted file mode 100644
index 04f890c8..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/cluster/messaging/ClusterCommunicationServiceAdapter.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.cluster.messaging;
-
-import java.util.Set;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ExecutorService;
-import java.util.function.Consumer;
-import java.util.function.Function;
-
-import org.onosproject.cluster.NodeId;
-
-/**
- * Testing adapter for the cluster communication service.
- */
-public class ClusterCommunicationServiceAdapter
- implements ClusterCommunicationService {
-
- @Override
- public void addSubscriber(MessageSubject subject,
- ClusterMessageHandler subscriber,
- ExecutorService executor) {
- }
-
- @Override
- public void removeSubscriber(MessageSubject subject) {}
-
- @Override
- public <M> void broadcast(M message, MessageSubject subject,
- Function<M, byte[]> encoder) {
- }
-
- @Override
- public <M> void broadcastIncludeSelf(M message,
- MessageSubject subject, Function<M, byte[]> encoder) {
- }
-
- @Override
- public <M> CompletableFuture<Void> unicast(M message, MessageSubject subject,
- Function<M, byte[]> encoder, NodeId toNodeId) {
- return null;
- }
-
- @Override
- public <M> void multicast(M message, MessageSubject subject,
- Function<M, byte[]> encoder, Set<NodeId> nodes) {
- }
-
- @Override
- public <M, R> CompletableFuture<R> sendAndReceive(M message,
- MessageSubject subject, Function<M, byte[]> encoder,
- Function<byte[], R> decoder, NodeId toNodeId) {
- return null;
- }
-
- @Override
- public <M, R> void addSubscriber(MessageSubject subject,
- Function<byte[], M> decoder, Function<M, R> handler,
- Function<R, byte[]> encoder, Executor executor) {
- }
-
- @Override
- public <M, R> void addSubscriber(MessageSubject subject,
- Function<byte[], M> decoder, Function<M, CompletableFuture<R>> handler,
- Function<R, byte[]> encoder) {
- }
-
- @Override
- public <M> void addSubscriber(MessageSubject subject,
- Function<byte[], M> decoder, Consumer<M> handler,
- Executor executor) {
-
- }
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/cluster/messaging/ClusterMessageTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/cluster/messaging/ClusterMessageTest.java
deleted file mode 100644
index 22f841b4..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/cluster/messaging/ClusterMessageTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.cluster.messaging;
-
-import org.junit.Test;
-import org.onosproject.cluster.NodeId;
-
-import com.google.common.testing.EqualsTester;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-
-/**
- * Units tests for ClusterMessage class.
- */
-public class ClusterMessageTest {
- private final MessageSubject subject1 = new MessageSubject("Message 1");
- private final MessageSubject subject2 = new MessageSubject("Message 2");
-
- private final byte[] payload1 = {0, 1, 2, 3, 4, 5};
- private final byte[] payload2 = {0, 1, 2, 3, 4, 5, 6};
-
- private final NodeId nodeId = new NodeId("node");
-
- private final ClusterMessage message1 =
- new ClusterMessage(nodeId, subject1, payload1);
- private final ClusterMessage sameAsMessage1 =
- new ClusterMessage(nodeId, subject1, payload1);
- private final ClusterMessage message2 =
- new ClusterMessage(nodeId, subject1, payload2);
- private final ClusterMessage message3 =
- new ClusterMessage(nodeId, subject2, payload1);
-
- /**
- * Checks the operation of equals(), hashCode() and toString() methods.
- */
- @Test
- public void testEquals() {
- new EqualsTester()
- .addEqualityGroup(message1, sameAsMessage1)
- .addEqualityGroup(message2)
- .addEqualityGroup(message3)
- .testEquals();
- }
-
- /**
- * Checks the construction of a FlowId object.
- */
- @Test
- public void testConstruction() {
- assertThat(message1.payload(), is(payload1));
- assertThat(message1.sender(), is(nodeId));
- assertThat(message1.subject(), is(subject1));
-
- byte[] response = {2, 2, 2, 2, 2, 2, 2, 2};
- message1.respond(response);
- assertThat(message1.response(), is(response));
- }
-
- /**
- * Tests the toBytes and fromBytes methods.
- */
- @Test
- public void testByteMethods() {
- byte[] fromBytes = message3.getBytes();
- ClusterMessage message = ClusterMessage.fromBytes(fromBytes);
- assertThat(message, is(message3));
- }
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/cluster/messaging/EndpointTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/cluster/messaging/EndpointTest.java
deleted file mode 100644
index c88c711a..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/cluster/messaging/EndpointTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.cluster.messaging;
-
-
-import org.junit.Test;
-import org.onlab.packet.IpAddress;
-
-import com.google.common.testing.EqualsTester;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-
-/**
- * Unit tests for the Endpoint class.
- */
-public class EndpointTest {
- IpAddress host1 = IpAddress.valueOf("1.2.3.4");
- IpAddress host2 = IpAddress.valueOf("1.2.3.5");
-
- private final Endpoint endpoint1 = new Endpoint(host1, 1);
- private final Endpoint sameAsEndpoint1 = new Endpoint(host1, 1);
- private final Endpoint endpoint2 = new Endpoint(host2, 1);
- private final Endpoint endpoint3 = new Endpoint(host1, 2);
-
- /**
- * Checks that the MessageSubject class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(Endpoint.class);
- }
-
- /**
- * Checks the operation of equals(), hashCode() and toString() methods.
- */
- @Test
- public void testEquals() {
- new EqualsTester()
- .addEqualityGroup(endpoint1, sameAsEndpoint1)
- .addEqualityGroup(endpoint2)
- .addEqualityGroup(endpoint3)
- .testEquals();
- }
-
- /**
- * Checks the construction of a MessageSubject object.
- */
- @Test
- public void testConstruction() {
- assertThat(endpoint2.host(), is(host2));
- assertThat(endpoint2.port(), is(1));
- }
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/cluster/messaging/MessageSubjectTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/cluster/messaging/MessageSubjectTest.java
deleted file mode 100644
index 498edd33..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/cluster/messaging/MessageSubjectTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.cluster.messaging;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-
-/**
- * Unit tests for MessageSubject class.
- */
-public class MessageSubjectTest {
- private final MessageSubject subject1 = new MessageSubject("Message 1");
- private final MessageSubject sameAsSubject1 = new MessageSubject("Message 1");
- private final MessageSubject subject2 = new MessageSubject("Message 2");
- private final MessageSubject subject3 = new MessageSubject("Message 3");
-
- /**
- * Checks that the MessageSubject class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(MessageSubject.class);
- }
-
- /**
- * Checks the operation of equals(), hashCode() and toString() methods.
- */
- @Test
- public void testEquals() {
- new EqualsTester()
- .addEqualityGroup(subject1, sameAsSubject1)
- .addEqualityGroup(subject2)
- .addEqualityGroup(subject3)
- .testEquals();
- }
-
- /**
- * Checks the construction of a MessageSubject object.
- */
- @Test
- public void testConstruction() {
- assertThat(subject3.value(), is("Message 3"));
- MessageSubject serializerObject = new MessageSubject();
- assertThat(serializerObject.value(), is(""));
- }
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/persistence/PersistenceServiceAdapter.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/persistence/PersistenceServiceAdapter.java
deleted file mode 100644
index 3edfcc73..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/persistence/PersistenceServiceAdapter.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.persistence;
-
-import org.onosproject.persistence.PersistenceService;
-import org.onosproject.persistence.PersistentMapBuilder;
-import org.onosproject.persistence.PersistentSetBuilder;
-
-/**
- * Adapter for PersistenceService.
- */
-public class PersistenceServiceAdapter implements PersistenceService {
-
- @Override
- public <K, V> PersistentMapBuilder<K, V> persistentMapBuilder() {
- return null;
- }
-
- @Override
- public <E> PersistentSetBuilder<E> persistentSetBuilder() {
- return null;
- }
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/persistence/TestPersistenceService.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/persistence/TestPersistenceService.java
deleted file mode 100644
index a6d97458..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/persistence/TestPersistenceService.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.persistence;
-
-import java.util.Map;
-
-import org.onosproject.persistence.PersistentMapBuilder;
-import org.onosproject.persistence.PersistentSetBuilder;
-import org.onosproject.store.service.Serializer;
-
-import com.google.common.collect.Maps;
-
-/**
- * PersistenceService that produces in memory maps for use in unit testing.
- */
-public class TestPersistenceService extends PersistenceServiceAdapter {
- @Override
- public <K, V> PersistentMapBuilder<K, V> persistentMapBuilder() {
- return new TestPersistentMapBuilder<K, V>();
- }
-
- @Override
- public <E> PersistentSetBuilder<E> persistentSetBuilder() {
- throw new UnsupportedOperationException();
- }
-
- private static class TestPersistentMapBuilder<K, V> implements PersistentMapBuilder<K, V> {
-
- @Override
- public PersistentMapBuilder<K, V> withName(String name) {
- return this;
- }
-
- @Override
- public PersistentMapBuilder<K, V> withSerializer(Serializer serializer) {
- return this;
- }
-
- @Override
- public Map<K, V> build() {
- return Maps.newConcurrentMap();
- }
- }
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/AtomicValueEventTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/AtomicValueEventTest.java
deleted file mode 100644
index 39481ca0..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/AtomicValueEventTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.service;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-import static org.onosproject.store.service.AtomicValueEvent.Type.UPDATE;
-
-/**
- * Unit tests for the AtomicValueEvent class.
- */
-public class AtomicValueEventTest {
-
- AtomicValueEvent<String> event1 =
- new AtomicValueEvent<>("map1", UPDATE, "e1");
- AtomicValueEvent<String> event2 =
- new AtomicValueEvent<>("map1", UPDATE, "e2");
- AtomicValueEvent<String> sameAsEvent2 =
- new AtomicValueEvent<>("map1", UPDATE, "e2");
- AtomicValueEvent<String> event3 =
- new AtomicValueEvent<>("map2", UPDATE, "e2");
-
- /**
- * Checks that the SetEvent class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(AtomicValueEvent.class);
- }
-
- /**
- * Checks the equals(), hashCode() and toString() operations.
- */
- @Test
- public void testEquals() {
- new EqualsTester()
- .addEqualityGroup(event1)
- .addEqualityGroup(event2, sameAsEvent2)
- .addEqualityGroup(event3)
- .testEquals();
- }
-
- /**
- * Checks that construction of the object is correct.
- */
- @Test
- public void testConstruction() {
- assertThat(event1.type(), is(UPDATE));
- assertThat(event1.value(), is("e1"));
- assertThat(event1.name(), is("map1"));
- }
-
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/ConsistentMapAdapter.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/ConsistentMapAdapter.java
deleted file mode 100644
index d0c1adf6..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/ConsistentMapAdapter.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.service;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.function.BiFunction;
-import java.util.function.Function;
-import java.util.function.Predicate;
-
-/**
- * Testing adapter for the consistent map.
- */
-public class ConsistentMapAdapter<K, V> implements ConsistentMap<K, V> {
- @Override
- public int size() {
- return 0;
- }
-
- @Override
- public boolean isEmpty() {
- return false;
- }
-
- @Override
- public boolean containsKey(K key) {
- return false;
- }
-
- @Override
- public boolean containsValue(V value) {
- return false;
- }
-
- @Override
- public Versioned<V> get(K key) {
- return null;
- }
-
- @Override
- public Versioned<V> computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
- return null;
- }
-
- @Override
- public Versioned<V> compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
- return null;
- }
-
- @Override
- public Versioned<V> computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
- return null;
- }
-
- @Override
- public Versioned<V> computeIf(K key, Predicate<? super V> condition,
- BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
- return null;
- }
-
- @Override
- public Versioned<V> put(K key, V value) {
- return null;
- }
-
- @Override
- public Versioned<V> putAndGet(K key, V value) {
- return null;
- }
-
- @Override
- public Versioned<V> remove(K key) {
- return null;
- }
-
- @Override
- public void clear() {
-
- }
-
- @Override
- public Set<K> keySet() {
- return null;
- }
-
- @Override
- public Collection<Versioned<V>> values() {
- return null;
- }
-
- @Override
- public Set<Map.Entry<K, Versioned<V>>> entrySet() {
- return null;
- }
-
- @Override
- public Versioned<V> putIfAbsent(K key, V value) {
- return null;
- }
-
- @Override
- public boolean remove(K key, V value) {
- return false;
- }
-
- @Override
- public boolean remove(K key, long version) {
- return false;
- }
-
- @Override
- public boolean replace(K key, V oldValue, V newValue) {
- return false;
- }
-
- @Override
- public boolean replace(K key, long oldVersion, V newValue) {
- return false;
- }
-
- @Override
- public void addListener(MapEventListener<K, V> listener) {
-
- }
-
- @Override
- public void removeListener(MapEventListener<K, V> listener) {
-
- }
-
- @Override
- public Map<K, V> asJavaMap() {
- return null;
- }
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/DatabaseUpdateTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/DatabaseUpdateTest.java
deleted file mode 100644
index ad439d66..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/DatabaseUpdateTest.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.service;
-
-import com.google.common.testing.EqualsTester;
-import org.junit.Test;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-
-/**
- * Unit Tests for DatabseUpdate class.
- */
-
-public class DatabaseUpdateTest {
-
- private final DatabaseUpdate stats1 = DatabaseUpdate.newBuilder()
- .withCurrentValue("1".getBytes())
- .withValue("2".getBytes())
- .withCurrentVersion(3)
- .withKey("4")
- .withMapName("5")
- .withType(DatabaseUpdate.Type.PUT)
- .build();
-
- private final DatabaseUpdate stats2 = DatabaseUpdate.newBuilder()
- .withCurrentValue("1".getBytes())
- .withValue("2".getBytes())
- .withCurrentVersion(3)
- .withKey("4")
- .withMapName("5")
- .withType(DatabaseUpdate.Type.REMOVE)
- .build();
-
- private final DatabaseUpdate stats3 = DatabaseUpdate.newBuilder()
- .withCurrentValue("1".getBytes())
- .withValue("2".getBytes())
- .withCurrentVersion(3)
- .withKey("4")
- .withMapName("5")
- .withType(DatabaseUpdate.Type.REMOVE_IF_VALUE_MATCH)
- .build();
-
- private final DatabaseUpdate stats4 = DatabaseUpdate.newBuilder()
- .withCurrentValue("1".getBytes())
- .withValue("2".getBytes())
- .withCurrentVersion(3)
- .withKey("4")
- .withMapName("5")
- .withType(DatabaseUpdate.Type.REMOVE_IF_VERSION_MATCH)
- .build();
-
- private final DatabaseUpdate stats5 = DatabaseUpdate.newBuilder()
- .withCurrentValue("1".getBytes())
- .withValue("2".getBytes())
- .withCurrentVersion(3)
- .withKey("4")
- .withMapName("5")
- .withType(DatabaseUpdate.Type.PUT_IF_VALUE_MATCH)
- .build();
-
- private final DatabaseUpdate stats6 = DatabaseUpdate.newBuilder()
- .withCurrentValue("1".getBytes())
- .withValue("2".getBytes())
- .withCurrentVersion(3)
- .withKey("4")
- .withMapName("5")
- .withType(DatabaseUpdate.Type.PUT_IF_VERSION_MATCH)
- .build();
-
- /**
- * Tests the constructor for the class.
- */
- @Test
- public void testConstruction() {
- assertThat(stats1.currentValue(), is("1".getBytes()));
- assertThat(stats1.value(), is("2".getBytes()));
- assertThat(stats1.currentVersion(), is(3L));
- assertThat(stats1.key(), is("4"));
- assertThat(stats1.mapName(), is("5"));
- assertThat(stats1.type(), is(DatabaseUpdate.Type.PUT));
- }
-
- /**
- * Tests the equals, hashCode and toString methods using Guava EqualsTester.
- */
- @Test
- public void testEquals() {
- new EqualsTester()
- .addEqualityGroup(stats1, stats1)
- .addEqualityGroup(stats2)
- .testEquals();
-
- new EqualsTester()
- .addEqualityGroup(stats3, stats3)
- .addEqualityGroup(stats4)
- .testEquals();
-
- new EqualsTester()
- .addEqualityGroup(stats5, stats5)
- .addEqualityGroup(stats6)
- .testEquals();
- }
-
- /**
- * Tests if the toString method returns a consistent value for hashing.
- */
- @Test
- public void testToString() {
- assertThat(stats1.toString(), is(stats1.toString()));
- }
-
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/EventuallyConsistentMapAdapter.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/EventuallyConsistentMapAdapter.java
deleted file mode 100644
index 07f5fb4d..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/EventuallyConsistentMapAdapter.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.service;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.function.BiFunction;
-
-/**
- * Testing adapter for EventuallyConsistentMap.
- */
-public class EventuallyConsistentMapAdapter<K, V> implements EventuallyConsistentMap<K, V> {
- @Override
- public int size() {
- return 0;
- }
-
- @Override
- public boolean isEmpty() {
- return false;
- }
-
- @Override
- public boolean containsKey(K key) {
- return false;
- }
-
- @Override
- public boolean containsValue(V value) {
- return false;
- }
-
- @Override
- public V get(K key) {
- return null;
- }
-
- @Override
- public void put(K key, V value) {
-
- }
-
- @Override
- public V remove(K key) {
- return null;
- }
-
- @Override
- public void remove(K key, V value) {
-
- }
-
- @Override
- public V compute(K key, BiFunction<K, V, V> recomputeFunction) {
- return null;
- }
-
- @Override
- public void putAll(Map<? extends K, ? extends V> m) {
-
- }
-
- @Override
- public void clear() {
-
- }
-
- @Override
- public Set<K> keySet() {
- return null;
- }
-
- @Override
- public Collection<V> values() {
- return null;
- }
-
- @Override
- public Set<Map.Entry<K, V>> entrySet() {
- return null;
- }
-
- @Override
- public void addListener(EventuallyConsistentMapListener<K, V> listener) {
-
- }
-
- @Override
- public void removeListener(EventuallyConsistentMapListener<K, V> listener) {
-
- }
-
- @Override
- public void destroy() {
-
- }
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/EventuallyConsistentMapEventTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/EventuallyConsistentMapEventTest.java
deleted file mode 100644
index a4163cb6..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/EventuallyConsistentMapEventTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.service;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.PUT;
-import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.REMOVE;
-
-/**
- * Unit tests for the EventuallyConsistentMapEvent class.
- */
-public class EventuallyConsistentMapEventTest {
-
- EventuallyConsistentMapEvent<String, String> event1 =
- new EventuallyConsistentMapEvent<>("map1", PUT, "k1", "v1");
- EventuallyConsistentMapEvent<String, String> event2 =
- new EventuallyConsistentMapEvent<>("map1", REMOVE, "k1", "v1");
- EventuallyConsistentMapEvent<String, String> sameAsEvent2 =
- new EventuallyConsistentMapEvent<>("map1", REMOVE, "k1", "v1");
- EventuallyConsistentMapEvent<String, String> event3 =
- new EventuallyConsistentMapEvent<>("map1", PUT, "k2", "v1");
- EventuallyConsistentMapEvent<String, String> event4 =
- new EventuallyConsistentMapEvent<>("map1", PUT, "k1", "v2");
- EventuallyConsistentMapEvent<String, String> event5 =
- new EventuallyConsistentMapEvent<>("map2", REMOVE, "k1", "v2");
- EventuallyConsistentMapEvent<String, String> event6 =
- new EventuallyConsistentMapEvent<>("map3", REMOVE, "k1", "v2");
-
-
- /**
- * Checks the equals(), hashCode() and toString() operations.
- */
- @Test
- public void testEquals() {
- new EqualsTester()
- .addEqualityGroup(event1)
- .addEqualityGroup(event2, sameAsEvent2)
- .addEqualityGroup(event3)
- .addEqualityGroup(event4)
- .addEqualityGroup(event5)
- .addEqualityGroup(event6)
- .testEquals();
- }
-
- /**
- * Checks that the EventuallyConsistentMapEvent class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(EventuallyConsistentMapEvent.class);
- }
-
- /**
- * Checks that construction of the object is correct.
- */
- @Test
- public void testConstruction() {
- assertThat(event1.type(), is(PUT));
- assertThat(event1.key(), is("k1"));
- assertThat(event1.value(), is("v1"));
- assertThat(event1.name(), is("map1"));
- }
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/MapEventTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/MapEventTest.java
deleted file mode 100644
index 47fba6c9..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/MapEventTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.service;
-
-import com.google.common.testing.EqualsTester;
-import org.junit.Test;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-
-/**
- * MapEvent unit tests.
- */
-public class MapEventTest {
-
- private final Versioned<Integer> vStats = new Versioned<>(2, 1);
-
- private final MapEvent<String, Integer> stats1 = new MapEvent<>("a", MapEvent.Type.INSERT, "1", vStats);
-
- private final MapEvent<String, Integer> stats2 = new MapEvent<>("a", MapEvent.Type.REMOVE, "1", vStats);
-
- private final MapEvent<String, Integer> stats3 = new MapEvent<>("a", MapEvent.Type.UPDATE, "1", vStats);
-
- /**
- * Tests the creation of the MapEvent object.
- */
- @Test
- public void testConstruction() {
- assertThat(stats1.name(), is("a"));
- assertThat(stats1.type(), is(MapEvent.Type.INSERT));
- assertThat(stats1.key(), is("1"));
- assertThat(stats1.value(), is(vStats));
- }
-
- /**
- * Tests the equals, hashCode and toString methods using Guava EqualsTester.
- */
- @Test
- public void testEquals() {
- new EqualsTester()
- .addEqualityGroup(stats1, stats1)
- .addEqualityGroup(stats2)
- .addEqualityGroup(stats3)
- .testEquals();
- }
-
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/MultiValuedTimestampTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/MultiValuedTimestampTest.java
deleted file mode 100644
index 43475e45..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/MultiValuedTimestampTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.service;
-
-import com.google.common.testing.EqualsTester;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.lang.reflect.Constructor;
-import java.util.Arrays;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-
-/**
- * MultiValuedTimestamp unit tests.
- */
-public class MultiValuedTimestampTest {
-
- private final MultiValuedTimestamp<Integer, Integer> stats1 = new MultiValuedTimestamp<>(1, 3);
-
- private final MultiValuedTimestamp<Integer, Integer> stats2 = new MultiValuedTimestamp<>(1, 2);
-
-
- /**
- * Tests the creation of the MapEvent object.
- */
- @Test
- public void testConstruction() {
- assertThat(stats1.value1(), is(1));
- assertThat(stats1.value2(), is(3));
- }
-
- /**
- * Tests the toCompare function.
- */
- @Test
- public void testToCompare() {
- assertThat(stats1.compareTo(stats2), is(1));
- }
-
- /**
- * Tests the equals, hashCode and toString methods using Guava EqualsTester.
- */
- @Test
- public void testEquals() {
- new EqualsTester()
- .addEqualityGroup(stats1, stats1)
- .addEqualityGroup(stats2)
- .testEquals();
- }
-
- /**
- * Tests that the empty argument list constructor for serialization
- * is present and creates a proper object.
- */
- @Test
- public void testSerializerConstructor() {
- try {
- Constructor[] constructors = MultiValuedTimestamp.class.getDeclaredConstructors();
- assertThat(constructors, notNullValue());
- Arrays.stream(constructors).filter(ctor ->
- ctor.getParameterTypes().length == 0)
- .forEach(noParamsCtor -> {
- try {
- noParamsCtor.setAccessible(true);
- MultiValuedTimestamp stats =
- (MultiValuedTimestamp) noParamsCtor.newInstance();
- assertThat(stats, notNullValue());
- } catch (Exception e) {
- Assert.fail("Exception instantiating no parameters constructor");
- }
- });
- } catch (Exception e) {
- Assert.fail("Exception looking up constructors");
- }
- }
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/SetEventTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/SetEventTest.java
deleted file mode 100644
index 5cc89d85..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/SetEventTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.service;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-import static org.onosproject.store.service.SetEvent.Type.ADD;
-import static org.onosproject.store.service.SetEvent.Type.REMOVE;
-
-/**
- * Unit tests for the SetEvent class.
- */
-public class SetEventTest {
-
- SetEvent<String> event1 =
- new SetEvent<>("map1", ADD, "e1");
- SetEvent<String> event2 =
- new SetEvent<>("map1", REMOVE, "e1");
- SetEvent<String> sameAsEvent2 =
- new SetEvent<>("map1", REMOVE, "e1");
- SetEvent<String> event3 =
- new SetEvent<>("map1", ADD, "e2");
- SetEvent<String> event4 =
- new SetEvent<>("map1", REMOVE, "e2");
-
- /**
- * Checks that the SetEvent class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(EventuallyConsistentMapEvent.class);
- }
-
- /**
- * Checks the equals(), hashCode() and toString() operations.
- */
- @Test
- public void testEquals() {
- new EqualsTester()
- .addEqualityGroup(event1)
- .addEqualityGroup(event2, sameAsEvent2)
- .addEqualityGroup(event3)
- .addEqualityGroup(event4)
- .testEquals();
- }
-
- /**
- * Checks that construction of the object is correct.
- */
- @Test
- public void testConstruction() {
- assertThat(event1.type(), is(ADD));
- assertThat(event1.entry(), is("e1"));
- assertThat(event1.name(), is("map1"));
- }
-
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/StorageServiceAdapter.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/StorageServiceAdapter.java
deleted file mode 100644
index ec04e331..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/StorageServiceAdapter.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.service;
-
-/**
- * Adapter for the storage service.
- */
-public class StorageServiceAdapter implements StorageService {
- @Override
- public <K, V> EventuallyConsistentMapBuilder<K, V> eventuallyConsistentMapBuilder() {
- return null;
- }
-
- @Override
- public <K, V> ConsistentMapBuilder<K, V> consistentMapBuilder() {
- return null;
- }
-
- @Override
- public <E> DistributedSetBuilder<E> setBuilder() {
- return null;
- }
-
- @Override
- public <E> DistributedQueueBuilder<E> queueBuilder() {
- return null;
- }
-
- @Override
- public AtomicCounterBuilder atomicCounterBuilder() {
- return null;
- }
-
- @Override
- public <V> AtomicValueBuilder<V> atomicValueBuilder() {
- return null;
- }
-
- @Override
- public TransactionContextBuilder transactionContextBuilder() {
- return null;
- }
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestAtomicCounter.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestAtomicCounter.java
deleted file mode 100644
index 8c577df9..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestAtomicCounter.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.service;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * Test implementation of atomic counter.
- */
-public final class TestAtomicCounter implements AtomicCounter {
- final AtomicLong value;
-
- private TestAtomicCounter() {
- value = new AtomicLong();
- }
-
- @Override
- public long incrementAndGet() {
- return value.incrementAndGet();
- }
-
- @Override
- public long getAndIncrement() {
- return value.getAndIncrement();
- }
-
- @Override
- public long getAndAdd(long delta) {
- return value.getAndAdd(delta);
- }
-
- @Override
- public long addAndGet(long delta) {
- return value.addAndGet(delta);
- }
-
- @Override
- public void set(long value) {
- this.value.set(value);
- }
-
- @Override
- public boolean compareAndSet(long expectedValue, long updateValue) {
- return value.compareAndSet(expectedValue, updateValue);
- }
-
- @Override
- public long get() {
- return value.get();
- }
-
- public static AtomicCounterBuilder builder() {
- return new Builder();
- }
-
- public static class Builder implements AtomicCounterBuilder {
- @Override
- public AtomicCounterBuilder withName(String name) {
- return this;
- }
-
- @Override
- public AtomicCounterBuilder withPartitionsDisabled() {
- return this;
- }
-
- @Override
- public AtomicCounterBuilder withMeteringDisabled() {
- return this;
- }
-
- @Override
- public AsyncAtomicCounter buildAsyncCounter() {
- throw new UnsupportedOperationException("Async Counter is not supported");
- }
-
- @Override
- public AtomicCounter build() {
- return new TestAtomicCounter();
- }
- }
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestConsistentMap.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestConsistentMap.java
deleted file mode 100644
index 0136a94c..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestConsistentMap.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.service;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.function.BiFunction;
-import java.util.function.Function;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-
-import org.onosproject.core.ApplicationId;
-import static org.onosproject.store.service.MapEvent.Type;
-import static org.onosproject.store.service.MapEvent.Type.*;
-
-/**
- * Test implementation of the consistent map.
- */
-public final class TestConsistentMap<K, V> extends ConsistentMapAdapter<K, V> {
-
- private final List<MapEventListener<K, V>> listeners;
- private final HashMap<K, V> map;
- private final String mapName;
- private final AtomicLong counter = new AtomicLong(0);
-
- private TestConsistentMap(String mapName) {
- map = new HashMap<>();
- listeners = new LinkedList<>();
- this.mapName = mapName;
- }
-
- private Versioned<V> version(V v) {
- return new Versioned<>(v, counter.incrementAndGet(), System.currentTimeMillis());
- }
-
- /**
- * Notify all listeners of an event.
- */
- private void notifyListeners(String mapName, Type type,
- K key, Versioned<V> value) {
- MapEvent<K, V> event = new MapEvent<>(mapName, type, key, value);
- listeners.forEach(
- listener -> listener.event(event)
- );
- }
-
- @Override
- public int size() {
- return map.size();
- }
-
- @Override
- public boolean isEmpty() {
- return map.isEmpty();
- }
-
- @Override
- public boolean containsKey(K key) {
- return map.containsKey(key);
- }
-
- @Override
- public boolean containsValue(V value) {
- return map.containsValue(value);
- }
-
- @Override
- public Versioned<V> get(K key) {
- V value = map.get(key);
- if (value != null) {
- return version(value);
- } else {
- return null;
- }
- }
-
- @Override
- public Versioned<V> computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
- Versioned<V> result = version(map.computeIfAbsent(key, mappingFunction));
- notifyListeners(mapName, INSERT, key, result);
- return result;
- }
-
- @Override
- public Versioned<V> compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
- return version(map.compute(key, remappingFunction));
- }
-
- @Override
- public Versioned<V> computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
- return version(map.computeIfPresent(key, remappingFunction));
- }
-
- @Override
- public Versioned<V> computeIf(K key, Predicate<? super V> condition,
- BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
- return null;
- }
-
- @Override
- public Versioned<V> put(K key, V value) {
- Versioned<V> result = version(value);
- if (map.put(key, value) == null) {
- notifyListeners(mapName, INSERT, key, result);
- } else {
- notifyListeners(mapName, UPDATE, key, result);
- }
- return result;
- }
-
- @Override
- public Versioned<V> putAndGet(K key, V value) {
- Versioned<V> result = version(map.put(key, value));
- notifyListeners(mapName, UPDATE, key, result);
- return result;
- }
-
- @Override
- public Versioned<V> remove(K key) {
- Versioned<V> result = version(map.remove(key));
- notifyListeners(mapName, REMOVE, key, result);
- return result;
- }
-
- @Override
- public void clear() {
- map.clear();
- }
-
- @Override
- public Set<K> keySet() {
- return map.keySet();
- }
-
- @Override
- public Collection<Versioned<V>> values() {
- return map
- .values()
- .stream()
- .map(this::version)
- .collect(Collectors.toList());
- }
-
- @Override
- public Set<Map.Entry<K, Versioned<V>>> entrySet() {
- return super.entrySet();
- }
-
- @Override
- public Versioned<V> putIfAbsent(K key, V value) {
- Versioned<V> result = version(map.putIfAbsent(key, value));
- if (map.get(key).equals(value)) {
- notifyListeners(mapName, INSERT, key, result);
- }
- return result;
- }
-
- @Override
- public boolean remove(K key, V value) {
- boolean removed = map.remove(key, value);
- if (removed) {
- notifyListeners(mapName, REMOVE, key, null);
- }
- return removed;
- }
-
- @Override
- public boolean remove(K key, long version) {
- boolean removed = map.remove(key, version);
- if (removed) {
- notifyListeners(mapName, REMOVE, key, null);
- }
- return removed;
- }
-
- @Override
- public boolean replace(K key, V oldValue, V newValue) {
- boolean replaced = map.replace(key, oldValue, newValue);
- if (replaced) {
- notifyListeners(mapName, REMOVE, key, null);
- }
- return replaced;
- }
-
- @Override
- public boolean replace(K key, long oldVersion, V newValue) {
- boolean replaced = map.replace(key, map.get(key), newValue);
- if (replaced) {
- notifyListeners(mapName, REMOVE, key, null);
- }
- return replaced;
- }
-
- @Override
- public void addListener(MapEventListener<K, V> listener) {
- listeners.add(listener);
- }
-
- @Override
- public void removeListener(MapEventListener<K, V> listener) {
- listeners.remove(listener);
- }
-
- @Override
- public Map<K, V> asJavaMap() {
- return map;
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public static class Builder<K, V> implements ConsistentMapBuilder<K, V> {
- String mapName = "map";
-
- @Override
- public ConsistentMapBuilder<K, V> withName(String mapName) {
- this.mapName = mapName;
- return this;
- }
-
- @Override
- public ConsistentMapBuilder<K, V> withApplicationId(ApplicationId id) {
- return this;
- }
-
- @Override
- public ConsistentMapBuilder<K, V> withSerializer(Serializer serializer) {
- return this;
- }
-
- @Override
- public ConsistentMapBuilder<K, V> withPartitionsDisabled() {
- return this;
- }
-
- @Override
- public ConsistentMapBuilder<K, V> withUpdatesDisabled() {
- return this;
- }
-
- @Override
- public ConsistentMapBuilder<K, V> withPurgeOnUninstall() {
- return this;
- }
-
- @Override
- public ConsistentMapBuilder<K, V> withRelaxedReadConsistency() {
- return this;
- }
-
- @Override
- public ConsistentMapBuilder<K, V> withMeteringDisabled() {
- return this;
- }
-
- @Override
- public ConsistentMap<K, V> build() {
- return new TestConsistentMap<>(mapName);
- }
-
- @Override
- public AsyncConsistentMap<K, V> buildAsyncMap() {
- return null;
- }
-
- }
-
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestEventuallyConsistentMap.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestEventuallyConsistentMap.java
deleted file mode 100644
index 02462e85..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestEventuallyConsistentMap.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.service;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import java.util.function.BiFunction;
-
-import org.onlab.util.KryoNamespace;
-import org.onosproject.cluster.NodeId;
-import org.onosproject.store.Timestamp;
-
-import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.PUT;
-import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.REMOVE;
-
-/**
- * Testing version of an Eventually Consistent Map.
- */
-
-public final class TestEventuallyConsistentMap<K, V> extends EventuallyConsistentMapAdapter<K, V> {
-
- private final HashMap<K, V> map;
- private final String mapName;
- private final List<EventuallyConsistentMapListener<K, V>> listeners;
- private final BiFunction<K, V, Collection<NodeId>> peerUpdateFunction;
-
- private TestEventuallyConsistentMap(String mapName,
- BiFunction<K, V, Collection<NodeId>> peerUpdateFunction) {
- map = new HashMap<>();
- listeners = new LinkedList<>();
- this.mapName = mapName;
- this.peerUpdateFunction = peerUpdateFunction;
- }
-
- /**
- * Notify all listeners of an event.
- */
- private void notifyListeners(EventuallyConsistentMapEvent<K, V> event) {
- listeners.forEach(
- listener -> listener.event(event)
- );
- }
-
- @Override
- public int size() {
- return map.size();
- }
-
- @Override
- public boolean isEmpty() {
- return map.isEmpty();
- }
-
- @Override
- public boolean containsKey(K key) {
- return map.containsKey(key);
- }
-
- @Override
- public boolean containsValue(V value) {
- return map.containsValue(value);
- }
-
- @Override
- public V get(K key) {
- return map.get(key);
- }
-
- @Override
- public void put(K key, V value) {
- map.put(key, value);
- EventuallyConsistentMapEvent<K, V> addEvent =
- new EventuallyConsistentMapEvent<>(mapName, PUT, key, value);
- notifyListeners(addEvent);
- if (peerUpdateFunction != null) {
- peerUpdateFunction.apply(key, value);
- }
- }
-
- @Override
- public V remove(K key) {
- V result = map.remove(key);
- if (result != null) {
- EventuallyConsistentMapEvent<K, V> removeEvent =
- new EventuallyConsistentMapEvent<>(mapName, REMOVE,
- key, map.get(key));
- notifyListeners(removeEvent);
- }
- return result;
- }
-
- @Override
- public void remove(K key, V value) {
- boolean removed = map.remove(key, value);
- if (removed) {
- EventuallyConsistentMapEvent<K, V> removeEvent =
- new EventuallyConsistentMapEvent<>(mapName, REMOVE, key, value);
- notifyListeners(removeEvent);
- }
- }
-
- @Override
- public V compute(K key, BiFunction<K, V, V> recomputeFunction) {
- return map.compute(key, recomputeFunction);
- }
-
- @Override
- public void putAll(Map<? extends K, ? extends V> m) {
- map.putAll(m);
- }
-
- @Override
- public void clear() {
- map.clear();
- }
-
- @Override
- public Set<K> keySet() {
- return map.keySet();
- }
-
- @Override
- public Collection<V> values() {
- return map.values();
- }
-
- @Override
- public Set<Map.Entry<K, V>> entrySet() {
- return map.entrySet();
- }
-
- public static <K, V> Builder<K, V> builder() {
- return new Builder<>();
- }
-
- @Override
- public void addListener(EventuallyConsistentMapListener<K, V> listener) {
- listeners.add(listener);
- }
-
- @Override
- public void removeListener(EventuallyConsistentMapListener<K, V> listener) {
- listeners.remove(listener);
- }
-
- public static class Builder<K, V> implements EventuallyConsistentMapBuilder<K, V> {
- private String name;
- private BiFunction<K, V, Collection<NodeId>> peerUpdateFunction;
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withName(String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withSerializer(KryoNamespace.Builder serializerBuilder) {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V>
- withTimestampProvider(BiFunction<K, V, Timestamp> timestampProvider) {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withEventExecutor(ExecutorService executor) {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withCommunicationExecutor(ExecutorService executor) {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withBackgroundExecutor(ScheduledExecutorService executor) {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V>
- withPeerUpdateFunction(BiFunction<K, V, Collection<NodeId>> peerUpdateFunction) {
- this.peerUpdateFunction = peerUpdateFunction;
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withTombstonesDisabled() {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withAntiEntropyPeriod(long period, TimeUnit unit) {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withFasterConvergence() {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withPersistence() {
- return this;
- }
-
- @Override
- public EventuallyConsistentMap<K, V> build() {
- if (name == null) {
- name = "test";
- }
- return new TestEventuallyConsistentMap<>(name, peerUpdateFunction);
- }
- }
-
-}
-
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestStorageService.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestStorageService.java
deleted file mode 100644
index 9b52a305..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestStorageService.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.service;
-
-public class TestStorageService extends StorageServiceAdapter {
-
-
- @Override
- public <K, V> EventuallyConsistentMapBuilder<K, V> eventuallyConsistentMapBuilder() {
- return TestEventuallyConsistentMap.builder();
- }
-
- @Override
- public <K, V> ConsistentMapBuilder<K, V> consistentMapBuilder() {
- return TestConsistentMap.builder();
- }
-
- @Override
- public <E> DistributedSetBuilder<E> setBuilder() {
- throw new UnsupportedOperationException("setBuilder");
- }
-
- @Override
- public <E> DistributedQueueBuilder<E> queueBuilder() {
- throw new UnsupportedOperationException("queueBuilder");
- }
-
- @Override
- public AtomicCounterBuilder atomicCounterBuilder() {
- return TestAtomicCounter.builder();
- }
-
- @Override
- public <V> AtomicValueBuilder<V> atomicValueBuilder() {
- throw new UnsupportedOperationException("atomicValueBuilder");
- }
-
- @Override
- public TransactionContextBuilder transactionContextBuilder() {
- throw new UnsupportedOperationException("transactionContextBuilder");
- }
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/VersionedTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/VersionedTest.java
deleted file mode 100644
index fbe3271b..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/VersionedTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.service;
-
-import com.google.common.testing.EqualsTester;
-import org.junit.Test;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-
-/**
- * Versioned unit tests.
- */
-public class VersionedTest {
-
- private final Versioned<Integer> stats1 = new Versioned<>(1, 2, 3);
-
- private final Versioned<Integer> stats2 = new Versioned<>(1, 2);
-
- /**
- * Tests the creation of the MapEvent object.
- */
- @Test
- public void testConstruction() {
- assertThat(stats1.value(), is(1));
- assertThat(stats1.version(), is(2L));
- assertThat(stats1.creationTime(), is(3L));
- }
-
- /**
- * Maps an Integer to a String - Utility function to test the map function.
- * @param a Actual Integer parameter.
- * @return String Mapped valued.
- */
- public static String transform(Integer a) {
- return Integer.toString(a);
- }
-
- /**
- * Tests the map function.
- */
- @Test
- public void testMap() {
- Versioned<String> tempObj = stats1.<String>map(VersionedTest::transform);
- assertThat(tempObj.value(), is("1"));
- }
-
- /**
- * Tests the valueOrElse method.
- */
- @Test
- public void testOrElse() {
- Versioned<String> vv = new Versioned<>("foo", 1);
- Versioned<String> nullVV = null;
- assertThat(Versioned.valueOrElse(vv, "bar"), is("foo"));
- assertThat(Versioned.valueOrElse(nullVV, "bar"), is("bar"));
- }
-
- /**
- * Tests the equals, hashCode and toString methods using Guava EqualsTester.
- */
- @Test
- public void testEquals() {
- new EqualsTester()
- .addEqualityGroup(stats1, stats1)
- .addEqualityGroup(stats2)
- .testEquals();
- }
-
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/WallClockTimestampTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/WallClockTimestampTest.java
deleted file mode 100644
index 97f5a39b..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/WallClockTimestampTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.store.service;
-
-import static org.junit.Assert.assertTrue;
-
-import java.nio.ByteBuffer;
-
-import org.junit.Test;
-import org.onosproject.store.Timestamp;
-import org.onlab.util.KryoNamespace;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Tests for {@link WallClockTimestamp}.
- */
-public class WallClockTimestampTest {
-
- @Test
- public final void testBasic() throws InterruptedException {
- WallClockTimestamp ts1 = new WallClockTimestamp();
- Thread.sleep(50);
- WallClockTimestamp ts2 = new WallClockTimestamp();
- long stamp = System.currentTimeMillis() + 10000;
- WallClockTimestamp ts3 = new WallClockTimestamp(stamp);
-
-
- assertTrue(ts1.compareTo(ts1) == 0);
- assertTrue(ts2.compareTo(ts1) > 0);
- assertTrue(ts1.compareTo(ts2) < 0);
- assertTrue(ts3.unixTimestamp() == stamp);
- }
-
- @Test
- public final void testKryoSerializable() {
- WallClockTimestamp ts1 = new WallClockTimestamp();
- WallClockTimestamp ts2 = new WallClockTimestamp(System.currentTimeMillis() + 10000);
- final ByteBuffer buffer = ByteBuffer.allocate(1 * 1024 * 1024);
- final KryoNamespace kryos = KryoNamespace.newBuilder()
- .register(WallClockTimestamp.class)
- .build();
-
- kryos.serialize(ts1, buffer);
- buffer.flip();
- Timestamp copy = kryos.deserialize(buffer);
-
- new EqualsTester()
- .addEqualityGroup(ts1, copy)
- .addEqualityGroup(ts2)
- .testEquals();
- }
-}