NetworkManager proxy = network.get(1); // where the user profile is stored
proxy.getConnection().getPeer().getPeerBean().storage(new H2HStorageMemory());
// create the needed objects
String userId = proxy.getNodeId();
Locations newLocations = new Locations(userId);
newLocations.addPeerAddress(putter.getConnection().getPeer().getPeerAddress());
KeyPair protectionKeys = EncryptionUtil.generateRSAKeyPair();
// initialize the process and the one and only step to test
PutLocationContext context = new PutLocationContext(newLocations, protectionKeys);
PutUserLocationsStep step = new PutUserLocationsStep(context, context, putter.getDataManager());
UseCaseTestUtil.executeProcess(step);
// get the locations
FutureGet future = proxy.getDataManager().getUnblocked(
new Parameters().setLocationKey(userId).setContentKey(H2HConstants.USER_LOCATIONS));
future.awaitUninterruptibly();
Assert.assertNotNull(future.getData());
Locations found = (Locations) future.getData().object();
// verify if both objects are the same
Assert.assertEquals(userId, found.getUserId());
List<PeerAddress> onlinePeers = new ArrayList<PeerAddress>(found.getPeerAddresses());
Assert.assertEquals(putter.getConnection().getPeer().getPeerAddress(), onlinePeers.get(0));
}