/** * Create an instance of {@link NodeType } * */ public NodeType createNodeType() { return new NodeType(); }
String className = node.getClassName(); String nodeAddress = node.getAddress().trim(); byte address = Byte.parseByte(nodeAddress); byte[] nodeAddressArray = new byte[] { address }; long uniqueId = ByteUtils.convertUniqueIdToLong(node.getUniqueId()); boolean autoAddFeature = (node.isAutoAddFeature() != null ? node.isAutoAddFeature().booleanValue() : false); simulator.setProtocolVersion(node.getProtocolVersion()); simulator.setSoftwareVersion(node.getSoftwareVersion()); if (node.getFeatures() != null && CollectionUtils.hasElements(node.getFeatures().getFeature())) { simulator.setFeatures(node.getFeatures()); if (node.getCVs() != null && CollectionUtils.hasElements(node.getCVs().getCv())) { simulator.setCVs(node.getCVs()); dmxNode.setDmxConfig(node.getDmxChannels()); switchingFunctionsNode.setPortsConfig(node.getINPUT()); switchingFunctionsNode.setPortsConfig(node.getSERVO()); switchingFunctionsNode.setPortsConfig(node.getSOUND()); switchingFunctionsNode.setPortsConfig(node.getSPORT()); switchingFunctionsNode.setPortsConfig(node.getLPORT()); switchingFunctionsNode.setPortsConfig(node.getBACKLIGHT()); switchingFunctionsNode.setPortsConfig(node.getMOTOR()); simulator.setNodeName(node.getUserName()); simulator.setProductName(node.getProductName());
List<NodeType> nodes = master.getSubNodes().getNode(); Assert.assertEquals(nodes.size(), 3); Assert.assertEquals(ByteUtils.convertUniqueIdToLong(nodes.get(0).getUniqueId()), 0x05340d6B901234L); Assert.assertEquals(ByteUtils.convertUniqueIdToLong(nodes.get(1).getUniqueId()), 0x05343e97901235L); Assert.assertNotNull(node.getLPORT()); Assert.assertEquals(node.getLPORT().getCount(), 32); Assert.assertNotNull(node.getSPORT()); Assert.assertEquals(node.getSPORT().getCount(), 8); Assert.assertNull(node.isAutoAddFeature()); Assert.assertEquals(node.getProductName(), "Product1"); Assert.assertEquals(node.getUserName(), "My username"); Assert.assertNull(node.getLPORT()); Assert.assertNotNull(node.getSPORT()); Assert.assertEquals(node.getSPORT().getCount(), 8); Assert.assertNotNull(node.isAutoAddFeature()); Assert.assertEquals(node.isAutoAddFeature(), Boolean.TRUE); Assert.assertNull(node.getLPORT()); Assert.assertNull(node.getSPORT()); Assert.assertNotNull(node.getINPUT()); Assert.assertEquals(node.getINPUT().getCount(), 8); Assert.assertNotNull(node.getINPUT().getOffset()); Assert.assertEquals(node.getINPUT().getOffset().intValue(), 1); Assert.assertEquals(NodeUtils.getUniqueId(subNode.getUniqueId()), 0x05343e97901237L); Assert.assertNull(subNode.getLPORT()); Assert.assertNotNull(subNode.getSPORT());
new NodeType() .withAddress(NodeUtils.formatAddress(node.getAddr())) .withUniqueId(NodeUtils.getUniqueId(node.getUniqueId())).withClassName(className) .withProductName(node.getStoredString(StringData.INDEX_PRODUCTNAME)) .withUserName(node.getStoredString(StringData.INDEX_USERNAME)) .withProtocolVersion(node.getProtocolVersion().toString()) .withSoftwareVersion(node.getSoftwareVersion().toString());
new NodeType() .withAddress(NodeUtils.formatAddress(new byte[] { 1 })) .withUniqueId(NodeUtils.getUniqueId(0x05340d6B001234L)).withClassName("DemoSubNode") .withProductName("Demo SubNode"); master.withSubNodes(new SubNodesType().withNode(subNode)); subNode.withFeatures( new FeaturesType().withFeature(new FeatureType().withType("FEATURE_CTRL_MAC_START_MAN").withValue(1), new FeatureType().withType("FEATURE_CTRL_MAC_START_DCC").withValue(1))); subNode.withLPORT(new LightPortType().withCount(32).withPort( new LightPortParamsType() .withPortId(0).withDimSlopeDown(6).withDimSlopeUp(3).withIntensityOff(20).withIntensityOn(240),
List<NodeType> nodes = master.getSubNodes().getNode(); Assert.assertEquals(nodes.size(), 1); Assert.assertEquals(ByteUtils.convertUniqueIdToLong(nodes.get(0).getUniqueId()), 0x05340D73901235L); Assert.assertNotNull(node.getLPORT()); Assert.assertEquals(node.getLPORT().getCount(), 128); Assert.assertNotNull(node.getBACKLIGHT()); Assert.assertEquals(node.getBACKLIGHT().getCount(), 16); Assert.assertNotNull(node.getINPUT()); Assert.assertEquals(node.getINPUT().getCount(), 8); Assert.assertNotNull(node.getLPORT().getPort()); Assert.assertNotNull(node.getLPORT().getPort().get(0)); LightPortParamsType lightPortParamsType = node.getLPORT().getPort().get(0); Assert.assertEquals(lightPortParamsType.getDmxMapping(), 1); Assert.assertEquals(lightPortParamsType.getIntensityOff(), 20); Assert.assertEquals(lightPortParamsType.getIntensityOn(), 240); lightPortParamsType = node.getLPORT().getPort().get(1); Assert.assertEquals(lightPortParamsType.getDmxMapping(), 4); BacklightPortParamsType backlightPortParamsType = node.getBACKLIGHT().getPort().get(0); Assert.assertEquals(backlightPortParamsType.getDmxMapping(), 1); backlightPortParamsType = node.getBACKLIGHT().getPort().get(1); Assert.assertEquals(backlightPortParamsType.getDmxMapping(), 3); Assert.assertNotNull(node.getDmxChannels());