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);
}
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));
}
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());
}
}
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);
}
}
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);
}
}
Aggregations