@Test void validateWithInvalidXML() { Bundle environmentBundle = new Bundle(); BundleEnvironmentValidator bundleEnvironmentValidator = new BundleEnvironmentValidator(environmentBundle); assertThrows(DeploymentBundleException.class, () -> bundleEnvironmentValidator.validateEnvironmentProvided("myBundle", "bundle", APPLICATION)); }
void validateEnvironmentProvided(String bundleName, String deploymentBundle, EnvironmentBundleCreationMode mode) { Document deploymentBundleDocument; try { deploymentBundleDocument = documentTools.parse(deploymentBundle); } catch (DocumentParseException e) { throw new DeploymentBundleException("Unable to parse deployment bundle: " + bundleName); } Element mappingElement = getSingleChildElement(deploymentBundleDocument.getDocumentElement(), MAPPINGS); List<Element> mappingElements = getChildElements(mappingElement, MAPPING); mappingElements.forEach(mapping -> { Element propertiesElement = getSingleChildElement(mapping, PROPERTIES, true); if (propertiesElement != null) { validateElement(mode, mapping, propertiesElement); } }); }
BundleEnvironmentValidator { void validateEnvironmentProvided(String bundleName, String deploymentBundle, EnvironmentBundleCreationMode mode) { Document deploymentBundleDocument; try { deploymentBundleDocument = documentTools.parse(deploymentBundle); } catch (DocumentParseException e) { throw new DeploymentBundleException("Unable to parse deployment bundle: " + bundleName); } Element mappingElement = getSingleChildElement(deploymentBundleDocument.getDocumentElement(), MAPPINGS); List<Element> mappingElements = getChildElements(mappingElement, MAPPING); mappingElements.forEach(mapping -> { Element propertiesElement = getSingleChildElement(mapping, PROPERTIES, true); if (propertiesElement != null) { validateElement(mode, mapping, propertiesElement); } }); } }
BundleEnvironmentValidator { void validateEnvironmentProvided(String bundleName, String deploymentBundle, EnvironmentBundleCreationMode mode) { Document deploymentBundleDocument; try { deploymentBundleDocument = documentTools.parse(deploymentBundle); } catch (DocumentParseException e) { throw new DeploymentBundleException("Unable to parse deployment bundle: " + bundleName); } Element mappingElement = getSingleChildElement(deploymentBundleDocument.getDocumentElement(), MAPPINGS); List<Element> mappingElements = getChildElements(mappingElement, MAPPING); mappingElements.forEach(mapping -> { Element propertiesElement = getSingleChildElement(mapping, PROPERTIES, true); if (propertiesElement != null) { validateElement(mode, mapping, propertiesElement); } }); } BundleEnvironmentValidator(Bundle environmentBundle); }
BundleEnvironmentValidator { void validateEnvironmentProvided(String bundleName, String deploymentBundle, EnvironmentBundleCreationMode mode) { Document deploymentBundleDocument; try { deploymentBundleDocument = documentTools.parse(deploymentBundle); } catch (DocumentParseException e) { throw new DeploymentBundleException("Unable to parse deployment bundle: " + bundleName); } Element mappingElement = getSingleChildElement(deploymentBundleDocument.getDocumentElement(), MAPPINGS); List<Element> mappingElements = getChildElements(mappingElement, MAPPING); mappingElements.forEach(mapping -> { Element propertiesElement = getSingleChildElement(mapping, PROPERTIES, true); if (propertiesElement != null) { validateElement(mode, mapping, propertiesElement); } }); } BundleEnvironmentValidator(Bundle environmentBundle);  }
BundleEnvironmentValidator { void validateEnvironmentProvided(String bundleName, String deploymentBundle, EnvironmentBundleCreationMode mode) { Document deploymentBundleDocument; try { deploymentBundleDocument = documentTools.parse(deploymentBundle); } catch (DocumentParseException e) { throw new DeploymentBundleException("Unable to parse deployment bundle: " + bundleName); } Element mappingElement = getSingleChildElement(deploymentBundleDocument.getDocumentElement(), MAPPINGS); List<Element> mappingElements = getChildElements(mappingElement, MAPPING); mappingElements.forEach(mapping -> { Element propertiesElement = getSingleChildElement(mapping, PROPERTIES, true); if (propertiesElement != null) { validateElement(mode, mapping, propertiesElement); } }); } BundleEnvironmentValidator(Bundle environmentBundle);   }