PartitionAssignmentController implements MDSHandler.Objective.MDSListener { public static String findMRNPartition(String p) { return findMRNPartition(fromString(p)); } 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 testParsePartitions() throws Exception { String input = "# A comment \n" + " device-group \n" + "MRN=joe\n" + "MRN=should be ignored\n"; InputStream stream = new ByteArrayInputStream(input.getBytes(StandardCharsets.UTF_8)); BufferedReader br = new BufferedReader(new InputStreamReader(stream)); PartitionAssignmentController.PersistentPartitionAssignment c = new PartitionAssignmentController.PersistentPartitionAssignment(null); List<String> l = c.readPartitionFile(br); Assert.assertEquals(2, l.size()); Assert.assertEquals("MRN=joe", PartitionAssignmentController.findMRNPartition(l)); }