2 * Copyright © 2018 Orange Systems, Inc. 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
9 package org.opendaylight.transportpce.test.stub;
11 import java.util.Optional;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.mdsal.binding.api.MountPoint;
14 import org.opendaylight.mdsal.binding.api.MountPointService;
15 import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMMountPointServiceAdapter;
16 import org.opendaylight.yangtools.concepts.Registration;
17 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
19 public class MountPointServiceStub implements MountPointService {
21 MountPoint returnedMountPoint;
23 public MountPointServiceStub(MountPoint usedMountPoint) {
24 this.returnedMountPoint = usedMountPoint;
28 public Optional<MountPoint> getMountPoint(InstanceIdentifier<?> mountPoint) {
29 if (returnedMountPoint == null) {
30 return Optional.empty();
32 return Optional.of(returnedMountPoint);
36 public @NonNull Registration registerListener(InstanceIdentifier<?> path, MountPointListener listener) {
37 return new BindingDOMMountPointServiceAdapter(null, null).registerListener(path, listener);