List of usage examples for javax.xml.namespace QName QName
public QName(String namespaceURI, String localPart, String prefix)
QName
constructor specifying the Namespace URI, local part and prefix.
If the Namespace URI is null
, it is set to javax.xml.XMLConstants#NULL_NS_URI XMLConstants.NULL_NS_URI .
From source file:org.drools.camel.component.cxf.CxfSoapTest.java
@Test public void test1() throws Exception { SOAPMessage soapMessage = MessageFactory.newInstance().createMessage(); SOAPBody body = soapMessage.getSOAPPart().getEnvelope().getBody(); QName payloadName = new QName("http://soap.jax.drools.org", "execute", "ns1"); body.addBodyElement(payloadName);/* w w w . ja v a 2 s. c o m*/ String cmd = ""; cmd += "<batch-execution lookup=\"ksession1\">\n"; cmd += " <insert out-identifier=\"salaboy\" disconnected=\"true\">\n"; cmd += " <org.drools.pipeline.camel.Person>\n"; cmd += " <name>salaboy</name>\n"; cmd += " <age>27</age>\n"; cmd += " </org.drools.pipeline.camel.Person>\n"; cmd += " </insert>\n"; cmd += " <fire-all-rules/>\n"; cmd += "</batch-execution>\n"; body.addTextNode(cmd); Object object = this.context.createProducerTemplate().requestBody("direct://http", soapMessage); OutputStream out = new ByteArrayOutputStream(); out = new ByteArrayOutputStream(); soapMessage = (SOAPMessage) object; soapMessage.writeTo(out); String response = out.toString(); assertTrue(response.contains("fact-handle identifier=\"salaboy\"")); }
From source file:com.provenance.cloudprovenance.converter.traceability.test.PolicyRequestConverterTest.java
@Test public void convertPolicyToXMLTest() { ObjectFactory tModelFactory = new ObjectFactory(); PolicyRequest req = tModelFactory.createPolicyRequest(); Agent agent = tModelFactory.createPolicyRequestAgent(); QName agentId = new QName("www.temp.org", "ag001", "ex"); agent.setId(agentId);/*from w ww . ja v a 2s. com*/ req.getAgent().add(agent); String outcome = pConverter.marhsallObject(req); Assert.notNull(outcome); logger.info("outcome: " + outcome); }
From source file:org.brekka.stillingar.example.ContextReloadTest.java
private static Configuration writeConfig() { ConfigurationDocument doc = ConfigurationDocument.Factory.newInstance(); Configuration configuration = doc.addNewConfiguration(); configuration.setMOTD("Some message"); ApplicationContext subAppContext = configuration.addNewApplicationContext(); XmlCursor cursor = subAppContext.newCursor(); cursor.toEndToken();//from www. ja v a 2s.c om cursor.beginElement(new QName("http://www.springframework.org/schema/beans", "beans", "b")); cursor.toEndToken(); cursor.beginElement(new QName("http://brekka.org/schema/stillingar/v1", "annotation-config", "stil")); cursor.toFirstAttribute(); cursor.insertAttributeWithValue("service-ref", "stillingar-example"); cursor.toEndToken(); cursor.toNextToken(); cursor.beginElement(new QName("http://www.springframework.org/schema/beans", "bean", "b")); cursor.toFirstAttribute(); cursor.insertAttributeWithValue("id", "motd"); cursor.insertAttributeWithValue("class", MessageOfTheDay.class.getName()); cursor.dispose(); TestSupport.write(doc); return configuration; }
From source file:org.opensaml.liberty.binding.decoding.HTTPPAOS11DecoderTest.java
public void testUnderstandsPaosResponseHeader() { QName paosResponseHeader = new QName(SAMLConstants.PAOS_NS, "Response", SAMLConstants.PAOS_PREFIX); assertTrue("The PAOS Decoder does not understand paos:Response header", decoder.getUnderstoodHeaders().contains(paosResponseHeader)); }
From source file:at.ac.univie.isc.asio.tool.ExpandingQNameSerializerTest.java
@Test public void should_ignore_prefix() throws Exception { subject.serialize(new QName("http://test.com/", "local", "prefix"), generator, null); generator.flush();/*from ww w .jav a 2 s. co m*/ assertThat(sink.toString(), is("\"http://test.com/local\"")); }
From source file:com.provenance.cloudprovenance.converter.traceability.test.TraceabilityConverterTest.java
@Test public void convertTraceabilityElementToXMLTest() { // gen temp data ObjectFactory tModelFactory = new ObjectFactory(); TraceabilityDocument traceabilityDoc = tModelFactory.createTraceabilityDocument(); Agent agent = tModelFactory.createAgent(); QName agentId = new QName("www.temp.org", "ag001", "ex"); agent.setId(agentId);//from w ww.j a va2 s . c om InternationalizedString iStringName = new InternationalizedString(); iStringName.setValue("Bob"); agent.getLocationOrLabelOrType().add(tModelFactory.createLabel(iStringName)); InternationalizedString iStringDescription = new InternationalizedString(); iStringDescription.setValue("A test user"); traceabilityDoc.getEntityOrActivityOrWasGeneratedBy().add(agent); String conversion = trConverter.marhsallObject(traceabilityDoc); logger.info(conversion); Assert.notNull(conversion); }
From source file:de.ii.xtraplatform.feature.provider.wfs.FeatureProviderDataWfsFromMetadata.java
@Override public void analyzeFeatureType(String featureTypeName) { if (featureTypeName.contains(":")) { String[] name = featureTypeName.split(":"); String namespace = namespaceNormalizer.getNamespaceURI(name[0]); featureProviderDataWfs.putFeatureTypes(name[1].toLowerCase(), new QName(namespace, name[1], name[0])); }/*from w w w . jav a 2 s . c o m*/ }
From source file:org.drools.camel.component.cxf.CxfSoapTestWithLookup.java
public void testCxfSoapSessionLookup() throws Exception { SOAPMessage soapMessage = MessageFactory.newInstance().createMessage(); SOAPBody body = soapMessage.getSOAPPart().getEnvelope().getBody(); QName payloadName = new QName("http://soap.jax.drools.org", "execute", "ns1"); body.addBodyElement(payloadName);/* w w w .j a va 2 s . c o m*/ String cmd = ""; cmd += "<batch-execution lookup=\"ksession1\">\n"; cmd += " <insert out-identifier=\"salaboy\" disconnected=\"true\">\n"; cmd += " <org.drools.springframework.Person2>\n"; cmd += " <name>salaboy</name>\n"; cmd += " <age>27</age>\n"; cmd += " </org.drools.springframework.Person2>\n"; cmd += " </insert>\n"; cmd += " <fire-all-rules/>\n"; cmd += "</batch-execution>\n"; body.addTextNode(cmd); Object object = this.context.createProducerTemplate().requestBody("direct://http", soapMessage); OutputStream out = new ByteArrayOutputStream(); out = new ByteArrayOutputStream(); soapMessage = (SOAPMessage) object; soapMessage.writeTo(out); String response = out.toString(); assertTrue(response.contains("fact-handle identifier=\"salaboy\"")); SOAPMessage soapMessage2 = MessageFactory.newInstance().createMessage(); SOAPBody body2 = soapMessage.getSOAPPart().getEnvelope().getBody(); QName payloadName2 = new QName("http://soap.jax.drools.org", "execute", "ns1"); body2.addBodyElement(payloadName2); String cmd2 = ""; cmd2 += "<batch-execution lookup=\"ksession2\">\n"; cmd2 += " <insert out-identifier=\"salaboy\" disconnected=\"true\">\n"; cmd2 += " <org.drools.springframework.Person3>\n"; cmd2 += " <name>salaboy</name>\n"; cmd2 += " <age>27</age>\n"; cmd2 += " </org.drools.springframework.Person3>\n"; cmd2 += " </insert>\n"; cmd2 += " <fire-all-rules/>\n"; cmd2 += "</batch-execution>\n"; body2.addTextNode(cmd2); Object object2 = this.context.createProducerTemplate().requestBody("direct://http", soapMessage2); OutputStream out2 = new ByteArrayOutputStream(); out2 = new ByteArrayOutputStream(); soapMessage2 = (SOAPMessage) object2; soapMessage2.writeTo(out2); String response2 = out2.toString(); assertTrue(response2.contains("fact-handle identifier=\"salaboy\"")); }
From source file:org.kie.camel.component.cxf.CxfSoapTestWithLookup.java
public void testCxfSoapSessionLookup() throws Exception { SOAPMessage soapMessage = MessageFactory.newInstance().createMessage(); SOAPBody body = soapMessage.getSOAPPart().getEnvelope().getBody(); QName payloadName = new QName("http://soap.jax.drools.org", "execute", "ns1"); body.addBodyElement(payloadName);/*ww w. j a va 2 s. co m*/ String cmd = ""; cmd += "<batch-execution lookup=\"ksession1\">\n"; cmd += " <insert out-identifier=\"salaboy\" disconnected=\"true\">\n"; cmd += " <org.kie.springframework.Person2>\n"; cmd += " <name>salaboy</name>\n"; cmd += " <age>27</age>\n"; cmd += " </org.kie.springframework.Person2>\n"; cmd += " </insert>\n"; cmd += " <fire-all-rules/>\n"; cmd += "</batch-execution>\n"; body.addTextNode(cmd); Object object = this.context.createProducerTemplate().requestBody("direct://http", soapMessage); OutputStream out = new ByteArrayOutputStream(); out = new ByteArrayOutputStream(); soapMessage = (SOAPMessage) object; soapMessage.writeTo(out); String response = out.toString(); assertTrue(response.contains("fact-handle identifier=\"salaboy\"")); SOAPMessage soapMessage2 = MessageFactory.newInstance().createMessage(); SOAPBody body2 = soapMessage.getSOAPPart().getEnvelope().getBody(); QName payloadName2 = new QName("http://soap.jax.drools.org", "execute", "ns1"); body2.addBodyElement(payloadName2); String cmd2 = ""; cmd2 += "<batch-execution lookup=\"ksession2\">\n"; cmd2 += " <insert out-identifier=\"salaboy\" disconnected=\"true\">\n"; cmd2 += " <org.kie.springframework.Person3>\n"; cmd2 += " <name>salaboy</name>\n"; cmd2 += " <age>27</age>\n"; cmd2 += " </org.kie.springframework.Person3>\n"; cmd2 += " </insert>\n"; cmd2 += " <fire-all-rules/>\n"; cmd2 += "</batch-execution>\n"; body2.addTextNode(cmd2); Object object2 = this.context.createProducerTemplate().requestBody("direct://http", soapMessage2); OutputStream out2 = new ByteArrayOutputStream(); out2 = new ByteArrayOutputStream(); soapMessage2 = (SOAPMessage) object2; soapMessage2.writeTo(out2); String response2 = out2.toString(); assertTrue(response2.contains("fact-handle identifier=\"salaboy\"")); }
From source file:org.wiredwidgets.cow.server.transform.v2.bpmn20.Bpmn20ProcessBuilder.java
@Override public Definitions build(org.wiredwidgets.cow.server.api.model.v2.Process source) { Definitions definitions = new Definitions(); definitions.setName(source.getName()); definitions.setId(DEFINITIONS_ID);/* w ww .ja v a2 s . co m*/ definitions.setTargetNamespace("http://www.jboss.org/drools"); definitions.setTypeLanguage("http://www.java.com/javaTypes"); definitions.setExpressionLanguage("http://www.mvel.org/2.0"); TProcess process = new TProcess(); process.setProcessType(TProcessType.PRIVATE); process.setIsExecutable(Boolean.TRUE); process.getOtherAttributes().put(new QName("http://www.jboss.org/drools", "packageName", "tns"), "defaultPackage"); process.setId("com.sample.evaluation"); process.setName(source.getName()); definitions.getRootElements().add(factory.createProcess(process)); Bpmn20ProcessContext context = new Bpmn20ProcessContext(source, definitions, process); // Every process has a Map for ad-hoc content context.addProcessVariable("content", "java.util.Map"); // Add any additional variables defined in the workflow if (source.getVariables() != null) { for (Variable var : source.getVariables().getVariables()) { context.addProcessVariable(var.getName(), "String"); } } // TODO: initialize the process variables from values specified in the master workflow Builder startBuilder = new Bpmn20StartNodeBuilder(context); startBuilder.build(null); Activity activity = source.getActivity().getValue(); Builder builder = createActivityBuilder(context, activity); builder.build(null); startBuilder.link(builder); Builder endBuilder = new Bpmn20EndNodeBuilder(context); endBuilder.build(null); builder.link(endBuilder); return definitions; }