import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+import com.google.common.base.Optional;
+import com.google.common.collect.Iterables;
import java.io.FileNotFoundException;
import java.util.Set;
-
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.opendaylight.controller.sal.core.api.mount.MountInstance;
-import org.opendaylight.controller.sal.core.api.mount.MountService;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
import org.opendaylight.controller.sal.restconf.impl.BrokerFacade;
import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
import org.opendaylight.controller.sal.restconf.impl.InstanceIdWithSchemaNode;
import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
initMountService(true);
InstanceIdWithSchemaNode instanceIdentifier = controllerContext
.toInstanceIdentifier("simple-nodes:users/yang-ext:mount/");
- assertEquals(true, instanceIdentifier.getInstanceIdentifier().getPath().isEmpty());
+ assertTrue(Iterables.isEmpty(instanceIdentifier.getInstanceIdentifier().getPathArguments()));
}
@Test
.toInstanceIdentifier("simple-nodes:users/yang-ext:mount/test-interface2:class");
}
- public void initMountService(boolean withSchema) {
- MountService mountService = mock(MountService.class);
+ public void initMountService(final boolean withSchema) {
+ DOMMountPointService mountService = mock(DOMMountPointService.class);
controllerContext.setMountService(mountService);
BrokerFacade brokerFacade = mock(BrokerFacade.class);
RestconfImpl restconfImpl = RestconfImpl.getInstance();
Set<Module> modules2 = TestUtils.loadModulesFrom("/test-config-data/yang2");
SchemaContext schemaContext2 = TestUtils.loadSchemaContext(modules2);
- MountInstance mountInstance = mock(MountInstance.class);
- if (withSchema)
+ DOMMountPoint mountInstance = mock(DOMMountPoint.class);
+ if (withSchema) {
when(mountInstance.getSchemaContext()).thenReturn(schemaContext2);
- else
+ } else {
when(mountInstance.getSchemaContext()).thenReturn(null);
- when(mountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ }
+ when(mountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(Optional.of(mountInstance));
}
}