import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutionException;
import javax.annotation.Nullable;
import javax.ws.rs.core.Response.Status;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
import org.opendaylight.controller.md.sal.dom.api.DOMDataChangeListener;
public CheckedFuture<Void, TransactionCommitFailedException> commitConfigurationDataDelete(
final YangInstanceIdentifier path) {
checkPreconditions();
- return deleteDataViaTransaction(this.domDataBroker.newWriteOnlyTransaction(), CONFIGURATION, path);
+ return deleteDataViaTransaction(this.domDataBroker.newReadWriteTransaction(), CONFIGURATION, path);
}
public CheckedFuture<Void, TransactionCommitFailedException> commitConfigurationDataDelete(
final DOMMountPoint mountPoint, final YangInstanceIdentifier path) {
final Optional<DOMDataBroker> domDataBrokerService = mountPoint.getService(DOMDataBroker.class);
if (domDataBrokerService.isPresent()) {
- return deleteDataViaTransaction(domDataBrokerService.get().newWriteOnlyTransaction(), CONFIGURATION, path);
+ return deleteDataViaTransaction(domDataBrokerService.get().newReadWriteTransaction(), CONFIGURATION, path);
}
final String errMsg = "DOM data broker service isn't available for mount point " + path;
LOG.warn(errMsg);
final LogicalDatastoreType datastore, final YangInstanceIdentifier path) {
LOG.trace("Read {} via Restconf: {}", datastore.name(), path);
final ListenableFuture<Optional<NormalizedNode<?, ?>>> listenableFuture = transaction.read(datastore, path);
- final ReadDataResult readData = new ReadDataResult();
+ final ReadDataResult<NormalizedNode<?, ?>> readData = new ReadDataResult<>();
final CountDownLatch responseWaiter = new CountDownLatch(1);
Futures.addCallback(listenableFuture, new FutureCallback<Optional<NormalizedNode<?, ?>>>() {
@Override
public void onSuccess(final Optional<NormalizedNode<?, ?>> result) {
- handlingCallback(null, datastore, path, result, readData);
responseWaiter.countDown();
+ handlingCallback(null, datastore, path, result, readData);
}
@Override
public void onFailure(final Throwable t) {
- handlingCallback(t, datastore, path, null, null);
responseWaiter.countDown();
+ handlingCallback(t, datastore, path, null, null);
}
});
return readData.getResult();
}
- protected static void handlingCallback(final Throwable t, final LogicalDatastoreType datastore,
- final YangInstanceIdentifier path, final Optional<NormalizedNode<?, ?>> result,
- final ReadDataResult readData) {
- if (t != null) {
- LOG.warn("Exception by reading {} via Restconf: {}", datastore.name(), path, t);
- throw new RestconfDocumentedException("Problem to get data from transaction.", t);
- } else {
- LOG.debug("Reading result data from transaction.");
- if (result != null) {
- if (result.isPresent()) {
- readData.setResult(result.get());
- }
- }
- }
- }
-
private CheckedFuture<Void, TransactionCommitFailedException> postDataViaTransaction(
final DOMDataReadWriteTransaction rWTransaction, final LogicalDatastoreType datastore,
final YangInstanceIdentifier path, final NormalizedNode<?, ?> payload, final SchemaContext schemaContext) {
}
}
- private void checkItemDoesNotExists(final DOMDataReadWriteTransaction rWTransaction,final LogicalDatastoreType store, final YangInstanceIdentifier path) {
- final ListenableFuture<Boolean> futureDatastoreData = rWTransaction.exists(store, path);
+ /**
+ * Check if item already exists. Throws error if it does NOT already exist.
+ * @param rWTransaction Current transaction
+ * @param store Used datastore
+ * @param path Path to item to verify its existence
+ */
+ private void checkItemExists(final DOMDataReadWriteTransaction rWTransaction,
+ final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+ final CountDownLatch responseWaiter = new CountDownLatch(1);
+ final ReadDataResult<Boolean> readData = new ReadDataResult<>();
+ final CheckedFuture<Boolean, ReadFailedException> future = rWTransaction.exists(store, path);
+
+ Futures.addCallback(future, new FutureCallback<Boolean>() {
+ @Override
+ public void onSuccess(@Nullable final Boolean result) {
+ responseWaiter.countDown();
+ handlingCallback(null, store, path, Optional.of(result), readData);
+ }
+
+ @Override
+ public void onFailure(final Throwable t) {
+ responseWaiter.countDown();
+ handlingCallback(t, store, path, null, null);
+ }
+ });
+
try {
- if (futureDatastoreData.get()) {
- final String errMsg = "Post Configuration via Restconf was not executed because data already exists";
- LOG.trace("{}:{}", errMsg, path);
- rWTransaction.cancel();
- throw new RestconfDocumentedException("Data already exists for path: " + path, ErrorType.PROTOCOL,
- ErrorTag.DATA_EXISTS);
+ responseWaiter.await();
+ } catch (final InterruptedException e) {
+ final String msg = "Problem while waiting for response";
+ LOG.warn(msg);
+ throw new RestconfDocumentedException(msg, e);
+ }
+
+ if (!readData.getResult()) {
+ final String errMsg = "Operation via Restconf was not executed because data does not exist";
+ LOG.trace("{}:{}", errMsg, path);
+ rWTransaction.cancel();
+ throw new RestconfDocumentedException("Data does not exist for path: " + path, ErrorType.PROTOCOL,
+ ErrorTag.DATA_MISSING);
+ }
+ }
+
+ /**
+ * Check if item does NOT already exist. Throws error if it already exists.
+ * @param rWTransaction Current transaction
+ * @param store Used datastore
+ * @param path Path to item to verify its existence
+ */
+ private void checkItemDoesNotExists(final DOMDataReadWriteTransaction rWTransaction,
+ final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+ final CountDownLatch responseWaiter = new CountDownLatch(1);
+ final ReadDataResult<Boolean> readData = new ReadDataResult<>();
+ final CheckedFuture<Boolean, ReadFailedException> future = rWTransaction.exists(store, path);
+
+ Futures.addCallback(future, new FutureCallback<Boolean>() {
+ @Override
+ public void onSuccess(@Nullable final Boolean result) {
+ responseWaiter.countDown();
+ handlingCallback(null, store, path, Optional.of(result), readData);
+ }
+
+ @Override
+ public void onFailure(final Throwable t) {
+ responseWaiter.countDown();
+ handlingCallback(t, store, path, null, null);
}
- } catch (InterruptedException | ExecutionException e) {
- LOG.warn("It wasn't possible to get data loaded from datastore at path {}", path, e);
+ });
+
+ try {
+ responseWaiter.await();
+ } catch (final InterruptedException e) {
+ final String msg = "Problem while waiting for response";
+ LOG.warn(msg);
+ throw new RestconfDocumentedException(msg, e);
}
+ if (readData.getResult()) {
+ final String errMsg = "Operation via Restconf was not executed because data already exists";
+ LOG.trace("{}:{}", errMsg, path);
+ rWTransaction.cancel();
+ throw new RestconfDocumentedException("Data already exists for path: " + path, ErrorType.PROTOCOL,
+ ErrorTag.DATA_EXISTS);
+ }
}
private CheckedFuture<Void, TransactionCommitFailedException> putDataViaTransaction(
}
private CheckedFuture<Void, TransactionCommitFailedException> deleteDataViaTransaction(
- final DOMDataWriteTransaction writeTransaction, final LogicalDatastoreType datastore,
+ final DOMDataReadWriteTransaction readWriteTransaction, final LogicalDatastoreType datastore,
final YangInstanceIdentifier path) {
LOG.trace("Delete {} via Restconf: {}", datastore.name(), path);
- writeTransaction.delete(datastore, path);
- return writeTransaction.submit();
+ checkItemExists(readWriteTransaction, datastore, path);
+ readWriteTransaction.delete(datastore, path);
+ return readWriteTransaction.submit();
}
private void deleteDataWithinTransaction(
this.domDataBroker = domDataBroker;
}
- private class ReadDataResult {
- NormalizedNode<?, ?> result = null;
+ /**
+ * Helper class for result of transaction commit callback.
+ * @param <T> Type of result
+ */
+ private final class ReadDataResult<T> {
+ T result = null;
- NormalizedNode<?, ?> getResult() {
+ T getResult() {
return this.result;
}
- void setResult(final NormalizedNode<?, ?> result) {
+ void setResult(final T result) {
this.result = result;
}
}
+ /**
+ * Set result from transaction commit callback.
+ * @param t Throwable if transaction commit failed
+ * @param datastore Datastore from which data are read
+ * @param path Path from which data are read
+ * @param result Result of read from {@code datastore}
+ * @param readData Result value which will be set
+ * @param <X> Result type
+ */
+ protected final static <X> void handlingCallback(final Throwable t, final LogicalDatastoreType datastore,
+ final YangInstanceIdentifier path, final Optional<X> result,
+ final ReadDataResult<X> readData) {
+ if (t != null) {
+ LOG.warn("Exception by reading {} via Restconf: {}", datastore.name(), path, t);
+ throw new RestconfDocumentedException("Problem to get data from transaction.", t);
+ } else {
+ LOG.debug("Reading result data from transaction.");
+ if (result != null) {
+ if (result.isPresent()) {
+ readData.setResult(result.get());
+ }
+ }
+ }
+ }
+
public void registerToListenNotification(final NotificationListenerAdapter listener) {
checkPreconditions();
import com.google.common.base.CharMatcher;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
-import com.google.common.base.Predicates;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
-import com.google.common.base.Throwables;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.ModifiedNodeDoesNotExistException;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
final DOMMountPoint mountPoint = iiWithData.getMountPoint();
final YangInstanceIdentifier normalizedII = iiWithData.getInstanceIdentifier();
- CheckedFuture<Void, TransactionCommitFailedException> future;
+ final CheckedFuture<Void, TransactionCommitFailedException> future;
if (mountPoint != null) {
future = this.broker.commitConfigurationDataDelete(mountPoint, normalizedII);
} else {
LOG.warn(msg);
throw new RestconfDocumentedException(msg, e);
}
+
return Response.status(Status.OK).build();
}
protected void handlerLoggerDelete(final Throwable t) {
if (t != null) {
- final Optional<Throwable> searchedException = Iterables.tryFind(Throwables.getCausalChain(t),
- Predicates.instanceOf(ModifiedNodeDoesNotExistException.class));
- if (searchedException.isPresent()) {
- throw new RestconfDocumentedException("Data specified for deleting doesn't exist.", ErrorType.APPLICATION, ErrorTag.DATA_MISSING);
- }
final String errMsg = "Error while deleting data";
LOG.info(errMsg, t);
throw new RestconfDocumentedException(errMsg, t);
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.inOrder;
import org.opendaylight.netconf.sal.restconf.impl.PutResult;
import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException;
import org.opendaylight.netconf.sal.restconf.impl.RestconfError;
+import org.opendaylight.netconf.sal.restconf.impl.RestconfError.ErrorTag;
+import org.opendaylight.netconf.sal.restconf.impl.RestconfError.ErrorType;
import org.opendaylight.netconf.sal.streams.listeners.ListenerAdapter;
import org.opendaylight.netconf.sal.streams.listeners.NotificationListenerAdapter;
import org.opendaylight.netconf.sal.streams.listeners.Notificator;
* @author Thomas Pantelis
*/
public class BrokerFacadeTest {
-
- @Mock
- DOMDataBroker domDataBroker;
-
- @Mock
- DOMNotificationService domNotification;
-
- @Mock
- ConsumerSession context;
-
- @Mock
- DOMRpcService mockRpcService;
-
- @Mock
- DOMMountPoint mockMountInstance;
-
- BrokerFacade brokerFacade = BrokerFacade.getInstance();
-
- NormalizedNode<?, ?> dummyNode = createDummyNode("test:module", "2014-01-09", "interfaces");
- CheckedFuture<Optional<NormalizedNode<?, ?>>,ReadFailedException> dummyNodeInFuture = wrapDummyNode(this.dummyNode);
-
- QName qname = TestUtils.buildQName("interfaces","test:module", "2014-01-09");
-
- SchemaPath type = SchemaPath.create(true, this.qname);
-
- YangInstanceIdentifier instanceID = YangInstanceIdentifier.builder().node(this.qname).build();
-
- @Mock
- DOMDataReadOnlyTransaction rTransaction;
-
- @Mock
- DOMDataWriteTransaction wTransaction;
-
- @Mock
- DOMDataReadWriteTransaction rwTransaction;
+ @Mock private DOMDataBroker domDataBroker;
+ @Mock private DOMNotificationService domNotification;
+ @Mock private ConsumerSession context;
+ @Mock private DOMRpcService mockRpcService;
+ @Mock private DOMMountPoint mockMountInstance;
+
+ private final BrokerFacade brokerFacade = BrokerFacade.getInstance();
+ private final NormalizedNode<?, ?> dummyNode = createDummyNode("test:module", "2014-01-09", "interfaces");
+ private final CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> dummyNodeInFuture =
+ wrapDummyNode(dummyNode);
+ private final QName qname = TestUtils.buildQName("interfaces","test:module", "2014-01-09");
+ private final SchemaPath type = SchemaPath.create(true, qname);
+ private final YangInstanceIdentifier instanceID = YangInstanceIdentifier.builder().node(qname).build();
+
+ @Mock private DOMDataReadOnlyTransaction rTransaction;
+ @Mock private DOMDataWriteTransaction wTransaction;
+ @Mock private DOMDataReadWriteTransaction rwTransaction;
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
- // TODO it is started before every test method
this.brokerFacade.setDomDataBroker(this.domDataBroker);
this.brokerFacade.setDomNotificationService(this.domNotification);
this.brokerFacade.setRpcService(this.mockRpcService);
ControllerContext.getInstance().setSchemas(TestUtils.loadSchemaContext("/full-versions/test-module"));
}
- private CheckedFuture<Optional<NormalizedNode<?, ?>>,ReadFailedException> wrapDummyNode(
+ private CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> wrapDummyNode(
final NormalizedNode<?, ?> dummyNode) {
- return Futures.immediateCheckedFuture(Optional.<NormalizedNode<?, ?>> of(dummyNode));
+ return Futures.immediateCheckedFuture(Optional.<NormalizedNode<?, ?>> of(dummyNode));
}
- private CheckedFuture<Boolean,ReadFailedException> wrapExistence(final Boolean exists) {
- return Futures.immediateCheckedFuture(exists);
+ private CheckedFuture<Boolean, ReadFailedException> wrapExistence(final Boolean exists) {
+ return Futures.immediateCheckedFuture(exists);
}
-
/**
* Value of this node shouldn't be important for testing purposes
*/
final CheckedFuture<DOMRpcResult, DOMRpcException> future = Futures.immediateCheckedFuture(expResult);
when(this.mockRpcService.invokeRpc(this.type, this.dummyNode)).thenReturn(future);
- final CheckedFuture<DOMRpcResult, DOMRpcException> actualFuture = this.brokerFacade.invokeRpc(
- this.type, this.dummyNode);
+ final CheckedFuture<DOMRpcResult, DOMRpcException> actualFuture = this.brokerFacade
+ .invokeRpc(this.type, this.dummyNode);
assertNotNull("Future is null", actualFuture);
final DOMRpcResult actualResult = actualFuture.get();
assertSame("invokeRpc", expResult, actualResult);
final Optional<NormalizedNode<?, ?>> optionalMock = mock(Optional.class);
when(optionalMock.get()).thenReturn(null);
+
final CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> readFuture = Futures
.immediateCheckedFuture(optionalMock);
- when(this.rwTransaction.read(any(LogicalDatastoreType.class), any(YangInstanceIdentifier.class)))
- .thenReturn(readFuture);
+ when(this.rwTransaction.read(LogicalDatastoreType.CONFIGURATION, this.instanceID)).thenReturn(readFuture);
final PutResult result = this.brokerFacade.commitConfigurationDataPut(mock(SchemaContext.class),
this.instanceID, this.dummyNode);
+
final Future<Void> actualFuture = result.getFutureOfPutData();
assertSame("commitConfigurationDataPut", expFuture, actualFuture);
@SuppressWarnings("unchecked")
final CheckedFuture<Void, TransactionCommitFailedException> expFuture = mock(CheckedFuture.class);
- when(this.rwTransaction.exists(eq(LogicalDatastoreType.CONFIGURATION), any(YangInstanceIdentifier.class))).thenReturn(
- wrapExistence(false));
-
+ when(this.rwTransaction.exists(LogicalDatastoreType.CONFIGURATION, this.instanceID))
+ .thenReturn(wrapExistence(false));
when(this.rwTransaction.submit()).thenReturn(expFuture);
@Test(expected = RestconfDocumentedException.class)
public void testCommitConfigurationDataPostAlreadyExists() {
final CheckedFuture<Boolean, ReadFailedException> successFuture = Futures.immediateCheckedFuture(Boolean.TRUE);
- when(this.rwTransaction.exists(eq(LogicalDatastoreType.CONFIGURATION), any(YangInstanceIdentifier.class))).thenReturn(
- successFuture);
+ when(this.rwTransaction.exists(eq(LogicalDatastoreType.CONFIGURATION), any(YangInstanceIdentifier.class)))
+ .thenReturn(successFuture);
try {
// Schema context is only necessary for ensuring parent structure
- this.brokerFacade.commitConfigurationDataPost((SchemaContext)null, this.instanceID, this.dummyNode);
+ this.brokerFacade.commitConfigurationDataPost((SchemaContext) null, this.instanceID, this.dummyNode);
} catch (final RestconfDocumentedException e) {
assertEquals("getErrorTag", RestconfError.ErrorTag.DATA_EXISTS, e.getErrors().get(0).getErrorTag());
throw e;
}
}
+ /**
+ * Positive test of delete operation when data to delete exits. Returned value and order of steps are validated.
+ */
@Test
- public void testCommitConfigurationDataDelete() {
+ public void testCommitConfigurationDataDelete() throws Exception {
+ // assume that data to delete exists
+ prepareDataForDelete(true);
+
+ // expected result
@SuppressWarnings("unchecked")
final CheckedFuture<Void, TransactionCommitFailedException> expFuture = mock(CheckedFuture.class);
+ when(this.rwTransaction.submit()).thenReturn(expFuture);
- when(this.wTransaction.submit()).thenReturn(expFuture);
-
+ // test
final CheckedFuture<Void, TransactionCommitFailedException> actualFuture = this.brokerFacade
.commitConfigurationDataDelete(this.instanceID);
+ // verify result and interactions
assertSame("commitConfigurationDataDelete", expFuture, actualFuture);
- final InOrder inOrder = inOrder(this.domDataBroker, this.wTransaction);
- inOrder.verify(this.domDataBroker).newWriteOnlyTransaction();
- inOrder.verify(this.wTransaction).delete(eq(LogicalDatastoreType.CONFIGURATION), any(YangInstanceIdentifier.class));
- inOrder.verify(this.wTransaction).submit();
+ // check exists, delete, submit
+ final InOrder inOrder = inOrder(this.domDataBroker, this.rwTransaction);
+ inOrder.verify(this.rwTransaction).exists(LogicalDatastoreType.CONFIGURATION, this.instanceID);
+ inOrder.verify(this.rwTransaction).delete(LogicalDatastoreType.CONFIGURATION, this.instanceID);
+ inOrder.verify(this.rwTransaction).submit();
+ }
+
+ /**
+ * Negative test of delete operation when data to delete does not exist. Error 404 should be returned.
+ */
+ @Test
+ public void testCommitConfigurationDataDeleteNoData() throws Exception {
+ // assume that data to delete does not exist
+ prepareDataForDelete(false);
+
+ // try to delete and expect 404 error
+ try {
+ this.brokerFacade.commitConfigurationDataDelete(this.instanceID);
+ fail("Delete operation should fail due to missing data");
+ } catch (final RestconfDocumentedException e) {
+ assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
+ assertEquals(ErrorTag.DATA_MISSING, e.getErrors().get(0).getErrorTag());
+ assertEquals(404, e.getErrors().get(0).getErrorTag().getStatusCode());
+ }
+ }
+
+ /**
+ * Prepare conditions to test delete operation. Data to delete exists or does not exist according to value of
+ * {@code assumeDataExists} parameter.
+ * @param assumeDataExists
+ */
+ private void prepareDataForDelete(final boolean assumeDataExists) {
+ when(this.rwTransaction.exists(LogicalDatastoreType.CONFIGURATION, this.instanceID))
+ .thenReturn(Futures.immediateCheckedFuture(new Boolean(assumeDataExists)));
}
- @SuppressWarnings("unchecked")
@Test
public void testRegisterToListenDataChanges() {
final ListenerAdapter listener = Notificator.createListener(this.instanceID, "stream");
+ @SuppressWarnings("unchecked")
final ListenerRegistration<DOMDataChangeListener> mockRegistration = mock(ListenerRegistration.class);
- when(this.domDataBroker.registerDataChangeListener(
- any(LogicalDatastoreType.class), eq(this.instanceID), eq(listener), eq(DataChangeScope.BASE)))
- .thenReturn(mockRegistration);
+ when(this.domDataBroker.registerDataChangeListener(any(LogicalDatastoreType.class), eq(this.instanceID),
+ eq(listener), eq(DataChangeScope.BASE))).thenReturn(mockRegistration);
- this.brokerFacade.registerToListenDataChanges(LogicalDatastoreType.CONFIGURATION, DataChangeScope.BASE, listener);
+ this.brokerFacade.registerToListenDataChanges(
+ LogicalDatastoreType.CONFIGURATION, DataChangeScope.BASE, listener);
- verify(this.domDataBroker).registerDataChangeListener(LogicalDatastoreType.CONFIGURATION, this.instanceID, listener,
- DataChangeScope.BASE);
+ verify(this.domDataBroker).registerDataChangeListener(
+ LogicalDatastoreType.CONFIGURATION, this.instanceID, listener, DataChangeScope.BASE);
assertEquals("isListening", true, listener.isListening());
- this.brokerFacade.registerToListenDataChanges(LogicalDatastoreType.CONFIGURATION,
- DataChangeScope.BASE, listener);
+ this.brokerFacade.registerToListenDataChanges(
+ LogicalDatastoreType.CONFIGURATION, DataChangeScope.BASE, listener);
verifyNoMoreInteractions(this.domDataBroker);
}
// mock registration
final ListenerRegistration<NotificationListenerAdapter> registration = mock(ListenerRegistration.class);
- when(domNotification.registerNotificationListener(listener, listener.getSchemaPath()))
+ when(this.domNotification.registerNotificationListener(listener, listener.getSchemaPath()))
.thenReturn(registration);
// test to register listener for the first time
- brokerFacade.registerToListenNotification(listener);
+ this.brokerFacade.registerToListenNotification(listener);
assertEquals("Registration was not successful", true, listener.isListening());
// try to register for the second time
- brokerFacade.registerToListenNotification(listener);
+ this.brokerFacade.registerToListenNotification(listener);
assertEquals("Registration was not successful", true, listener.isListening());
// registrations should be invoked only once
- verify(domNotification, times(1)).registerNotificationListener(listener, listener.getSchemaPath());
+ verify(this.domNotification, times(1)).registerNotificationListener(listener, listener.getSchemaPath());
// close and remove test notification listener
listener.close();