Refactor PCE and PCEP test adapters to remove redundant classes
Change-Id: I407c3dcd42588c03ba7f5c438d0bf61409d64d69
diff --git a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/PcepClientAdapter.java b/protocols/pcep/server/api/src/test/java/org/onosproject/pcep/server/PcepClientAdapter.java
similarity index 93%
rename from protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/PcepClientAdapter.java
rename to protocols/pcep/server/api/src/test/java/org/onosproject/pcep/server/PcepClientAdapter.java
index 7ab16ef..6e503ef 100644
--- a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/PcepClientAdapter.java
+++ b/protocols/pcep/server/api/src/test/java/org/onosproject/pcep/server/PcepClientAdapter.java
@@ -13,26 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.pcelabelstore.util;
+package org.onosproject.pcep.server;
-import static org.junit.Assert.assertNotNull;
+import org.jboss.netty.channel.Channel;
+import org.onosproject.pcepio.protocol.PcepFactories;
+import org.onosproject.pcepio.protocol.PcepFactory;
+import org.onosproject.pcepio.protocol.PcepMessage;
+import org.onosproject.pcepio.protocol.PcepStateReport;
+import org.onosproject.pcepio.protocol.PcepVersion;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.RejectedExecutionException;
-import org.jboss.netty.channel.Channel;
-import org.onosproject.pcep.server.ClientCapability;
-import org.onosproject.pcep.server.PccId;
-import org.onosproject.pcep.server.LspKey;
-import org.onosproject.pcep.server.PcepClient;
-import org.onosproject.pcep.server.PcepSyncStatus;
-import org.onosproject.pcepio.protocol.PcepFactories;
-import org.onosproject.pcepio.protocol.PcepFactory;
-import org.onosproject.pcepio.protocol.PcepMessage;
-import org.onosproject.pcepio.protocol.PcepStateReport;
-import org.onosproject.pcepio.protocol.PcepVersion;
+import static org.junit.Assert.assertNotNull;
/**
* Representation of PCEP client adapter.
@@ -94,7 +89,7 @@
@Override
public final PccId getPccId() {
return this.pccId;
- };
+ }
@Override
public final String getStringId() {
diff --git a/protocols/pcep/server/api/src/test/java/org/onosproject/pcep/server/PcepClientControllerAdapter.java b/protocols/pcep/server/api/src/test/java/org/onosproject/pcep/server/PcepClientControllerAdapter.java
new file mode 100644
index 0000000..80e6561
--- /dev/null
+++ b/protocols/pcep/server/api/src/test/java/org/onosproject/pcep/server/PcepClientControllerAdapter.java
@@ -0,0 +1,335 @@
+/*
+ * Copyright 2016-present Open Networking Foundation
+ *
+ * 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.pcep.server;
+
+
+import com.google.common.collect.Sets;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.onlab.packet.IpAddress;
+import org.onosproject.incubator.net.tunnel.DefaultLabelStack;
+import org.onosproject.incubator.net.tunnel.LabelStack;
+import org.onosproject.incubator.net.tunnel.Tunnel;
+import org.onosproject.net.Path;
+import org.onosproject.pcep.server.driver.PcepAgent;
+import org.onosproject.pcepio.protocol.PcepError;
+import org.onosproject.pcepio.protocol.PcepErrorInfo;
+import org.onosproject.pcepio.protocol.PcepErrorMsg;
+import org.onosproject.pcepio.protocol.PcepErrorObject;
+import org.onosproject.pcepio.protocol.PcepFactory;
+import org.onosproject.pcepio.protocol.PcepMessage;
+import org.onosproject.pcepio.protocol.PcepVersion;
+import org.onosproject.pcepio.types.PcepValueType;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import static org.onosproject.pcepio.types.PcepErrorDetailInfo.ERROR_TYPE_19;
+import static org.onosproject.pcepio.types.PcepErrorDetailInfo.ERROR_VALUE_5;
+
+/**
+ * Representation of PCEP client controller adapter.
+ */
+public class PcepClientControllerAdapter implements PcepClientController {
+
+ protected ConcurrentHashMap<PccId, PcepClient> connectedClients =
+ new ConcurrentHashMap<PccId, PcepClient>();
+
+ protected PcepClientAgent agent = new PcepClientAgent();
+ protected Set<PcepClientListener> pcepClientListener = new HashSet<>();
+
+ protected Set<PcepEventListener> pcepEventListener = Sets.newHashSet();
+ public Set<PcepNodeListener> pcepNodeListener = Sets.newHashSet();
+
+ @Activate
+ public void activate() {
+ }
+
+ @Deactivate
+ public void deactivate() {
+ }
+
+ @Override
+ public Collection<PcepClient> getClients() {
+ return connectedClients.values();
+ }
+
+ @Override
+ public PcepClient getClient(PccId pccId) {
+ if (null != connectedClients.get(pccId)) {
+ return connectedClients.get(pccId);
+ }
+ PcepClientAdapter pc = new PcepClientAdapter();
+ if (pccId.ipAddress().equals(IpAddress.valueOf(0xC010103))
+ || pccId.ipAddress().equals(IpAddress.valueOf(0xB6024E22))) {
+ pc.setCapability(new ClientCapability(true, false, false, false, false));
+ } else {
+ pc.setCapability(new ClientCapability(true, true, true, false, false));
+ }
+ pc.init(PccId.pccId(pccId.ipAddress()), PcepVersion.PCEP_1);
+ connectedClients.put(pccId, pc);
+ return pc;
+ }
+
+ @Override
+ public void addListener(PcepClientListener listener) {
+ if (!pcepClientListener.contains(listener)) {
+ this.pcepClientListener.add(listener);
+ }
+ }
+
+ @Override
+ public void addNodeListener(PcepNodeListener listener) {
+ pcepNodeListener.add(listener);
+ }
+
+ @Override
+ public void removeNodeListener(PcepNodeListener listener) {
+ pcepNodeListener.remove(listener);
+ }
+
+ @Override
+ public void removeListener(PcepClientListener listener) {
+ this.pcepClientListener.remove(listener);
+ }
+
+ @Override
+ public void addEventListener(PcepEventListener listener) {
+ pcepEventListener.add(listener);
+ }
+
+ @Override
+ public void removeEventListener(PcepEventListener listener) {
+ pcepEventListener.remove(listener);
+ }
+
+ @Override
+ public void writeMessage(PccId pccId, PcepMessage msg) {
+ this.getClient(pccId).sendMessage(msg);
+ }
+
+ @Override
+ public void processClientMessage(PccId pccId, PcepMessage msg) {
+
+ PcepClient pc = getClient(pccId);
+
+ switch (msg.getType()) {
+ case NONE:
+ break;
+ case OPEN:
+ break;
+ case KEEP_ALIVE:
+ //log.debug("Sending Keep Alive Message to {" + pccIpAddress.toString() + "}");
+ pc.sendMessage(Collections.singletonList(pc.factory().buildKeepaliveMsg().build()));
+ break;
+ case PATH_COMPUTATION_REQUEST:
+ break;
+ case PATH_COMPUTATION_REPLY:
+ break;
+ case NOTIFICATION:
+ break;
+ case ERROR:
+ break;
+ case CLOSE:
+ //log.debug("Sending Close Message to { }", pccIpAddress.toString());
+ pc.sendMessage(Collections.singletonList(pc.factory().buildCloseMsg().build()));
+ break;
+ case INITIATE:
+ if (!pc.capability().pcInstantiationCapability()) {
+ pc.sendMessage(Collections.singletonList(getErrMsg(pc.factory(),
+ ERROR_TYPE_19, ERROR_VALUE_5)));
+ }
+ break;
+ case REPORT:
+ //Only update the listener if respective capability is supported else send PCEP-ERR msg
+ if (pc.capability().statefulPceCapability()) {
+ for (PcepEventListener l : pcepEventListener) {
+ l.handleMessage(pccId, msg);
+ }
+ } else {
+ // Send PCEP-ERROR message.
+ pc.sendMessage(Collections.singletonList(getErrMsg(pc.factory(),
+ ERROR_TYPE_19, ERROR_VALUE_5)));
+ }
+ break;
+ case UPDATE:
+ if (!pc.capability().statefulPceCapability()) {
+ pc.sendMessage(Collections.singletonList(getErrMsg(pc.factory(),
+ ERROR_TYPE_19, ERROR_VALUE_5)));
+ }
+ break;
+ case LABEL_UPDATE:
+ if (!pc.capability().pceccCapability()) {
+ pc.sendMessage(Collections.singletonList(getErrMsg(pc.factory(),
+ ERROR_TYPE_19, ERROR_VALUE_5)));
+ }
+ break;
+ case MAX:
+ break;
+ case END:
+ break;
+ default:
+ break;
+ }
+ }
+
+ @Override
+ public void closeConnectedClients() {
+ PcepClient pc;
+ for (PccId id : connectedClients.keySet()) {
+ pc = getClient(id);
+ pc.disconnectClient();
+ }
+ }
+
+ private PcepErrorMsg getErrMsg(PcepFactory factory, byte errorType, byte errorValue) {
+ LinkedList<PcepError> llPcepErr = new LinkedList<>();
+
+ LinkedList<PcepErrorObject> llerrObj = new LinkedList<>();
+ PcepErrorMsg errMsg;
+
+ PcepErrorObject errObj = factory.buildPcepErrorObject().setErrorValue(errorValue).setErrorType(errorType)
+ .build();
+
+ llerrObj.add(errObj);
+ PcepError pcepErr = factory.buildPcepError().setErrorObjList(llerrObj).build();
+
+ llPcepErr.add(pcepErr);
+
+ PcepErrorInfo errInfo = factory.buildPcepErrorInfo().setPcepErrorList(llPcepErr).build();
+
+ errMsg = factory.buildPcepErrorMsg().setPcepErrorInfo(errInfo).build();
+ return errMsg;
+ }
+
+ /**
+ * Implementation of an Pcep Agent which is responsible for
+ * keeping track of connected clients and the state in which
+ * they are.
+ */
+ public class PcepClientAgent implements PcepAgent {
+
+ @Override
+ public boolean addConnectedClient(PccId pccId, PcepClient pc) {
+
+ if (connectedClients.get(pccId) != null) {
+ return false;
+ } else {
+ connectedClients.put(pccId, pc);
+ for (PcepClientListener l : pcepClientListener) {
+ l.clientConnected(pccId);
+ }
+ return true;
+ }
+ }
+
+ @Override
+ public boolean validActivation(PccId pccId) {
+ if (connectedClients.get(pccId) == null) {
+ //log.error("Trying to activate client but is not in "
+ // + "connected switches: pccIp {}. Aborting ..", pccIpAddress.toString());
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public void removeConnectedClient(PccId pccId) {
+ connectedClients.remove(pccId);
+ for (PcepClientListener l : pcepClientListener) {
+ //log.warn("removal for {}", pccIpAddress.toString());
+ l.clientDisconnected(pccId);
+ }
+ }
+
+ @Override
+ public void processPcepMessage(PccId pccId, PcepMessage m) {
+ processClientMessage(pccId, m);
+ }
+
+ @Override
+ public void addNode(PcepClient pc) {
+ for (PcepNodeListener l : pcepNodeListener) {
+ l.addDevicePcepConfig(pc);
+ }
+ }
+
+ @Override
+ public void deleteNode(PccId pccId) {
+ for (PcepNodeListener l : pcepNodeListener) {
+ l.deleteDevicePcepConfig(pccId);
+ }
+ }
+
+ @Override
+ public boolean analyzeSyncMsgList(PccId pccId) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+ }
+
+ @Override
+ public LabelStack computeLabelStack(Path path) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public LinkedList<PcepValueType> createPcepLabelStack(DefaultLabelStack labelStack, Path path) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Map<String, List<String>> getPcepExceptions() {
+ return null;
+ }
+
+ @Override
+ public Map<Integer, Integer> getPcepErrorMsg() {
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getPcepSessionMap() {
+ return null;
+ }
+
+ @Override
+ public Map<String, Byte> getPcepSessionIdMap() {
+ return null;
+ }
+
+ @Override
+ public void peerErrorMsg(String peerId, Integer errorType, Integer errValue) {
+ return;
+ }
+
+
+ @Override
+ public boolean allocateLocalLabel(Tunnel tunnel) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+}
+
diff --git a/protocols/pcep/server/ctl/BUCK b/protocols/pcep/server/ctl/BUCK
index e247e20..29e7fbf 100644
--- a/protocols/pcep/server/ctl/BUCK
+++ b/protocols/pcep/server/ctl/BUCK
@@ -11,7 +11,15 @@
'//lib:netty',
]
+TEST_DEPS = [
+ '//lib:TEST',
+ '//lib:TEST_ADAPTERS',
+ '//incubator/api:onos-incubator-api-tests',
+ '//protocols/pcep/server/api:onos-protocols-pcep-server-api-tests',
+]
+
osgi_jar_with_tests (
deps = COMPILE_DEPS,
+ test_deps = TEST_DEPS,
)
diff --git a/protocols/pcep/server/ctl/pom.xml b/protocols/pcep/server/ctl/pom.xml
index b6fae75..ad22a9a 100644
--- a/protocols/pcep/server/ctl/pom.xml
+++ b/protocols/pcep/server/ctl/pom.xml
@@ -55,6 +55,26 @@
<artifactId>onos-core-serializers</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-api</artifactId>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-incubator-api</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-pcep-server-api</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ </dependency>
</dependencies>
<build>
diff --git a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/PceLabelStoreAdapter.java b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/api/PceLabelStoreAdapter.java
similarity index 91%
rename from protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/PceLabelStoreAdapter.java
rename to protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/api/PceLabelStoreAdapter.java
index 23ed95f..598fb78 100644
--- a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/PceLabelStoreAdapter.java
+++ b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/api/PceLabelStoreAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-present Open Networking Foundation
+ * Copyright 2018-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,22 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.pcelabelstore.util;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
+package org.onosproject.pcelabelstore.api;
import org.onosproject.incubator.net.resource.label.LabelResourceId;
import org.onosproject.incubator.net.tunnel.TunnelId;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Link;
-import org.onosproject.pcelabelstore.api.LspLocalLabelInfo;
-import org.onosproject.pcelabelstore.api.PceLabelStore;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.stream.Collectors;
/**
* Provides test implementation of PceStore.
@@ -89,14 +87,14 @@
@Override
public Map<DeviceId, LabelResourceId> getGlobalNodeLabels() {
- return globalNodeLabelMap.entrySet().stream()
- .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue()));
+ return globalNodeLabelMap.entrySet().stream()
+ .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue()));
}
@Override
public Map<Link, LabelResourceId> getAdjLabels() {
- return adjLabelMap.entrySet().stream()
- .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue()));
+ return adjLabelMap.entrySet().stream()
+ .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue()));
}
@Override
diff --git a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/label/BasicPceccHandlerTest.java b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/label/BasicPceccHandlerTest.java
index 7b3a92c..856c1fd 100644
--- a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/label/BasicPceccHandlerTest.java
+++ b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/label/BasicPceccHandlerTest.java
@@ -15,49 +15,50 @@
*/
package org.onosproject.pcelabelstore.label;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.hamcrest.Matchers.nullValue;
-import static org.onosproject.net.Link.Type.DIRECT;
-import java.util.Iterator;
-import java.util.List;
-import java.util.LinkedList;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onlab.graph.ScalarWeight;
import org.onlab.packet.IpAddress;
import org.onosproject.core.GroupId;
-import org.onosproject.incubator.net.tunnel.Tunnel;
-import org.onosproject.incubator.net.tunnel.TunnelEndPoint;
-import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint;
-import org.onosproject.incubator.net.tunnel.TunnelName;
-import org.onosproject.incubator.net.tunnel.TunnelId;
-import org.onosproject.incubator.net.tunnel.DefaultTunnel;
+import org.onosproject.incubator.net.resource.label.LabelResourceAdapter;
import org.onosproject.incubator.net.resource.label.LabelResourceId;
import org.onosproject.incubator.net.resource.label.LabelResourceService;
+import org.onosproject.incubator.net.tunnel.DefaultTunnel;
+import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint;
+import org.onosproject.incubator.net.tunnel.Tunnel;
+import org.onosproject.incubator.net.tunnel.TunnelEndPoint;
+import org.onosproject.incubator.net.tunnel.TunnelId;
+import org.onosproject.incubator.net.tunnel.TunnelName;
import org.onosproject.net.AnnotationKeys;
import org.onosproject.net.Annotations;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DefaultAnnotations;
import org.onosproject.net.DefaultDevice;
+import org.onosproject.net.DefaultLink;
import org.onosproject.net.DefaultPath;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
+import org.onosproject.net.Link;
import org.onosproject.net.Path;
+import org.onosproject.net.PortNumber;
import org.onosproject.net.provider.ProviderId;
import org.onosproject.pcelabelstore.api.LspLocalLabelInfo;
import org.onosproject.pcelabelstore.api.PceLabelStore;
-import org.onosproject.pcelabelstore.util.LabelResourceAdapter;
+import org.onosproject.pcelabelstore.api.PceLabelStoreAdapter;
import org.onosproject.pcelabelstore.util.MockDeviceService;
-import org.onosproject.pcelabelstore.util.PceLabelStoreAdapter;
import org.onosproject.pcep.server.impl.BasicPceccHandler;
import org.onosproject.pcep.server.impl.PcepClientControllerImpl;
-import org.onosproject.net.DefaultLink;
-import org.onosproject.net.Link;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.hamcrest.Matchers.nullValue;
+import static org.onosproject.net.Link.Type.DIRECT;
/**
* Unit tests for BasicPceccHandler class.
diff --git a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/label/PceccSrTeBeHandlerTest.java b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/label/PceccSrTeBeHandlerTest.java
index a9bc3bc..cf832c4 100644
--- a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/label/PceccSrTeBeHandlerTest.java
+++ b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/label/PceccSrTeBeHandlerTest.java
@@ -15,22 +15,14 @@
*/
package org.onosproject.pcelabelstore.label;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.hamcrest.Matchers.nullValue;
-import static org.onosproject.net.Link.Type.DIRECT;
-import java.util.Iterator;
-import java.util.List;
-import java.util.LinkedList;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onlab.graph.ScalarWeight;
import org.onlab.packet.IpAddress;
-import org.onosproject.incubator.net.resource.label.LabelResourceId;
+import org.onosproject.incubator.net.resource.label.LabelResourceAdapter;
import org.onosproject.incubator.net.resource.label.LabelResourceAdminService;
+import org.onosproject.incubator.net.resource.label.LabelResourceId;
import org.onosproject.incubator.net.resource.label.LabelResourceService;
import org.onosproject.incubator.net.tunnel.LabelStack;
import org.onosproject.net.AnnotationKeys;
@@ -38,25 +30,34 @@
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DefaultAnnotations;
import org.onosproject.net.DefaultDevice;
+import org.onosproject.net.DefaultLink;
import org.onosproject.net.DefaultPath;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
+import org.onosproject.net.Link;
import org.onosproject.net.Path;
+import org.onosproject.net.PortNumber;
import org.onosproject.net.provider.ProviderId;
import org.onosproject.pcelabelstore.api.PceLabelStore;
-import org.onosproject.pcelabelstore.util.LabelResourceAdapter;
+import org.onosproject.pcelabelstore.api.PceLabelStoreAdapter;
import org.onosproject.pcelabelstore.util.MockDeviceService;
import org.onosproject.pcelabelstore.util.MockNetConfigRegistryAdapter;
import org.onosproject.pcelabelstore.util.MockPcepClientController;
-import org.onosproject.pcelabelstore.util.PceLabelStoreAdapter;
-import org.onosproject.pcelabelstore.util.PcepClientAdapter;
+import org.onosproject.pcep.server.PcepClientAdapter;
import org.onosproject.pcep.api.DeviceCapability;
import org.onosproject.pcep.server.PccId;
import org.onosproject.pcep.server.impl.PceccSrTeBeHandler;
import org.onosproject.pcepio.protocol.PcepVersion;
-import org.onosproject.net.DefaultLink;
-import org.onosproject.net.Link;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.hamcrest.Matchers.nullValue;
+import static org.onosproject.net.Link.Type.DIRECT;
/**
* Unit tests for PceccSrTeBeHandler class.
diff --git a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/ConsistentMapAdapter.java b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/ConsistentMapAdapter.java
deleted file mode 100644
index 8111693..0000000
--- a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/ConsistentMapAdapter.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * 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.pcelabelstore.util;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Executor;
-import java.util.function.BiFunction;
-import java.util.function.Function;
-import java.util.function.Predicate;
-
-import org.onosproject.store.service.ConsistentMap;
-import org.onosproject.store.service.DistributedPrimitive;
-import org.onosproject.store.service.MapEventListener;
-import org.onosproject.store.service.Versioned;
-
-/**
- * Testing adapter for the consistent map.
- */
-public class ConsistentMapAdapter<K, V> implements ConsistentMap<K, V> {
-
- @Override
- public String name() {
- return null;
- }
-
- @Override
- public DistributedPrimitive.Type primitiveType() {
- return DistributedPrimitive.Type.CONSISTENT_MAP;
- }
-
- @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> getOrDefault(K key, V defaultValue) {
- 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 Versioned replace(K key, V value) {
- return null;
- }
-
- @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, Executor executor) {
-
- }
-
- @Override
- public void removeListener(MapEventListener<K, V> listener) {
-
- }
-
- @Override
- public Map<K, V> asJavaMap() {
- return null;
- }
-}
diff --git a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/DistributedSetAdapter.java b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/DistributedSetAdapter.java
deleted file mode 100644
index ae457b1..0000000
--- a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/DistributedSetAdapter.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * 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.pcelabelstore.util;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.concurrent.CompletableFuture;
-
-import org.onosproject.store.service.AsyncDistributedSet;
-import org.onosproject.store.service.SetEventListener;
-
-/**
- * Testing adapter for the distributed set.
- */
-public class DistributedSetAdapter<E> implements AsyncDistributedSet<E> {
- @Override
- public CompletableFuture<Void> addListener(SetEventListener<E> listener) {
- return null;
- }
-
- @Override
- public CompletableFuture<Void> removeListener(SetEventListener<E> listener) {
- return null;
- }
-
- @Override
- public CompletableFuture<Boolean> add(E element) {
- return null;
- }
-
- @Override
- public CompletableFuture<Boolean> remove(E element) {
- return null;
- }
-
- @Override
- public CompletableFuture<Integer> size() {
- return null;
- }
-
- @Override
- public CompletableFuture<Boolean> isEmpty() {
- return null;
- }
-
- @Override
- public CompletableFuture<Void> clear() {
- return null;
- }
-
- @Override
- public CompletableFuture<Boolean> contains(E element) {
- return null;
- }
-
- @Override
- public CompletableFuture<Boolean> addAll(Collection<? extends E> c) {
- return null;
- }
-
- @Override
- public CompletableFuture<Boolean> containsAll(Collection<? extends E> c) {
- return null;
- }
-
- @Override
- public CompletableFuture<Boolean> retainAll(Collection<? extends E> c) {
- return null;
- }
-
- @Override
- public CompletableFuture<Boolean> removeAll(Collection<? extends E> c) {
- return null;
- }
-
- @Override
- public CompletableFuture<? extends Set<E>> getAsImmutableSet() {
- return null;
- }
-
- @Override
- public String name() {
- return null;
- }
-}
diff --git a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/EventuallyConsistentMapAdapter.java b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/EventuallyConsistentMapAdapter.java
deleted file mode 100644
index c030369..0000000
--- a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/EventuallyConsistentMapAdapter.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * 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.pcelabelstore.util;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.CompletableFuture;
-import java.util.function.BiFunction;
-
-import org.onosproject.store.service.EventuallyConsistentMap;
-import org.onosproject.store.service.EventuallyConsistentMapListener;
-
-/**
- * Testing adapter for EventuallyConsistentMap.
- */
-public class EventuallyConsistentMapAdapter<K, V> implements EventuallyConsistentMap<K, V> {
-
- @Override
- public String name() {
- return null;
- }
-
- @Override
- public Type primitiveType() {
- return Type.EVENTUALLY_CONSISTENT_MAP;
- }
-
- @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 CompletableFuture<Void> destroy() {
- return CompletableFuture.completedFuture(null);
- }
-}
diff --git a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/LabelResourceAdapter.java b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/LabelResourceAdapter.java
deleted file mode 100644
index 92ebbe6..0000000
--- a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/LabelResourceAdapter.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * 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.pcelabelstore.util;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.Random;
-import java.util.Set;
-
-import org.onosproject.incubator.net.resource.label.DefaultLabelResource;
-import org.onosproject.incubator.net.resource.label.LabelResource;
-import org.onosproject.incubator.net.resource.label.LabelResourceAdminService;
-import org.onosproject.incubator.net.resource.label.LabelResourceDelegate;
-import org.onosproject.incubator.net.resource.label.LabelResourceEvent;
-import org.onosproject.incubator.net.resource.label.LabelResourceId;
-import org.onosproject.incubator.net.resource.label.LabelResourceListener;
-import org.onosproject.incubator.net.resource.label.LabelResourcePool;
-import org.onosproject.incubator.net.resource.label.LabelResourceProvider;
-import org.onosproject.incubator.net.resource.label.LabelResourceProviderRegistry;
-import org.onosproject.incubator.net.resource.label.LabelResourceProviderService;
-import org.onosproject.incubator.net.resource.label.LabelResourceService;
-import org.onosproject.net.Device;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.device.DeviceEvent;
-import org.onosproject.net.device.DeviceEvent.Type;
-import org.onosproject.net.device.DeviceListener;
-import org.onosproject.net.provider.AbstractListenerProviderRegistry;
-import org.onosproject.net.provider.AbstractProviderService;
-
-import com.google.common.collect.Multimap;
-
-/**
- * Provides test implementation of class LabelResourceService.
- */
-public class LabelResourceAdapter
- extends AbstractListenerProviderRegistry<LabelResourceEvent, LabelResourceListener,
- LabelResourceProvider, LabelResourceProviderService>
- implements LabelResourceService, LabelResourceAdminService, LabelResourceProviderRegistry {
- public static final long GLOBAL_LABEL_SPACE_MIN = 4097;
- public static final long GLOBAL_LABEL_SPACE_MAX = 5121;
- public static final long LOCAL_LABEL_SPACE_MIN = 5122;
- public static final long LOCAL_LABEL_SPACE_MAX = 9217;
-
- private Random random = new Random();
-
- @Override
- public boolean createDevicePool(DeviceId deviceId,
- LabelResourceId beginLabel,
- LabelResourceId endLabel) {
- return true;
- }
-
- @Override
- public boolean createGlobalPool(LabelResourceId beginLabel,
- LabelResourceId endLabel) {
- return true;
- }
-
- @Override
- public boolean destroyDevicePool(DeviceId deviceId) {
- return true;
- }
-
- @Override
- public boolean destroyGlobalPool() {
- return true;
- }
-
- public long getLabelId(long min, long max) {
- return random.nextInt((int) max - (int) min + 1) + (int) min;
- }
-
- @Override
- public Collection<LabelResource> applyFromDevicePool(DeviceId deviceId,
- long applyNum) {
- Collection<LabelResource> labelList = new LinkedList<>();
- LabelResource label = new DefaultLabelResource(deviceId,
- LabelResourceId.labelResourceId(
- getLabelId(LOCAL_LABEL_SPACE_MIN, LOCAL_LABEL_SPACE_MAX)));
- labelList.add(label);
- return labelList;
- }
-
- @Override
- public Collection<LabelResource> applyFromGlobalPool(long applyNum) {
- Collection<LabelResource> labelList = new LinkedList<>();
- LabelResource label = new DefaultLabelResource(DeviceId.deviceId("foo"),
- LabelResourceId.labelResourceId(
- getLabelId(GLOBAL_LABEL_SPACE_MIN, GLOBAL_LABEL_SPACE_MAX)));
- labelList.add(label);
- return labelList;
- }
-
- @Override
- public boolean releaseToDevicePool(Multimap<DeviceId, LabelResource> release) {
- return true;
- }
-
- @Override
- public boolean releaseToGlobalPool(Set<LabelResourceId> release) {
- return true;
- }
-
- @Override
- public boolean isDevicePoolFull(DeviceId deviceId) {
- return false;
- }
-
- @Override
- public boolean isGlobalPoolFull() {
- return false;
- }
-
- @Override
- public long getFreeNumOfDevicePool(DeviceId deviceId) {
- return 4;
- }
-
- @Override
- public long getFreeNumOfGlobalPool() {
- return 4;
- }
-
- @Override
- public LabelResourcePool getDeviceLabelResourcePool(DeviceId deviceId) {
- return null;
- }
-
- @Override
- public LabelResourcePool getGlobalLabelResourcePool() {
- return null;
- }
-
- private class InternalLabelResourceDelegate implements LabelResourceDelegate {
- @Override
- public void notify(LabelResourceEvent event) {
- post(event);
- }
-
- }
-
- private class InternalDeviceListener implements DeviceListener {
- @Override
- public void event(DeviceEvent event) {
- Device device = event.subject();
- if (Type.DEVICE_REMOVED.equals(event.type())) {
- destroyDevicePool(device.id());
- }
- }
- }
-
- private class InternalLabelResourceProviderService
- extends AbstractProviderService<LabelResourceProvider>
- implements LabelResourceProviderService {
-
- protected InternalLabelResourceProviderService(LabelResourceProvider provider) {
- super(provider);
- }
-
- @Override
- public void deviceLabelResourcePoolDetected(DeviceId deviceId,
- LabelResourceId beginLabel,
- LabelResourceId endLabel) {
- checkNotNull(deviceId, "deviceId is not null");
- checkNotNull(beginLabel, "beginLabel is not null");
- checkNotNull(endLabel, "endLabel is not null");
- createDevicePool(deviceId, beginLabel, endLabel);
- }
-
- @Override
- public void deviceLabelResourcePoolDestroyed(DeviceId deviceId) {
- checkNotNull(deviceId, "deviceId is not null");
- destroyDevicePool(deviceId);
- }
-
- }
-
- @Override
- protected LabelResourceProviderService createProviderService(LabelResourceProvider provider) {
- return null;
- }
-}
diff --git a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/MockDeviceService.java b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/MockDeviceService.java
index 5ff1f54..298fd39 100644
--- a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/MockDeviceService.java
+++ b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/MockDeviceService.java
@@ -15,23 +15,18 @@
*/
package org.onosproject.pcelabelstore.util;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.device.DeviceListener;
+import org.onosproject.net.device.DeviceServiceAdapter;
+
import java.util.LinkedList;
import java.util.List;
-import org.onosproject.net.device.DeviceListener;
-import org.onosproject.net.device.PortStatistics;
-import org.onosproject.net.Device;
-import org.onosproject.net.Device.Type;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.MastershipRole;
-import org.onosproject.net.Port;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.device.DeviceService;
-
/**
* Test fixture for the device service.
*/
-public class MockDeviceService implements DeviceService {
+public class MockDeviceService extends DeviceServiceAdapter {
private List<Device> devices = new LinkedList<>();
private DeviceListener listener;
@@ -79,81 +74,4 @@
public DeviceListener getListener() {
return listener;
}
-
- @Override
- public void removeListener(DeviceListener listener) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public int getDeviceCount() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public Iterable<Device> getDevices() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Iterable<Device> getDevices(Type type) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Iterable<Device> getAvailableDevices(Type type) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public MastershipRole getRole(DeviceId deviceId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public List<Port> getPorts(DeviceId deviceId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public List<PortStatistics> getPortStatistics(DeviceId deviceId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public List<PortStatistics> getPortDeltaStatistics(DeviceId deviceId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Port getPort(DeviceId deviceId, PortNumber portNumber) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean isAvailable(DeviceId deviceId) {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public String localStatus(DeviceId deviceId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public long getLastUpdatedInstant(DeviceId deviceId) {
- return 0;
- }
}
diff --git a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/MockNetConfigRegistryAdapter.java b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/MockNetConfigRegistryAdapter.java
index 785900b..b5a67fb 100644
--- a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/MockNetConfigRegistryAdapter.java
+++ b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/MockNetConfigRegistryAdapter.java
@@ -15,27 +15,22 @@
*/
package org.onosproject.pcelabelstore.util;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.config.Config;
-import org.onosproject.net.config.ConfigApplyDelegate;
-import org.onosproject.net.config.ConfigFactory;
-import org.onosproject.net.config.NetworkConfigListener;
-import org.onosproject.net.config.NetworkConfigRegistry;
-import org.onosproject.net.config.NetworkConfigService;
-import org.onosproject.net.config.SubjectFactory;
-import org.onosproject.pcep.api.DeviceCapability;
-
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.config.Config;
+import org.onosproject.net.config.ConfigApplyDelegate;
+import org.onosproject.net.config.ConfigFactory;
+import org.onosproject.net.config.NetworkConfigRegistryAdapter;
+import org.onosproject.pcep.api.DeviceCapability;
+
+import java.util.HashMap;
+import java.util.Map;
/* Mock test for network config registry. */
-public class MockNetConfigRegistryAdapter implements NetworkConfigService, NetworkConfigRegistry {
+public class MockNetConfigRegistryAdapter extends NetworkConfigRegistryAdapter {
private ConfigFactory cfgFactory;
private Map<DeviceId, DeviceCapability> classConfig = new HashMap<>();
@@ -90,105 +85,4 @@
}
}
- @Override
- public void addListener(NetworkConfigListener listener) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void removeListener(NetworkConfigListener listener) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public Set<ConfigFactory> getConfigFactories() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public <S, C extends Config<S>> Set<ConfigFactory<S, C>> getConfigFactories(Class<S> subjectClass) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public <S, C extends Config<S>> ConfigFactory<S, C> getConfigFactory(Class<C> configClass) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Set<Class> getSubjectClasses() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public SubjectFactory getSubjectFactory(String subjectClassKey) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public SubjectFactory getSubjectFactory(Class subjectClass) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Class<? extends Config> getConfigClass(String subjectClassKey, String configKey) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public <S> Set<S> getSubjects(Class<S> subjectClass) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public <S, C extends Config<S>> Set<S> getSubjects(Class<S> subjectClass, Class<C> configClass) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public <S> Set<? extends Config<S>> getConfigs(S subject) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public <S, C extends Config<S>> C applyConfig(S subject, Class<C> configClass, JsonNode json) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public <S, C extends Config<S>> C applyConfig(String subjectClassKey, S subject, String configKey, JsonNode json) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public <S> void removeConfig(String subjectClassKey, S subject, String configKey) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public <S> void removeConfig(S subject) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public <S> void removeConfig() {
- // TODO Auto-generated method stub
-
- }
}
diff --git a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/StorageServiceAdapter.java b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/StorageServiceAdapter.java
deleted file mode 100644
index fed4cab..0000000
--- a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/StorageServiceAdapter.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * 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.pcelabelstore.util;
-
-import org.onosproject.store.service.AsyncDocumentTree;
-import org.onosproject.store.service.AsyncConsistentMultimap;
-import org.onosproject.store.service.AsyncConsistentTreeMap;
-import org.onosproject.store.service.AtomicCounterBuilder;
-import org.onosproject.store.service.AtomicCounterMapBuilder;
-import org.onosproject.store.service.AtomicIdGeneratorBuilder;
-import org.onosproject.store.service.AtomicValueBuilder;
-import org.onosproject.store.service.ConsistentMapBuilder;
-import org.onosproject.store.service.ConsistentMultimapBuilder;
-import org.onosproject.store.service.ConsistentTreeMapBuilder;
-import org.onosproject.store.service.DistributedLockBuilder;
-import org.onosproject.store.service.DistributedSetBuilder;
-import org.onosproject.store.service.DocumentTreeBuilder;
-import org.onosproject.store.service.EventuallyConsistentMapBuilder;
-import org.onosproject.store.service.LeaderElectorBuilder;
-import org.onosproject.store.service.Serializer;
-import org.onosproject.store.service.StorageService;
-import org.onosproject.store.service.Topic;
-import org.onosproject.store.service.TopicBuilder;
-import org.onosproject.store.service.TransactionContextBuilder;
-import org.onosproject.store.service.WorkQueue;
-
-/**
- * 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 <V> DocumentTreeBuilder<V> documentTreeBuilder() {
- return null;
- }
-
- @Override
- public <E> DistributedSetBuilder<E> setBuilder() {
- return null;
- }
-
- @Override
- public AtomicCounterBuilder atomicCounterBuilder() {
- return null;
- }
-
- @Override
- public AtomicIdGeneratorBuilder atomicIdGeneratorBuilder() {
- return null;
- }
-
- @Override
- public <V> AtomicValueBuilder<V> atomicValueBuilder() {
- return null;
- }
-
- @Override
- public TransactionContextBuilder transactionContextBuilder() {
- return null;
- }
-
- @Override
- public DistributedLockBuilder lockBuilder() {
- return null;
- }
-
- @Override
- public LeaderElectorBuilder leaderElectorBuilder() {
- return null;
- }
-
- @Override
- public <T> TopicBuilder<T> topicBuilder() {
- return null;
- }
-
- @Override
- public <E> WorkQueue<E> getWorkQueue(String name, Serializer serializer) {
- return null;
- }
-
- @Override
- public <K, V> AsyncConsistentMultimap<K, V> getAsyncSetMultimap(String name, Serializer serializer) {
- return null;
- }
-
- @Override
- public <V> AsyncConsistentTreeMap<V> getAsyncTreeMap(String name, Serializer serializer) {
- return null;
- }
-
- @Override
- public <T> Topic<T> getTopic(String name, Serializer serializer) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public <V> ConsistentTreeMapBuilder<V> consistentTreeMapBuilder() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public <V> AsyncDocumentTree<V> getDocumentTree(String name, Serializer serializer) {
- return null;
- }
-
- public <K, V> ConsistentMultimapBuilder<K, V> consistentMultimapBuilder() {
- return null;
- }
-
- @Override
- public <K> AtomicCounterMapBuilder<K> atomicCounterMapBuilder() {
- return null;
- }
-}
diff --git a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestConsistentMap.java b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestConsistentMap.java
index b67cdc9..4c02ba9 100644
--- a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestConsistentMap.java
+++ b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestConsistentMap.java
@@ -32,6 +32,7 @@
import org.onosproject.store.primitives.ConsistentMapBackedJavaMap;
import org.onosproject.store.service.AsyncConsistentMap;
import org.onosproject.store.service.ConsistentMap;
+import org.onosproject.store.service.ConsistentMapAdapter;
import org.onosproject.store.service.ConsistentMapBuilder;
import org.onosproject.store.service.MapEvent;
import org.onosproject.store.service.MapEventListener;
diff --git a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestDistributedSet.java b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestDistributedSet.java
index 011aa08..aa4468a 100644
--- a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestDistributedSet.java
+++ b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestDistributedSet.java
@@ -21,6 +21,7 @@
import org.onosproject.store.primitives.DefaultDistributedSet;
import org.onosproject.store.service.AsyncDistributedSet;
import org.onosproject.store.service.DistributedSet;
+import org.onosproject.store.service.DistributedSetAdapter;
import org.onosproject.store.service.DistributedSetBuilder;
import org.onosproject.store.service.SetEvent;
import org.onosproject.store.service.SetEventListener;
diff --git a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestEventuallyConsistentMap.java b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestEventuallyConsistentMap.java
index 9184352..7872355 100644
--- a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestEventuallyConsistentMap.java
+++ b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestEventuallyConsistentMap.java
@@ -30,6 +30,7 @@
import org.onosproject.cluster.NodeId;
import org.onosproject.store.Timestamp;
import org.onosproject.store.service.EventuallyConsistentMap;
+import org.onosproject.store.service.EventuallyConsistentMapAdapter;
import org.onosproject.store.service.EventuallyConsistentMapBuilder;
import org.onosproject.store.service.EventuallyConsistentMapEvent;
import org.onosproject.store.service.EventuallyConsistentMapListener;
diff --git a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestStorageService.java b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestStorageService.java
index 84ae028..cc09bef 100644
--- a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestStorageService.java
+++ b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestStorageService.java
@@ -15,20 +15,14 @@
*/
package org.onosproject.pcelabelstore.util;
-import org.onosproject.store.service.AsyncConsistentMultimap;
-import org.onosproject.store.service.AsyncConsistentTreeMap;
-import org.onosproject.store.service.AsyncDocumentTree;
import org.onosproject.store.service.AtomicCounterBuilder;
import org.onosproject.store.service.AtomicValueBuilder;
import org.onosproject.store.service.ConsistentMapBuilder;
import org.onosproject.store.service.ConsistentMultimapBuilder;
import org.onosproject.store.service.DistributedSetBuilder;
import org.onosproject.store.service.EventuallyConsistentMapBuilder;
-import org.onosproject.store.service.LeaderElectorBuilder;
-import org.onosproject.store.service.Serializer;
-import org.onosproject.store.service.Topic;
+import org.onosproject.store.service.StorageServiceAdapter;
import org.onosproject.store.service.TransactionContextBuilder;
-import org.onosproject.store.service.WorkQueue;
public class TestStorageService extends StorageServiceAdapter {
@@ -68,33 +62,4 @@
throw new UnsupportedOperationException("transactionContextBuilder");
}
- @Override
- public LeaderElectorBuilder leaderElectorBuilder() {
- return null;
- }
-
- @Override
- public <E> WorkQueue<E> getWorkQueue(String name, Serializer serializer) {
- return null;
- }
-
- @Override
- public <K, V> AsyncConsistentMultimap<K, V> getAsyncSetMultimap(String name, Serializer serializer) {
- return null;
- }
-
- @Override
- public <V> AsyncConsistentTreeMap<V> getAsyncTreeMap(String name, Serializer serializer) {
- return null;
- }
-
- @Override
- public <T> Topic<T> getTopic(String name, Serializer serializer) {
- return null;
- }
-
- @Override
- public <V> AsyncDocumentTree<V> getDocumentTree(String name, Serializer serializer) {
- return null;
- }
}