@Test
public void testSetPartition() throws Exception {

    ConfigurableApplicationContext ctx = createContext();
    
    final DomainParticipant participant = ctx.getBean("domainParticipant", DomainParticipant.class);
    final Subscriber subscriber = ctx.getBean("subscriber", Subscriber.class);
    final Publisher  publisher  = ctx.getBean("publisher", Publisher.class);
    final EventLoop eventLoop   = ctx.getBean("eventLoop", EventLoop.class);
    
    try {
        final CountDownLatch stopOk = new CountDownLatch(1);
        PartitionAssignmentController controller =
                new PartitionAssignmentController(deviceIdentity,
                                                  participant,
                                                  eventLoop,
                                                  publisher,
                                                  subscriber);
        MDSHandler mdsHandler = controller.getConnectivityAdapter();
        mdsHandler.addConnectivityListener(new MDSHandler.Connectivity.MDSListener() {
            @Override
            public void handleConnectivityChange(MDSHandler.Connectivity.MDSEvent evt) {
                MDSConnectivity v = (MDSConnectivity) evt.getSource();
                if (deviceIdentity.unique_device_identifier.equals(v.unique_device_identifier))
                    stopOk.countDown();
            }
        });
        controller.start();
        String[] partitions = { "testPartition1", "testPartition2", "testPartition3"};
        controller.setPartition(partitions);
        boolean isOk = stopOk.await(5000, TimeUnit.MILLISECONDS);
        controller.shutdown();
        if (!isOk)
            Assert.fail("Did not get publication method");
    }
    catch (Exception ex) {
        throw ex;
    }
    finally {
        ctx.close();
    }
}