Search in sources :

Example 21 with Attribute

use of com.github.zhenwei.core.asn1.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.github.zhenwei.core.asn1.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.github.zhenwei.core.asn1.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.github.zhenwei.core.asn1.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.github.zhenwei.core.asn1.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 IOException (java.io.IOException)98 ArrayList (java.util.ArrayList)75 Attribute (ucar.nc2.Attribute)65 List (java.util.List)46 Document (org.jdom2.Document)43 Variable (ucar.nc2.Variable)39 HashMap (java.util.HashMap)26 Extensions (org.bouncycastle.asn1.x509.Extensions)26 X509Certificate (java.security.cert.X509Certificate)24 Namespace (org.jdom2.Namespace)24 File (java.io.File)23 Attribute (org.bouncycastle.asn1.pkcs.Attribute)21 GeneralName (org.bouncycastle.asn1.x509.GeneralName)21 Array (ucar.ma2.Array)21 Test (org.junit.Test)20 GeneralNames (org.bouncycastle.asn1.x509.GeneralNames)19 Dimension (ucar.nc2.Dimension)19 Map (java.util.Map)17