summaryrefslogtreecommitdiffstats
path: root/framework/src/onos/core/api/src/test/java/org/onosproject/net/provider
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/core/api/src/test/java/org/onosproject/net/provider')
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/net/provider/AbstractProviderRegistryTest.java108
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/net/provider/AbstractProviderTest.java33
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/net/provider/ProviderIdTest.java35
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/net/provider/TestProvider.java32
4 files changed, 0 insertions, 208 deletions
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/provider/AbstractProviderRegistryTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/provider/AbstractProviderRegistryTest.java
deleted file mode 100644
index f08d93bd..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/provider/AbstractProviderRegistryTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2014 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.net.provider;
-
-import org.junit.Test;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-
-/**
- * Test of the base provider registry.
- */
-public class AbstractProviderRegistryTest {
-
- private class TestProviderService extends AbstractProviderService<TestProvider> {
- protected TestProviderService(TestProvider provider) {
- super(provider);
- }
- }
-
- private class TestProviderRegistry extends AbstractProviderRegistry<TestProvider, TestProviderService> {
- @Override
- protected TestProviderService createProviderService(TestProvider provider) {
- return new TestProviderService(provider);
- }
- }
-
- @Test
- public void basics() {
- TestProviderRegistry registry = new TestProviderRegistry();
- assertEquals("incorrect provider count", 0, registry.getProviders().size());
-
- ProviderId fooId = new ProviderId("of", "foo");
- TestProvider pFoo = new TestProvider(fooId);
- TestProviderService psFoo = registry.register(pFoo);
- assertEquals("incorrect provider count", 1, registry.getProviders().size());
- assertThat("provider not found", registry.getProviders().contains(fooId));
- assertEquals("incorrect provider", psFoo.provider(), pFoo);
-
- ProviderId barId = new ProviderId("snmp", "bar");
- TestProvider pBar = new TestProvider(barId);
- TestProviderService psBar = registry.register(pBar);
- assertEquals("incorrect provider count", 2, registry.getProviders().size());
- assertThat("provider not found", registry.getProviders().contains(barId));
- assertEquals("incorrect provider", psBar.provider(), pBar);
-
- psFoo.checkValidity();
- registry.unregister(pFoo);
- psBar.checkValidity();
- assertEquals("incorrect provider count", 1, registry.getProviders().size());
- assertThat("provider not found", registry.getProviders().contains(barId));
- }
-
- @Test
- public void ancillaryProviders() {
- TestProviderRegistry registry = new TestProviderRegistry();
- TestProvider pFoo = new TestProvider(new ProviderId("of", "foo"));
- TestProvider pBar = new TestProvider(new ProviderId("of", "bar", true));
- registry.register(pFoo);
- registry.register(pBar);
- assertEquals("incorrect provider count", 2, registry.getProviders().size());
- }
-
- @Test(expected = IllegalStateException.class)
- public void duplicateRegistration() {
- TestProviderRegistry registry = new TestProviderRegistry();
- TestProvider pFoo = new TestProvider(new ProviderId("of", "foo"));
- registry.register(pFoo);
- registry.register(pFoo);
- }
-
- @Test(expected = IllegalStateException.class)
- public void duplicateSchemeRegistration() {
- TestProviderRegistry registry = new TestProviderRegistry();
- TestProvider pFoo = new TestProvider(new ProviderId("of", "foo"));
- TestProvider pBar = new TestProvider(new ProviderId("of", "bar"));
- registry.register(pFoo);
- registry.register(pBar);
- }
-
- @Test
- public void voidUnregistration() {
- TestProviderRegistry registry = new TestProviderRegistry();
- registry.unregister(new TestProvider(new ProviderId("of", "foo")));
- }
-
- @Test(expected = IllegalStateException.class)
- public void unregistration() {
- TestProviderRegistry registry = new TestProviderRegistry();
- TestProvider pFoo = new TestProvider(new ProviderId("of", "foo"));
- TestProviderService psFoo = registry.register(pFoo);
- registry.unregister(pFoo);
- psFoo.checkValidity();
- }
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/provider/AbstractProviderTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/provider/AbstractProviderTest.java
deleted file mode 100644
index e9e06c76..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/provider/AbstractProviderTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2014 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.net.provider;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Test of the base provider implementation.
- */
-public class AbstractProviderTest {
-
- @Test
- public void basics() {
- ProviderId id = new ProviderId("of", "foo.bar");
- TestProvider provider = new TestProvider(id);
- assertEquals("incorrect id", id, provider.id());
- }
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/provider/ProviderIdTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/provider/ProviderIdTest.java
deleted file mode 100644
index 7e973991..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/provider/ProviderIdTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2014 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.net.provider;
-
-import com.google.common.testing.EqualsTester;
-import org.junit.Test;
-
-/**
- * Test of the provider identifier.
- */
-public class ProviderIdTest {
-
- @Test
- public void basics() {
- new EqualsTester()
- .addEqualityGroup(new ProviderId("of", "foo"), new ProviderId("of", "foo"))
- .addEqualityGroup(new ProviderId("snmp", "foo"), new ProviderId("snmp", "foo"))
- .addEqualityGroup(new ProviderId("of", "bar"))
- .testEquals();
- }
-
-}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/provider/TestProvider.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/provider/TestProvider.java
deleted file mode 100644
index 2f521bbb..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/provider/TestProvider.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2014 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.net.provider;
-
-/**
- * Test provider fixture.
- */
-public class TestProvider extends AbstractProvider {
-
- /**
- * Creates a provider with the supplier identifier.
- *
- * @param id provider id
- */
- protected TestProvider(ProviderId id) {
- super(id);
- }
-
-}