NetworkSchema implements NetworkDescriptor { public static NetworkSchema getNetwork(String name) { if(allDescriptors.size() < 1 || descriptorsByNetwork.size() < 1) { reloadDefinitions(); } List<AnalyticNodeDescriptor> l = null; if((l = descriptorsByNetwork.get(name)) == null) { System.out.println("Warning: unable to locate network by the name: " + name); return null; } return new NetworkSchema(name, l); } NetworkSchema(String name);  NetworkSchema(String name, List<AnalyticNodeDescriptor> nodes); @Override String getSpecifier(); @Override NodeType getType(); @Override String getNetworkName(); @Override void setNetworkName(String name); @SuppressWarnings("unchecked") @Override List<AnalyticNodeDescriptor> getNodeDescriptors(); @SuppressWarnings("unchecked") @Override void setNodeDescriptors(List<T> nodes); @SuppressWarnings("unchecked") @Override List<AnalyticNodeDescriptor> getPublishers(); static boolean hasNetworkByName(String networkName); static String getSchemaFilePath(); static void setSchemaFilePath(String filePath); static AnalyticNodeDescriptor lookup(String name, int timeFrames); static AnalyticNodeDescriptor lookup(SeriesSubscription subscription); static void reloadDefinitions(); static NetworkSchema getNetwork(String name); @SuppressWarnings("unchecked") static AnalyticNodeDescriptor loadDescriptor(String[] entry); static void loadAllDescriptors(); static void loadDefinitionsFile(String fileName); static void loadFromStream(InputStream stream);  }
@Test public void testGetNetwork() { NetworkSchema.setSchemaFilePath("networks.txt"); NetworkDescriptor schema = NetworkSchema.getNetwork("PivotPointOverlay"); assertNotNull(schema); assertEquals("PivotPointOverlay", schema.getNetworkName()); List<AnalyticNodeDescriptor> descList = schema.getNodeDescriptors(); assertNotNull(descList); assertEquals(7, descList.size()); assertEquals("PP_R3L", descList.get(0).getSpecifier()); assertEquals("PP_R2L", descList.get(1).getSpecifier()); assertEquals("PP_R1L", descList.get(2).getSpecifier()); assertEquals("PP_PL", descList.get(3).getSpecifier()); assertEquals("PP_S1L", descList.get(4).getSpecifier()); assertEquals("PP_S2L", descList.get(5).getSpecifier()); assertEquals("PP_S3L", descList.get(6).getSpecifier()); assertEquals(2, descList.get(0).getTimeFrames().length); assertEquals("Overlay", descList.get(0).getTimeFrames()[0]); assertEquals("Base", descList.get(0).getTimeFrames()[1]); }