PartitionAssignmentController implements MDSHandler.Objective.MDSListener { @ManagedAttribute(description="DDS partitions for this device") public void setPartition(String[] partition) { configureQosForPartition(partition); } PartitionAssignmentController(DeviceIdentity d, DomainParticipant dp, EventLoop e, Publisher p, Subscriber s);   PartitionAssignmentController(DeviceIdentity d); static String toPartition(String s); static String toMRN(String s); static boolean isMRNPartition(String s); static String findMRNPartition(String p); static String findMRNPartition(String[] p); static String findMRNPartition(Iterable<String> p); @ManagedAttribute(description="DDS partitions for this device") String[] getPartition(); @ManagedAttribute(description="DDS partitions for this device") void addPartition(String partition); void removePartition(String partition); @ManagedAttribute(description="DDS partitions for this device") void setPartition(String[] partition); static String toString(String [] partition); static String[] fromString(String partitions); void start(); void shutdown(); @Override void handleConnectivityObjective(MDSHandler.Objective.MDSEvent evt);  }
@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(); } }