Search in sources :

Example 21 with Attribute

use of com.mindbright.security.x509.Attribute in project mule-migration-assistant by mulesoft.

the class OSStore method addFailAttribute.

private void addFailAttribute(Element element, MigrationReport report) {
    element.setAttribute(new Attribute("failIfPresent", "true"));
    report.report("os.store", element, element);
}
Also used : Attribute(org.jdom2.Attribute)

Example 22 with Attribute

use of com.mindbright.security.x509.Attribute in project mule-migration-assistant by mulesoft.

the class PolicyTagMigrationStepTestCase method assertMuleTagName.

private void assertMuleTagName(Element element, boolean hasContent) {
    assertThat(element.getName(), is(MULE_TAG_NAME));
    assertThat(element.getNamespace(), is(MULE_4_NAMESPACE));
    assertThat(element.getAttributes().size(), is(2));
    assertThat(element.getAttribute(POLICY_NAME_ATTR).getValue(), is(POLICY_NAME_ATTR_VALUE));
    assertThat(element.getAttribute(SCHEMA_LOCATION, XSI_NAMESPACE).getValue(), is(new Attribute(SCHEMA_LOCATION, MULE_4_XSI_SCHEMA_LOCATION_URI, XSI_NAMESPACE).getValue()));
    assertThat(element.getContentSize(), is(hasContent ? 1 : 0));
}
Also used : Attribute(org.jdom2.Attribute)

Example 23 with Attribute

use of com.mindbright.security.x509.Attribute in project mule-migration-assistant by mulesoft.

the class AssertPayload method execute.

@Override
public void execute(Element element, MigrationReport report) throws RuntimeException {
    try {
        changeNodeName("munit-tools", "assert-that").andThen(addAttribute("expression", "#[payload]")).andThen(changeAttribute("expectedValue", of("is"), empty())).apply(element);
        Attribute isAttribute = element.getAttribute("is");
        if (isAttribute != null) {
            String attributeValue = isAttribute.getValue();
            if (getExpressionMigrator().isWrapped(attributeValue)) {
                attributeValue = "#[MunitTools::equalTo(" + getExpressionMigrator().unwrap(attributeValue) + ")]";
            } else {
                attributeValue = "#[MunitTools::equalTo(" + attributeValue + ")]";
            }
            isAttribute.setValue(attributeValue);
        }
    } catch (Exception e) {
        throw new MigrationStepException("Fail to apply step. " + e.getMessage());
    }
}
Also used : Attribute(org.jdom2.Attribute) ApplicationModelUtils.changeAttribute(com.mulesoft.tools.migration.project.model.ApplicationModelUtils.changeAttribute) ApplicationModelUtils.addAttribute(com.mulesoft.tools.migration.project.model.ApplicationModelUtils.addAttribute) MigrationStepException(com.mulesoft.tools.migration.exception.MigrationStepException) MigrationStepException(com.mulesoft.tools.migration.exception.MigrationStepException)

Example 24 with Attribute

use of com.mindbright.security.x509.Attribute in project mule-migration-assistant by mulesoft.

the class DocumentHelper method replaceAttributeValue.

public static void replaceAttributeValue(Element element, String attributeName, Function<String, String> f) {
    final Attribute attribute = element.getAttribute(attributeName);
    if (attribute != null) {
        String value = attribute.getValue();
        value = f.apply(value);
        attribute.setValue(value);
    }
}
Also used : Attribute(org.jdom2.Attribute)

Example 25 with Attribute

use of com.mindbright.security.x509.Attribute in project mule-migration-assistant by mulesoft.

the class DocumentHelper method renameAttribute.

public static void renameAttribute(Element element, String attributeName, String newName) {
    final Attribute attribute = element.getAttribute(attributeName);
    if (attribute != null) {
        element.setAttribute(newName, attribute.getValue());
        element.removeAttribute(attribute);
    }
}
Also used : Attribute(org.jdom2.Attribute)

Aggregations

Attribute (org.jdom2.Attribute)316 Element (org.jdom2.Element)210 Attribute (ucar.nc2.Attribute)65 IOException (java.io.IOException)55 ArrayList (java.util.ArrayList)51 Document (org.jdom2.Document)43 Variable (ucar.nc2.Variable)39 List (java.util.List)31 HashMap (java.util.HashMap)25 Namespace (org.jdom2.Namespace)24 File (java.io.File)21 Array (ucar.ma2.Array)21 DataConversionException (org.jdom2.DataConversionException)19 Test (org.junit.Test)19 Dimension (ucar.nc2.Dimension)19 Map (java.util.Map)17 JDOMException (org.jdom2.JDOMException)16 XmlDslUtils.addMigrationAttributeToElement (com.mulesoft.tools.migration.step.util.XmlDslUtils.addMigrationAttributeToElement)15 Editor (jmri.jmrit.display.Editor)15 NamedIcon (jmri.jmrit.catalog.NamedIcon)13