Bump upstream dependencies to Ca
[transportpce.git] / test-common / src / main / java / org / opendaylight / transportpce / test / stub / MountPointServiceStub.java
1 /*
2  * Copyright © 2018 Orange Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.transportpce.test.stub;
10
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;
18
19 public class MountPointServiceStub implements MountPointService {
20
21     MountPoint returnedMountPoint;
22
23     public MountPointServiceStub(MountPoint usedMountPoint) {
24         this.returnedMountPoint = usedMountPoint;
25     }
26
27     @Override
28     public Optional<MountPoint> getMountPoint(InstanceIdentifier<?> mountPoint) {
29         if (returnedMountPoint == null) {
30             return Optional.empty();
31         }
32         return Optional.of(returnedMountPoint);
33     }
34
35     @Override
36     public @NonNull Registration registerListener(InstanceIdentifier<?> path, MountPointListener listener) {
37         return new BindingDOMMountPointServiceAdapter(null, null).registerListener(path, listener);
38     }
39 }