Merge "NormalizedNode Mount APIs."
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / test / java / org / opendaylight / controller / md / sal / dom / broker / impl / MountPointServiceTest.java
1 /*
2  * Copyright (c) 2014 Cisco 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.controller.md.sal.dom.broker.impl;
10
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertTrue;
13
14 import com.google.common.base.Optional;
15 import org.junit.Before;
16 import org.junit.Test;
17 import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
18 import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
19 import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService.DOMMountPointBuilder;
20 import org.opendaylight.controller.md.sal.dom.broker.impl.mount.DOMMountPointServiceImpl;
21 import org.opendaylight.yangtools.yang.common.QName;
22 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
23
24 public class MountPointServiceTest {
25
26     private DOMMountPointService mountService;
27     private static final InstanceIdentifier PATH = InstanceIdentifier.of(QName.create("namespace", "12-12-2012", "top"));
28
29     @Before
30     public void setup() {
31         mountService = new DOMMountPointServiceImpl();
32     }
33
34     @Test
35     public void createSimpleMountPoint() {
36         Optional<DOMMountPoint> mountNotPresent = mountService.getMountPoint(PATH);
37         assertFalse(mountNotPresent.isPresent());
38         DOMMountPointBuilder mountBuilder = mountService.createMountPoint(PATH);
39         mountBuilder.register();
40
41         Optional<DOMMountPoint> mountPresent = mountService.getMountPoint(PATH);
42         assertTrue(mountPresent.isPresent());
43     }
44 }