@Test void validateEnvironmentProvidedClusterProperty() { Bundle environmentBundle = new Bundle(); environmentBundle.getGlobalEnvironmentProperties().put(PREFIX_GATEWAY + "myProperty", new GlobalEnvironmentProperty("myOtherProperty", "value")); BundleEnvironmentValidator bundleEnvironmentValidator = new BundleEnvironmentValidator(environmentBundle); bundleEnvironmentValidator.validateEnvironmentProvided("myBundle", "" + "<l7:Bundle xmlns:l7=\"http: " <l7:References>" + " </l7:References>\n" + " <l7:Mappings>" + " <l7:Mapping action=\"NewOrExisting\" srcId=\"89dbda0631bd25a08c73c96aebec7f5a\" type=\"CLUSTER_PROPERTY\">\n" + " <l7:Properties>\n" + " <l7:Property key=\"MapBy\">\n" + " <l7:StringValue>name</l7:StringValue>\n" + " </l7:Property>\n" + " <l7:Property key=\"MapTo\">\n" + " <l7:StringValue>myProperty</l7:StringValue>\n" + " </l7:Property>\n" + " <l7:Property key=\"FailOnNew\">\n" + " <l7:BooleanValue>true</l7:BooleanValue>\n" + " </l7:Property>\n" + " </l7:Properties>\n" + " </l7:Mapping>" + " </l7:Mappings>\n" + "</l7: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);   }