@Override public void visit(PortType artifact) { super.visit(artifact); if (oldArtifact == null) { verifyEmptyDerivedRelationships("operation", artifact.getOperation()); } else { PortType castOld = (PortType) oldArtifact; verifyUnchangedDerivedRelationships("operation", artifact.getOperation(), castOld.getOperation()); } }
/** * @see org.overlord.sramp.common.visitors.HierarchicalArtifactVisitorAdapter#visit(org.oasis_open.docs.s_ramp.ns.s_ramp_v1.PortType) */ @Override public void visit(PortType artifact) { super.visit(artifact); try { artifact.getOperation().addAll(getRelationships("operation", OperationTarget.class)); //$NON-NLS-1$ } catch (Exception e) { throw new RuntimeException(e); } }
/** * @see org.artificer.common.visitors.HierarchicalArtifactVisitor#visit(org.oasis_open.docs.s_ramp.ns.s_ramp_v1.PortType) */ @Override public void visit(PortType artifact) { super.visit(artifact); try { artifact.getOperation().addAll(getRelationships( "operation", artificerArtifact, OperationTarget.class)); } catch (Exception e) { throw new RuntimeException(e); } }
/** * @see HierarchicalArtifactVisitor#visit(org.oasis_open.docs.s_ramp.ns.s_ramp_v1.PortType) */ @Override public void visit(PortType artifact) { visitRelationships("operation", artifact.getOperation(), false); super.visit(artifact); }
/** * @see org.artificer.common.visitors.HierarchicalArtifactVisitor#visit(org.oasis_open.docs.s_ramp.ns.s_ramp_v1.PortType) */ @Override public void visit(PortType artifact) { super.visit(artifact); try { setRelationships("operation", RelationshipType.DERIVED, artifact.getOperation()); } catch (Exception e) { error = e; } }
/** * @see org.overlord.sramp.common.visitors.HierarchicalArtifactVisitorAdapter#visit(org.oasis_open.docs.s_ramp.ns.s_ramp_v1.PortType) */ @Override public void visit(PortType artifact) { visitRelationships("operation", artifact.getOperation()); //$NON-NLS-1$ super.visit(artifact); }
/** * @see org.overlord.sramp.common.visitors.HierarchicalArtifactVisitorAdapter#visit(org.oasis_open.docs.s_ramp.ns.s_ramp_v1.PortType) */ @Override public void visit(PortType artifact) { super.visit(artifact); try { setRelationships("operation", -1, 1, OperationEnum.OPERATION.toString(), false, artifact.getOperation()); //$NON-NLS-1$ } catch (Exception e) { error = e; } }
private void processPortTypes() throws XPathExpressionException { // Get all the port types and add them to the list NodeList portTypes = (NodeList) this.query(rootElement, "./wsdl:portType", XPathConstants.NODESET); for (int idx = 0; idx < portTypes.getLength(); idx++) { Element portTypeElem = (Element) portTypes.item(idx); if (portTypeElem.hasAttribute("name")) { String name = portTypeElem.getAttribute("name"); PortType portType = new PortType(); portType.setUuid(UUID.randomUUID().toString()); portType.setArtifactType(BaseArtifactEnum.PORT_TYPE); portType.setName(name); portType.setNamespace(targetNS); portType.setNCName(name); derivedArtifacts.add(portType); Collection<Operation> operations = processOperations(portTypeElem); for (Operation operation : operations) { OperationTarget target = new OperationTarget(); target.setValue(operation.getUuid()); target.setArtifactType(OperationEnum.OPERATION); portType.getOperation().add(target); } } } }
target.setValue(operation.getUuid()); target.setArtifactType(OperationEnum.OPERATION); portType.getOperation().add(target);
/** * Asserts that the port type contains a valid reference to an operation with * the given name. Returns the operation or throws if any assertions fail. * @param portType * @param operationName * @throws Exception */ private Operation assertHasOperation(PortType portType, String operationName) throws Exception { List<OperationTarget> operation = portType.getOperation(); for (OperationTarget t : operation) { Operation op = (Operation) getArtifactByTarget(t); if (op.getNCName().equals(operationName)) { return op; } } Assert.fail("Failed to find operation with name: " + operationName); //$NON-NLS-1$ return null; }
Assert.assertEquals("http://ewittman.redhat.com/sample/2012/09/wsdl/sample.wsdl", ((PortType) artifact).getNamespace()); //$NON-NLS-1$ PortType portType = (PortType) artifact; Assert.assertEquals(2, portType.getOperation().size());
List<OperationTarget> operations = samplePortType.getOperation(); Assert.assertNotNull(operations); Assert.assertEquals(2, operations.size());