2 * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netvirt.cloudservicechain.matchers;
10 import java.util.List;
11 import org.mockito.ArgumentMatcher;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
13 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
14 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
16 public class NodeIIdMatcher extends ArgumentMatcher<InstanceIdentifier<Node>> {
18 InstanceIdentifier<Node> expectedNodeIId;
20 public NodeIIdMatcher(InstanceIdentifier<Node> expectedNodeIId) {
21 this.expectedNodeIId = expectedNodeIId;
25 public boolean matches(Object nodeIId) {
27 if (! (nodeIId instanceof InstanceIdentifier<?>)) {
30 boolean result = false;
32 InstanceIdentifier<Node> actualNodeIId = (InstanceIdentifier<Node>) nodeIId;
33 List<PathArgument> expectedNodeIIdPath = this.expectedNodeIId.getPath();
34 List<PathArgument> actualNodeIIdPath = actualNodeIId.getPath();
35 if (expectedNodeIIdPath.size() != actualNodeIIdPath.size()) {
39 for (int i = 0; i < expectedNodeIIdPath.size(); i++) {
40 if (expectedNodeIIdPath.get(i).compareTo(actualNodeIIdPath.get(i)) != 0) {
46 } catch (ClassCastException e) {