@Test public void testHandleChange() throws Exception { peerGroupListener.handleChange(Collections.singletonList(getObjectModification( getObjectModification(DataObjectModification.ModificationType.WRITE, getPeerGroup("GR", 2), getPeerGroup("GR", 3)))), LogicalDatastoreType.OPERATIONAL, getIdentifier()); verify(writeTransaction, never()).put(eq(LogicalDatastoreType.OPERATIONAL), any(InstanceIdentifier.class), any(DataObject.class)); verify(writeTransaction, never()).merge(eq(LogicalDatastoreType.OPERATIONAL), any(InstanceIdentifier.class), any(DataObject.class)); verify(writeTransaction, never()).delete(eq(LogicalDatastoreType.OPERATIONAL), any(InstanceIdentifier.class)); peerGroupListener.handleChange(Collections.singletonList(getObjectModification( getObjectModification(DataObjectModification.ModificationType.WRITE, null, getPeerGroup("GR", 2)))), LogicalDatastoreType.CONFIGURATION, getIdentifier()); verify(writeTransaction).put(eq(LogicalDatastoreType.OPERATIONAL), any(InstanceIdentifier.class), any(DataObject.class)); peerGroupListener.handleChange(Collections.singletonList(getObjectModification( getObjectModification(DataObjectModification.ModificationType.WRITE, getPeerGroup("GR", 2), getPeerGroup("GR", 3)))), LogicalDatastoreType.CONFIGURATION, getIdentifier()); verify(writeTransaction) .merge(eq(LogicalDatastoreType.OPERATIONAL), any(InstanceIdentifier.class), any(DataObject.class)); peerGroupListener.handleChange(Collections.singletonList(getObjectModification( getObjectModification(DataObjectModification.ModificationType.DELETE, getPeerGroup("GR", 3), getPeerGroup("GR", 2)))), LogicalDatastoreType.CONFIGURATION, getIdentifier()); verify(writeTransaction, times(1)).delete(eq(LogicalDatastoreType.OPERATIONAL), any(InstanceIdentifier.class)); }
@Override protected InstanceIdentifier<SxpPeerGroup> getIdentifier(SxpPeerGroup d, InstanceIdentifier<SxpNodeIdentity> parentIdentifier) { Preconditions.checkNotNull(d); Preconditions.checkNotNull(parentIdentifier); return parentIdentifier.child(SxpPeerGroups.class).child(SxpPeerGroup.class, new SxpPeerGroupKey(d.getName())); }
PeerGroupListener extends ListListener<SxpNodeIdentity, SxpPeerGroups, SxpPeerGroup> { @Override protected InstanceIdentifier<SxpPeerGroup> getIdentifier(SxpPeerGroup d, InstanceIdentifier<SxpNodeIdentity> parentIdentifier) { Preconditions.checkNotNull(d); Preconditions.checkNotNull(parentIdentifier); return parentIdentifier.child(SxpPeerGroups.class).child(SxpPeerGroup.class, new SxpPeerGroupKey(d.getName())); } }
PeerGroupListener extends ListListener<SxpNodeIdentity, SxpPeerGroups, SxpPeerGroup> { @Override protected InstanceIdentifier<SxpPeerGroup> getIdentifier(SxpPeerGroup d, InstanceIdentifier<SxpNodeIdentity> parentIdentifier) { Preconditions.checkNotNull(d); Preconditions.checkNotNull(parentIdentifier); return parentIdentifier.child(SxpPeerGroups.class).child(SxpPeerGroup.class, new SxpPeerGroupKey(d.getName())); } PeerGroupListener(DatastoreAccess datastoreAccess); }
PeerGroupListener extends ListListener<SxpNodeIdentity, SxpPeerGroups, SxpPeerGroup> { @Override protected InstanceIdentifier<SxpPeerGroup> getIdentifier(SxpPeerGroup d, InstanceIdentifier<SxpNodeIdentity> parentIdentifier) { Preconditions.checkNotNull(d); Preconditions.checkNotNull(parentIdentifier); return parentIdentifier.child(SxpPeerGroups.class).child(SxpPeerGroup.class, new SxpPeerGroupKey(d.getName())); } PeerGroupListener(DatastoreAccess datastoreAccess);  }
PeerGroupListener extends ListListener<SxpNodeIdentity, SxpPeerGroups, SxpPeerGroup> { @Override protected InstanceIdentifier<SxpPeerGroup> getIdentifier(SxpPeerGroup d, InstanceIdentifier<SxpNodeIdentity> parentIdentifier) { Preconditions.checkNotNull(d); Preconditions.checkNotNull(parentIdentifier); return parentIdentifier.child(SxpPeerGroups.class).child(SxpPeerGroup.class, new SxpPeerGroupKey(d.getName())); } PeerGroupListener(DatastoreAccess datastoreAccess);   }