use of com.google.cloud.servicedirectory.v1.Namespace in project mycore by MyCoRe-Org.
the class MCRNodeBuilder method buildNameStep.
@SuppressWarnings("unchecked")
private Object buildNameStep(NameStep nameStep, String value, Parent parent) throws JaxenException {
String name = nameStep.getLocalName();
String prefix = nameStep.getPrefix();
Namespace ns = prefix.isEmpty() ? Namespace.NO_NAMESPACE : MCRConstants.getStandardNamespace(prefix);
if (nameStep.getAxis() == Axis.CHILD) {
if (parent instanceof Document) {
return buildPredicates(nameStep.getPredicates(), ((Document) parent).getRootElement());
} else {
return buildPredicates(nameStep.getPredicates(), buildElement(ns, name, value, (Element) parent));
}
} else if (nameStep.getAxis() == Axis.ATTRIBUTE) {
return buildAttribute(ns, name, value, (Element) parent);
} else {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("ignoring axis, can not be built: {} {}{}", nameStep.getAxis(), prefix.isEmpty() ? "" : prefix + ":", name);
}
return null;
}
}
use of com.google.cloud.servicedirectory.v1.Namespace in project mycore by MyCoRe-Org.
the class MCRORCIDConstants method buildNamespace.
private static Namespace buildNamespace(String prefix) {
Namespace namespace = Namespace.getNamespace(prefix, "http://www.orcid.org/ns/" + prefix);
NAMESPACES.add(namespace);
return namespace;
}
use of com.google.cloud.servicedirectory.v1.Namespace in project oozie by apache.
the class TestLiteWorkflowAppParser method extractConfig.
private XConfiguration extractConfig(LiteWorkflowApp app, String actionNode) throws Exception {
String confXML = app.getNode(actionNode).getConf();
Element confElement = XmlUtils.parseXml(confXML);
Namespace ns = confElement.getNamespace();
String configSection = XmlUtils.prettyPrint(confElement.getChild("configuration", ns)).toString();
XConfiguration xconf = new XConfiguration(new StringReader(configSection));
return xconf;
}
use of com.google.cloud.servicedirectory.v1.Namespace in project oozie by apache.
the class TestHiveActionExecutor method testActionConfLoadDefaultResources.
public void testActionConfLoadDefaultResources() throws Exception {
ConfigurationService.setBoolean("oozie.service.HadoopAccessorService.action.configurations.load.default.resources", false);
Path inputDir = new Path(getFsTestCaseDir(), INPUT_DIRNAME);
Path outputDir = new Path(getFsTestCaseDir(), OUTPUT_DIRNAME);
FileSystem fs = getFileSystem();
Path script = new Path(getAppPath(), HIVE_SCRIPT_FILENAME);
Writer scriptWriter = new OutputStreamWriter(fs.create(script), StandardCharsets.UTF_8);
scriptWriter.write(getHiveScript(inputDir.toString(), outputDir.toString()));
scriptWriter.close();
Writer dataWriter = new OutputStreamWriter(fs.create(new Path(inputDir, DATA_FILENAME)), StandardCharsets.UTF_8);
dataWriter.write(SAMPLE_DATA_TEXT);
dataWriter.close();
Context context = createContext(getActionScriptXml());
Namespace ns = Namespace.getNamespace("uri:oozie:hive-action:0.2");
submitAction(context, ns);
FSDataInputStream os = fs.open(new Path(context.getActionDir(), LauncherAMUtils.ACTION_CONF_XML));
XConfiguration conf = new XConfiguration();
conf.addResource(os);
assertNull(conf.get("oozie.HadoopAccessorService.created"));
}
use of com.google.cloud.servicedirectory.v1.Namespace in project qpp-conversion-tool by CMSgov.
the class AggregateCountDecoderTest method testInternalDecode.
@Test
void testInternalDecode() {
Namespace rootNs = Namespace.getNamespace("urn:hl7-org:v3");
Namespace ns = Namespace.getNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
Context context = new Context();
Element element = new Element("observation", rootNs);
element.addContent(new Element("templateId", rootNs).setAttribute("root", TemplateId.PI_AGGREGATE_COUNT.getTemplateId(context)));
element.addContent(new Element("value", rootNs).setAttribute("value", "450").setAttribute("type", "INT", ns));
element.addNamespaceDeclaration(ns);
Node thisNode = new Node();
AggregateCountDecoder instance = new AggregateCountDecoder(context);
instance.setNamespace(element.getNamespace());
instance.decode(element, thisNode);
assertThat(thisNode.getValue("aggregateCount")).isEqualTo("450");
}
Aggregations