@Test public void listOfStuffReturnedWhenPassingInARepositoryMapWithout32Or64OrArm() throws XPathExpressionException, MojoFailureException, JAXBException, MalformedURLException { InputStream xmlRepositoryMap = this.getClass().getResourceAsStream("/TestRepoMap.xml"); XMLParser parser = new XMLParser(xmlRepositoryMap, new HashSet<OperatingSystem>(), new HashMap<String, String>(), false, false); DriverMap driverMap = buildDownloadableFileRepository(parser.getAllNodesInScope(), false, false, false); assertThat(driverMap.repository.size(), is(equalTo(0))); }
public static DriverMap buildDownloadableFileRepository(NodeList nodesFound, boolean useThirtyTwoBitBinaries, boolean useSixtyFourBitBinaries, boolean useArmBinaries) throws JAXBException { DriverMap driverMap = new DriverMap(); Unmarshaller unmarshaller = JAXBContext.newInstance(DriverDetails.class).createUnmarshaller(); unmarshaller.setEventHandler(new unmarshallingEventHandler()); for (int nodeNumber = 0; nodeNumber < nodesFound.getLength(); nodeNumber++) { Node node = nodesFound.item(nodeNumber); String operatingSystem = node.getParentNode().getParentNode().getParentNode().getNodeName(); String driver = node.getParentNode().getParentNode().getAttributes().getNamedItem("id").getNodeValue(); String version = node.getParentNode().getAttributes().getNamedItem("id").getNodeValue(); boolean thisIs64Bit = false; boolean thisIs32Bit = false; boolean thisIsArm = false; if (useThirtyTwoBitBinaries && node.getAttributes().getNamedItem("thirtytwobit") != null) { if (Boolean.valueOf(node.getAttributes().getNamedItem("thirtytwobit").getNodeValue())) { thisIs32Bit = true; } } if (useSixtyFourBitBinaries && node.getAttributes().getNamedItem("sixtyfourbit") != null) { if (Boolean.valueOf(node.getAttributes().getNamedItem("sixtyfourbit").getNodeValue())) { thisIs64Bit = true; } } if (useArmBinaries && node.getAttributes().getNamedItem("arm") != null) { if (Boolean.valueOf(node.getAttributes().getNamedItem("arm").getNodeValue())) { thisIsArm = true; } } DriverDetails driverDetails = unmarshaller.unmarshal(node, DriverDetails.class).getValue(); if (thisIs32Bit) { driverMap.getMapForDriverContext(DriverContext.binaryDataFor(operatingSystem, driver, ARCHITECTURE_32_BIT)).put(version, driverDetails); } if (thisIs64Bit) { driverMap.getMapForDriverContext(DriverContext.binaryDataFor(operatingSystem, driver, ARCHITECTURE_64_BIT)).put(version, driverDetails); } if (thisIsArm) { driverMap.getMapForDriverContext(DriverContext.binaryDataFor(operatingSystem, driver, ARCHITECTURE_ARM)).put(version, driverDetails); } } return driverMap; }
FileRepository { public static DriverMap buildDownloadableFileRepository(NodeList nodesFound, boolean useThirtyTwoBitBinaries, boolean useSixtyFourBitBinaries, boolean useArmBinaries) throws JAXBException { DriverMap driverMap = new DriverMap(); Unmarshaller unmarshaller = JAXBContext.newInstance(DriverDetails.class).createUnmarshaller(); unmarshaller.setEventHandler(new unmarshallingEventHandler()); for (int nodeNumber = 0; nodeNumber < nodesFound.getLength(); nodeNumber++) { Node node = nodesFound.item(nodeNumber); String operatingSystem = node.getParentNode().getParentNode().getParentNode().getNodeName(); String driver = node.getParentNode().getParentNode().getAttributes().getNamedItem("id").getNodeValue(); String version = node.getParentNode().getAttributes().getNamedItem("id").getNodeValue(); boolean thisIs64Bit = false; boolean thisIs32Bit = false; boolean thisIsArm = false; if (useThirtyTwoBitBinaries && node.getAttributes().getNamedItem("thirtytwobit") != null) { if (Boolean.valueOf(node.getAttributes().getNamedItem("thirtytwobit").getNodeValue())) { thisIs32Bit = true; } } if (useSixtyFourBitBinaries && node.getAttributes().getNamedItem("sixtyfourbit") != null) { if (Boolean.valueOf(node.getAttributes().getNamedItem("sixtyfourbit").getNodeValue())) { thisIs64Bit = true; } } if (useArmBinaries && node.getAttributes().getNamedItem("arm") != null) { if (Boolean.valueOf(node.getAttributes().getNamedItem("arm").getNodeValue())) { thisIsArm = true; } } DriverDetails driverDetails = unmarshaller.unmarshal(node, DriverDetails.class).getValue(); if (thisIs32Bit) { driverMap.getMapForDriverContext(DriverContext.binaryDataFor(operatingSystem, driver, ARCHITECTURE_32_BIT)).put(version, driverDetails); } if (thisIs64Bit) { driverMap.getMapForDriverContext(DriverContext.binaryDataFor(operatingSystem, driver, ARCHITECTURE_64_BIT)).put(version, driverDetails); } if (thisIsArm) { driverMap.getMapForDriverContext(DriverContext.binaryDataFor(operatingSystem, driver, ARCHITECTURE_ARM)).put(version, driverDetails); } } return driverMap; } }
FileRepository { public static DriverMap buildDownloadableFileRepository(NodeList nodesFound, boolean useThirtyTwoBitBinaries, boolean useSixtyFourBitBinaries, boolean useArmBinaries) throws JAXBException { DriverMap driverMap = new DriverMap(); Unmarshaller unmarshaller = JAXBContext.newInstance(DriverDetails.class).createUnmarshaller(); unmarshaller.setEventHandler(new unmarshallingEventHandler()); for (int nodeNumber = 0; nodeNumber < nodesFound.getLength(); nodeNumber++) { Node node = nodesFound.item(nodeNumber); String operatingSystem = node.getParentNode().getParentNode().getParentNode().getNodeName(); String driver = node.getParentNode().getParentNode().getAttributes().getNamedItem("id").getNodeValue(); String version = node.getParentNode().getAttributes().getNamedItem("id").getNodeValue(); boolean thisIs64Bit = false; boolean thisIs32Bit = false; boolean thisIsArm = false; if (useThirtyTwoBitBinaries && node.getAttributes().getNamedItem("thirtytwobit") != null) { if (Boolean.valueOf(node.getAttributes().getNamedItem("thirtytwobit").getNodeValue())) { thisIs32Bit = true; } } if (useSixtyFourBitBinaries && node.getAttributes().getNamedItem("sixtyfourbit") != null) { if (Boolean.valueOf(node.getAttributes().getNamedItem("sixtyfourbit").getNodeValue())) { thisIs64Bit = true; } } if (useArmBinaries && node.getAttributes().getNamedItem("arm") != null) { if (Boolean.valueOf(node.getAttributes().getNamedItem("arm").getNodeValue())) { thisIsArm = true; } } DriverDetails driverDetails = unmarshaller.unmarshal(node, DriverDetails.class).getValue(); if (thisIs32Bit) { driverMap.getMapForDriverContext(DriverContext.binaryDataFor(operatingSystem, driver, ARCHITECTURE_32_BIT)).put(version, driverDetails); } if (thisIs64Bit) { driverMap.getMapForDriverContext(DriverContext.binaryDataFor(operatingSystem, driver, ARCHITECTURE_64_BIT)).put(version, driverDetails); } if (thisIsArm) { driverMap.getMapForDriverContext(DriverContext.binaryDataFor(operatingSystem, driver, ARCHITECTURE_ARM)).put(version, driverDetails); } } return driverMap; }  }
FileRepository { public static DriverMap buildDownloadableFileRepository(NodeList nodesFound, boolean useThirtyTwoBitBinaries, boolean useSixtyFourBitBinaries, boolean useArmBinaries) throws JAXBException { DriverMap driverMap = new DriverMap(); Unmarshaller unmarshaller = JAXBContext.newInstance(DriverDetails.class).createUnmarshaller(); unmarshaller.setEventHandler(new unmarshallingEventHandler()); for (int nodeNumber = 0; nodeNumber < nodesFound.getLength(); nodeNumber++) { Node node = nodesFound.item(nodeNumber); String operatingSystem = node.getParentNode().getParentNode().getParentNode().getNodeName(); String driver = node.getParentNode().getParentNode().getAttributes().getNamedItem("id").getNodeValue(); String version = node.getParentNode().getAttributes().getNamedItem("id").getNodeValue(); boolean thisIs64Bit = false; boolean thisIs32Bit = false; boolean thisIsArm = false; if (useThirtyTwoBitBinaries && node.getAttributes().getNamedItem("thirtytwobit") != null) { if (Boolean.valueOf(node.getAttributes().getNamedItem("thirtytwobit").getNodeValue())) { thisIs32Bit = true; } } if (useSixtyFourBitBinaries && node.getAttributes().getNamedItem("sixtyfourbit") != null) { if (Boolean.valueOf(node.getAttributes().getNamedItem("sixtyfourbit").getNodeValue())) { thisIs64Bit = true; } } if (useArmBinaries && node.getAttributes().getNamedItem("arm") != null) { if (Boolean.valueOf(node.getAttributes().getNamedItem("arm").getNodeValue())) { thisIsArm = true; } } DriverDetails driverDetails = unmarshaller.unmarshal(node, DriverDetails.class).getValue(); if (thisIs32Bit) { driverMap.getMapForDriverContext(DriverContext.binaryDataFor(operatingSystem, driver, ARCHITECTURE_32_BIT)).put(version, driverDetails); } if (thisIs64Bit) { driverMap.getMapForDriverContext(DriverContext.binaryDataFor(operatingSystem, driver, ARCHITECTURE_64_BIT)).put(version, driverDetails); } if (thisIsArm) { driverMap.getMapForDriverContext(DriverContext.binaryDataFor(operatingSystem, driver, ARCHITECTURE_ARM)).put(version, driverDetails); } } return driverMap; }  static DriverMap buildDownloadableFileRepository(NodeList nodesFound, boolean useThirtyTwoBitBinaries, boolean useSixtyFourBitBinaries, boolean useArmBinaries); }
FileRepository { public static DriverMap buildDownloadableFileRepository(NodeList nodesFound, boolean useThirtyTwoBitBinaries, boolean useSixtyFourBitBinaries, boolean useArmBinaries) throws JAXBException { DriverMap driverMap = new DriverMap(); Unmarshaller unmarshaller = JAXBContext.newInstance(DriverDetails.class).createUnmarshaller(); unmarshaller.setEventHandler(new unmarshallingEventHandler()); for (int nodeNumber = 0; nodeNumber < nodesFound.getLength(); nodeNumber++) { Node node = nodesFound.item(nodeNumber); String operatingSystem = node.getParentNode().getParentNode().getParentNode().getNodeName(); String driver = node.getParentNode().getParentNode().getAttributes().getNamedItem("id").getNodeValue(); String version = node.getParentNode().getAttributes().getNamedItem("id").getNodeValue(); boolean thisIs64Bit = false; boolean thisIs32Bit = false; boolean thisIsArm = false; if (useThirtyTwoBitBinaries && node.getAttributes().getNamedItem("thirtytwobit") != null) { if (Boolean.valueOf(node.getAttributes().getNamedItem("thirtytwobit").getNodeValue())) { thisIs32Bit = true; } } if (useSixtyFourBitBinaries && node.getAttributes().getNamedItem("sixtyfourbit") != null) { if (Boolean.valueOf(node.getAttributes().getNamedItem("sixtyfourbit").getNodeValue())) { thisIs64Bit = true; } } if (useArmBinaries && node.getAttributes().getNamedItem("arm") != null) { if (Boolean.valueOf(node.getAttributes().getNamedItem("arm").getNodeValue())) { thisIsArm = true; } } DriverDetails driverDetails = unmarshaller.unmarshal(node, DriverDetails.class).getValue(); if (thisIs32Bit) { driverMap.getMapForDriverContext(DriverContext.binaryDataFor(operatingSystem, driver, ARCHITECTURE_32_BIT)).put(version, driverDetails); } if (thisIs64Bit) { driverMap.getMapForDriverContext(DriverContext.binaryDataFor(operatingSystem, driver, ARCHITECTURE_64_BIT)).put(version, driverDetails); } if (thisIsArm) { driverMap.getMapForDriverContext(DriverContext.binaryDataFor(operatingSystem, driver, ARCHITECTURE_ARM)).put(version, driverDetails); } } return driverMap; }  static DriverMap buildDownloadableFileRepository(NodeList nodesFound, boolean useThirtyTwoBitBinaries, boolean useSixtyFourBitBinaries, boolean useArmBinaries);  }