You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/10/24 06:31:01 UTC
svn commit: r587778 [4/13] - in /incubator/tuscany/branches/sca-java-1.0.1:
./ distribution/ distribution/bundle/ distribution/manifest/
distribution/webapp/src/main/java/org/apache/tuscany/sca/webapp/
distribution/webapp/src/main/resources/_node/ dist...
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java Tue Oct 23 21:30:02 2007
@@ -40,11 +40,11 @@
import org.apache.tuscany.sca.assembly.Contract;
import org.apache.tuscany.sca.assembly.Implementation;
import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.assembly.Wire;
-import org.apache.tuscany.sca.assembly.OptimizableBinding;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
import org.apache.tuscany.sca.assembly.builder.Problem.Severity;
import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
@@ -119,12 +119,12 @@
// Compute the policies before connecting component references
computePolicies(composite);
- // Connect component references to their targets
- connectComponentReferences(composite, components, componentServices, componentReferences);
-
// Connect component references as described in wires
connectWires(composite, componentServices, componentReferences);
+ // Connect component references to their targets
+ connectComponentReferences(composite, components, componentServices, componentReferences);
+
// Validate that references are wired or promoted, according
// to their multiplicity
for (ComponentReference componentReference : componentReferences.values()) {
@@ -489,7 +489,7 @@
targetComponentService = ((CompositeService)targetComponentService.getService()).getPromotedService();
}
- determinePolicySet(componentReference, targetComponentService);
+ determineApplicableBindingPolicySets(componentReference, targetComponentService);
// Match the binding against the bindings of the target service
Binding selected = BindingUtil.resolveBindings(componentReference, targetComponent, targetComponentService);
@@ -798,7 +798,7 @@
compositePolicySets = ((PolicySetAttachPoint)composite).getPolicySets();
}
- //Initialize service bindings
+ //compute policies for composite service bindings
for (Service service : composite.getServices()) {
CompositeService compositeService = (CompositeService)service;
@@ -821,6 +821,7 @@
}
computeBindingIntentsAndPolicySets(service);
+ determineApplicableBindingPolicySets(service, null);
}
for (Reference reference : composite.getReferences()) {
@@ -845,6 +846,7 @@
}
computeBindingIntentsAndPolicySets(reference);
+ determineApplicableBindingPolicySets(reference, null);
}
for (Component component : composite.getComponents()) {
@@ -854,6 +856,9 @@
// Inherit policysets defined at the composite level
addInheritedPolicySets(compositePolicySets, component.getPolicySets(), false);
+ Implementation implemenation = component.getImplementation();
+ computeImplementationIntentsAndPolicySets(implemenation, component);
+
for (ComponentService componentService : component.getServices()) {
//inherit intents and policysets from component
addInheritedIntents(component.getRequiredIntents(), componentService.getRequiredIntents());
@@ -876,6 +881,7 @@
//compute intents and policyset for each binding
computeBindingIntentsAndPolicySets(componentService);
+ determineApplicableBindingPolicySets(componentService, null);
}
for (ComponentReference componentReference : component.getReferences()) {
@@ -900,6 +906,7 @@
//compute intents and policyset for each binding
computeBindingIntentsAndPolicySets(componentReference);
+ determineApplicableBindingPolicySets(componentReference, null);
}
}
@@ -944,7 +951,6 @@
service.getCallback().getBindings(),
service.getCallback().getPolicySets());
}
- determinePolicySet(service, null);
}
private void computeBindingIntentsAndPolicySets(Reference reference) {
@@ -958,148 +964,175 @@
reference.getCallback().getBindings(),
reference.getCallback().getPolicySets());
}
- determinePolicySet(reference, null);
}
- private void computeIntents(List<Binding> bindings, List<Intent> inheritedIntents) {
+ private void computeImplementationIntentsAndPolicySets(Implementation implementation, Component parent) {
+ if ( implementation instanceof PolicySetAttachPoint ) {
+ computeIntentsForIntentAttachPoint((IntentAttachPoint)implementation, parent.getRequiredIntents());
+ computePolicySetsForPolicySetAttachPoint(parent, (PolicySetAttachPoint)implementation, parent.getPolicySets());
+ determineApplicableImplementationPolicySets(parent);
+ }
+ }
+
+ private void computeIntentsForIntentAttachPoint(IntentAttachPoint intentAttachPoint, List<Intent> inheritedIntents) {
boolean found = false;
List<Intent> expandedIntents = null;
+
+ IntentAttachPointType attachPointType = intentAttachPoint.getType();
- for (Binding binding : bindings) {
- if (binding instanceof IntentAttachPoint) {
-
- IntentAttachPoint policiedBinding = (IntentAttachPoint)binding;
- IntentAttachPointType bindingType = policiedBinding.getType();
-
- //expand profile intents specified in the binding
- if ( policiedBinding.getRequiredIntents().size() > 0 ) {
- expandedIntents = expandProfileIntents(policiedBinding.getRequiredIntents());
- policiedBinding.getRequiredIntents().clear();
- policiedBinding.getRequiredIntents().addAll(expandedIntents);
+ //expand profile intents specified in the attachpoint (binding / implementation)
+ if ( intentAttachPoint.getRequiredIntents().size() > 0 ) {
+ expandedIntents = expandProfileIntents(intentAttachPoint.getRequiredIntents());
+ intentAttachPoint.getRequiredIntents().clear();
+ intentAttachPoint.getRequiredIntents().addAll(expandedIntents);
+ }
+
+ //validate intents specified for the attachpoint (binding / implementation)
+ for (Intent intent : intentAttachPoint.getRequiredIntents()) {
+ for (QName constrained : intent.getConstrains()) {
+ if (attachPointType != null && attachPointType.getName().getNamespaceURI().equals(constrained
+ .getNamespaceURI()) && attachPointType.getName().getLocalPart()
+ .startsWith(constrained.getLocalPart())) {
+ found = true;
+ break;
}
-
- //validate intents specified for the binding
- for (Intent intent : policiedBinding.getRequiredIntents()) {
- for (QName constrained : intent.getConstrains()) {
- if (bindingType.getName().getNamespaceURI().equals(constrained
- .getNamespaceURI()) && bindingType.getName().getLocalPart()
- .startsWith(constrained.getLocalPart())) {
- found = true;
- break;
- }
- }
+ }
- if (!found) {
- warning("Policy Intent '" + intent.getName()
- + "' does not constrain binding type "
- + bindingType, binding);
- }
- }
-
- //expand profile intents in inherited intents
- expandedIntents = expandProfileIntents(inheritedIntents);
- inheritedIntents.clear();
- inheritedIntents.addAll(expandedIntents);
-
- //validate if inherited intent applies to the binding and
- //only add such intents to the binding
- for (Intent intent : inheritedIntents) {
- for (QName constrained : intent.getConstrains()) {
- if (bindingType.getName().getNamespaceURI().equals(constrained
- .getNamespaceURI()) && bindingType.getName().getLocalPart()
- .startsWith(constrained.getLocalPart())) {
- policiedBinding.getRequiredIntents().add(intent);
- break;
- }
- }
- }
-
- Map<QName, Intent> intentsTable = new HashMap<QName, Intent>();
- //remove duplicates
- for ( Intent intent : policiedBinding.getRequiredIntents() ) {
- intentsTable.put(intent.getName(), intent);
- }
-
- Map<QName, Intent> intentsTableCopy = new HashMap<QName, Intent>(intentsTable);
- //if qualified form of intent exists remove the unqualified form
- for ( Intent intent : intentsTableCopy.values() ) {
- if ( intent instanceof QualifiedIntent ) {
- QualifiedIntent qualifiedIntent = (QualifiedIntent)intent;
- if ( intentsTable.get(qualifiedIntent.getQualifiableIntent().getName()) != null ) {
- intentsTable.remove(qualifiedIntent.getQualifiableIntent().getName());
- }
- }
+ if (!found) {
+ warning("Policy Intent '" + intent.getName()
+ + "' does not constrain extension type "
+ + attachPointType, intentAttachPoint);
+ }
+ }
+
+ //expand profile intents in inherited intents
+ expandedIntents = expandProfileIntents(inheritedIntents);
+ inheritedIntents.clear();
+ inheritedIntents.addAll(expandedIntents);
+
+ //validate if inherited intent applies to the attachpoint (binding / implementation) and
+ //only add such intents to the attachpoint (binding / implementation)
+ for (Intent intent : inheritedIntents) {
+ for (QName constrained : intent.getConstrains()) {
+ if (attachPointType != null && attachPointType.getName().getNamespaceURI().equals(constrained
+ .getNamespaceURI()) && attachPointType.getName().getLocalPart()
+ .startsWith(constrained.getLocalPart())) {
+ intentAttachPoint.getRequiredIntents().add(intent);
+ break;
}
- policiedBinding.getRequiredIntents().clear();
- policiedBinding.getRequiredIntents().addAll(intentsTable.values());
-
- //exclude intents that are inherently supported by the binding type
- List<Intent> requiredIntents = new ArrayList<Intent>(policiedBinding.getRequiredIntents());
- for ( Intent intent : requiredIntents ) {
- if ( bindingType.getAlwaysProvidedIntents() != null &&
- bindingType.getAlwaysProvidedIntents().contains(intent) ) {
- policiedBinding.getRequiredIntents().remove(intent);
- }
+ }
+ }
+
+ //remove duplicates
+ Map<QName, Intent> intentsTable = new HashMap<QName, Intent>();
+ for ( Intent intent : intentAttachPoint.getRequiredIntents() ) {
+ intentsTable.put(intent.getName(), intent);
+ }
+
+ //where qualified form of intent exists retain it and remove the qualifiable intent
+ Map<QName, Intent> intentsTableCopy = new HashMap<QName, Intent>(intentsTable);
+ //if qualified form of intent exists remove the unqualified form
+ for ( Intent intent : intentsTableCopy.values() ) {
+ if ( intent instanceof QualifiedIntent ) {
+ QualifiedIntent qualifiedIntent = (QualifiedIntent)intent;
+ if ( intentsTable.get(qualifiedIntent.getQualifiableIntent().getName()) != null ) {
+ intentsTable.remove(qualifiedIntent.getQualifiableIntent().getName());
}
-
}
}
+ intentAttachPoint.getRequiredIntents().clear();
+ intentAttachPoint.getRequiredIntents().addAll(intentsTable.values());
+
+ //exclude intents that are inherently supported by the
+ //attachpoint-type (binding-type / implementation-type)
+ List<Intent> requiredIntents = new ArrayList<Intent>(intentAttachPoint.getRequiredIntents());
+ for ( Intent intent : requiredIntents ) {
+ if ( isProvidedInherently(attachPointType, intent) ) {
+ intentAttachPoint.getRequiredIntents().remove(intent);
+ }
+ }
+
+ }
+
+ private boolean isProvidedInherently(IntentAttachPointType attachPointType, Intent intent) {
+ return ( attachPointType != null &&
+ (( attachPointType.getAlwaysProvidedIntents() != null &&
+ attachPointType.getAlwaysProvidedIntents().contains(intent) ) ||
+ ( attachPointType.getMayProvideIntents() != null &&
+ attachPointType.getMayProvideIntents().contains(intent) )
+ ) );
}
+
+ private void computeIntents(List<Binding> bindings, List<Intent> inheritedIntents) {
+ for (Binding binding : bindings) {
+ if (binding instanceof IntentAttachPoint) {
+ computeIntentsForIntentAttachPoint((IntentAttachPoint)binding, inheritedIntents);
+ }
+ }
+ }
+
+
+ private void computePolicySetsForPolicySetAttachPoint(Base parent,
+ PolicySetAttachPoint policySetAttachPoint,
+ List<PolicySet> inheritedPolicySets) {
+ String appliesTo = null;
+ HashMap<QName, PolicySet> policySetTable = new HashMap<QName, PolicySet>();
+ IntentAttachPointType attachPointType = policySetAttachPoint.getType();
+
+ //validate policysets specified for the attachPoint
+ for (PolicySet policySet : policySetAttachPoint.getPolicySets()) {
+ appliesTo = policySet.getAppliesTo();
+
+ if (!isPolicySetApplicable(parent, appliesTo, attachPointType)) {
+ warning("Policy Set '" + policySet.getName()
+ + "' does not apply to binding type "
+ + attachPointType, policySetAttachPoint);
+
+ }
+ }
+
+ //from the inherited set of policysets add only what applies to the attach point
+ for (PolicySet policySet : inheritedPolicySets) {
+ appliesTo = policySet.getAppliesTo();
+ if (isPolicySetApplicable(parent, appliesTo, attachPointType)) {
+ policySetAttachPoint.getPolicySets().add(policySet);
+ }
+ }
+
+ //get rid of duplicate entries
+ for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) {
+ policySetTable.put(policySet.getName(), policySet);
+ }
+
+ policySetAttachPoint.getPolicySets().clear();
+ policySetAttachPoint.getPolicySets().addAll(policySetTable.values());
+
+ //expand profile intents
+ List<Intent> expandedIntents = null;
+ for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) {
+ expandedIntents = expandProfileIntents(policySet.getProvidedIntents());
+ policySet.getProvidedIntents().clear();
+ policySet.getProvidedIntents().addAll(expandedIntents);
+ }
+ }
+
private void computePolicySets(Base parent,
List<Binding> bindings,
List<PolicySet> inheritedPolicySets) {
- String appliesTo = null;
- HashMap<QName, PolicySet> policySetTable = new HashMap<QName, PolicySet>();
-
for (Binding binding : bindings) {
- if (binding instanceof PolicySetAttachPoint) {
- PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)binding;
- IntentAttachPointType bindingType = policiedBinding.getType();
-
- //validate policysets specified for the binding
- for (PolicySet policySet : policiedBinding.getPolicySets()) {
- appliesTo = policySet.getAppliesTo();
-
- if (!isPolicySetApplicable(parent, appliesTo, bindingType)) {
- warning("Policy Set '" + policySet.getName()
- + "' does not apply to binding type "
- + bindingType, binding);
-
- }
- }
-
- for (PolicySet policySet : inheritedPolicySets) {
- appliesTo = policySet.getAppliesTo();
- if (isPolicySetApplicable(parent, appliesTo, bindingType)) {
- policiedBinding.getPolicySets().add(policySet);
- }
- }
-
- //get rid of duplicate entries
- for ( PolicySet policySet : policiedBinding.getPolicySets() ) {
- policySetTable.put(policySet.getName(), policySet);
- }
- policiedBinding.getPolicySets().clear();
- policiedBinding.getPolicySets().addAll(policySetTable.values());
-
- //expand profile intents
- List<Intent> expandedIntents = null;
- for ( PolicySet policySet : policiedBinding.getPolicySets() ) {
- expandedIntents = expandProfileIntents(policySet.getProvidedIntents());
- policySet.getProvidedIntents().clear();
- policySet.getProvidedIntents().addAll(expandedIntents);
- }
+ if ( binding instanceof PolicySetAttachPoint ) {
+ computePolicySetsForPolicySetAttachPoint(parent, (PolicySetAttachPoint)binding, inheritedPolicySets);
}
}
}
private boolean isPolicySetApplicable(Base parent,
String xpath,
- IntentAttachPointType bindingType) {
+ IntentAttachPointType attachPointType) {
//FIXME: For now do a simple check and later implement whatever is mentioned in the next comment
- if ( xpath != null && bindingType != null && xpath.indexOf(bindingType.getName().getLocalPart()) != -1) {
+ if ( xpath != null && attachPointType != null && xpath.indexOf(attachPointType.getName().getLocalPart()) != -1) {
return true;
} else {
return false;
@@ -1157,7 +1190,7 @@
- private void determineDomainPolicySets(Contract contract, PolicySetAttachPoint policiedBinding) {
+ private void determineApplicableDomainPolicySets(Contract contract, PolicySetAttachPoint policiedBinding) {
if ( domainPolicySets != null && policiedBinding.getRequiredIntents().size() > 0 ) {
IntentAttachPointType bindingType = policiedBinding.getType();
for ( PolicySet policySet : domainPolicySets ) {
@@ -1167,7 +1200,7 @@
//if any intent was trimmed off, then this policyset must be attached to the binding
if ( prevSize != policiedBinding.getRequiredIntents().size() ) {
policiedBinding.getPolicySets().add(policySet);
- }
+ }
}
}
@@ -1181,9 +1214,31 @@
}
}
+
+ private void determineApplicableDomainPolicySets(Component component, PolicySetAttachPoint policiedImplementation) {
+ if ( domainPolicySets != null && policiedImplementation.getRequiredIntents().size() > 0 ) {
+ IntentAttachPointType implType = policiedImplementation.getType();
+ for ( PolicySet policySet : domainPolicySets ) {
+ if ( isPolicySetApplicable(component, policySet.getAppliesTo(), implType) ) {
+ int prevSize = policiedImplementation.getRequiredIntents().size();
+ trimProvidedIntents(policiedImplementation.getRequiredIntents(), policySet);
+ //if any intent was trimmed off, then this policyset must be attached to the implementation
+ if ( prevSize != policiedImplementation.getRequiredIntents().size() ) {
+ policiedImplementation.getPolicySets().add(policySet);
+ }
+ }
+ }
+
+ if ( policiedImplementation.getRequiredIntents().size() > 0 ) {
+ warning("There are unfulfilled intents for component implementation - " + component.getName(), component);
+ }
+ }
+ }
+
+
+
- private void determinePolicySet(Contract source, Contract target) {
-
+ private void determineApplicableBindingPolicySets(Contract source, Contract target) {
for ( Binding aBinding : source.getBindings() ) {
if ( aBinding instanceof PolicySetAttachPoint ) {
PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)aBinding;
@@ -1194,7 +1249,7 @@
for ( Intent intent : target.getRequiredIntents() ) {
if ( !policiedBinding.getRequiredIntents().contains(intent) ) {
for (QName constrained : intent.getConstrains()) {
- if (bindingType.getName().getNamespaceURI().equals(constrained
+ if (bindingType != null && bindingType.getName().getNamespaceURI().equals(constrained
.getNamespaceURI()) && bindingType.getName().getLocalPart()
.startsWith(constrained.getLocalPart())) {
policiedBinding.getRequiredIntents().add(intent);
@@ -1211,10 +1266,24 @@
//TODO: resolved to domain policy registry and attach suitable policy sets to the binding
//for now using the SCA Definitions instead of registry
//if there are intents that are not provided by any policy set throw a warning
- determineDomainPolicySets(source, policiedBinding);
+ determineApplicableDomainPolicySets(source, policiedBinding);
}
}
}
-
+
+ private void determineApplicableImplementationPolicySets(Component component) {
+ if ( component.getImplementation() instanceof PolicySetAttachPoint ) {
+ PolicySetAttachPoint policiedImplementation = (PolicySetAttachPoint)component.getImplementation();
+ IntentAttachPointType implType = policiedImplementation.getType();
+
+ trimProvidedIntents(policiedImplementation.getRequiredIntents(), policiedImplementation.getPolicySets());
+
+ //determine additional policysets that match remaining intents
+ //if there are intents that are not provided by any policy set throw a warning
+ //TODO: resolved to domain policy registry and attach suitable policy sets to the implementation
+ //...for now using the SCA Definitions instead of registry
+ determineApplicableDomainPolicySets(component, policiedImplementation);
+ }
+ }
}
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java Tue Oct 23 21:30:02 2007
@@ -44,6 +44,7 @@
private List<Service> services = new ArrayList<Service>();
private List<Intent> requiredIntents = new ArrayList<Intent>();
private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private IntentAttachPointType type = null;
/**
* Constructs a new component type.
@@ -107,10 +108,11 @@
}
public IntentAttachPointType getType() {
- return null;
+ return type;
}
public void setType(IntentAttachPointType type) {
+ this.type = type;
}
@Override
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java Tue Oct 23 21:30:02 2007
@@ -27,7 +27,6 @@
import org.apache.tuscany.sca.assembly.AbstractReference;
import org.apache.tuscany.sca.assembly.AbstractService;
import org.apache.tuscany.sca.assembly.ConstrainingType;
-
import org.apache.tuscany.sca.policy.Intent;
import org.apache.tuscany.sca.policy.IntentAttachPointType;
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java Tue Oct 23 21:30:02 2007
@@ -47,7 +47,6 @@
import org.apache.tuscany.sca.assembly.TestImplementation;
import org.apache.tuscany.sca.assembly.TestInterfaceContract;
import org.apache.tuscany.sca.assembly.Wire;
-import org.apache.tuscany.sca.assembly.builder.impl.PrintUtil;
import org.junit.Test;
/**
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-ejb/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-ejb/pom.xml?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-ejb/pom.xml (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-ejb/pom.xml Tue Oct 23 21:30:02 2007
@@ -76,7 +76,7 @@
<dependency>
<groupId>org.apache.geronimo.modules</groupId>
<artifactId>geronimo-openejb</artifactId>
- <version>2.0.1</version>
+ <version>2.0.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
@@ -122,7 +122,7 @@
<repository>
<id>geronimo-repository</id>
<name>Geronimo Repository</name>
- <url>http://svn.apache.org/repos/asf/geronimo/server/tags/2.0.1/repository</url>
+ <url>http://svn.apache.org/repos/asf/geronimo/server/tags/2.0.2/repository</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListenerServlet.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListenerServlet.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListenerServlet.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListenerServlet.java Tue Oct 23 21:30:02 2007
@@ -19,7 +19,6 @@
package org.apache.tuscany.sca.binding.feed.provider;
import java.io.IOException;
-import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPResourceBindingImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPResourceBindingImpl.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPResourceBindingImpl.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPResourceBindingImpl.java Tue Oct 23 21:30:02 2007
@@ -19,9 +19,6 @@
package org.apache.tuscany.sca.binding.http.impl;
-import java.util.Collections;
-import java.util.List;
-
import org.apache.tuscany.sca.binding.http.HTTPResourceBinding;
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/pom.xml?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/pom.xml (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/pom.xml Tue Oct 23 21:30:02 2007
@@ -43,47 +43,79 @@
<version>0.8</version>
<scope>test</scope>
</dependency>
-
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-extension-helper</artifactId>
+ <artifactId>tuscany-assembly</artifactId>
<version>1.0.1-incubating-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.0.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
<version>1.0.1-incubating-SNAPSHOT</version>
- <scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
+ <artifactId>tuscany-core</artifactId>
<version>1.0.1-incubating-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.0.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-json</artifactId>
+ <version>1.0.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-http</artifactId>
<version>1.0.1-incubating-SNAPSHOT</version>
</dependency>
<dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.0.1-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version> <!-- to keep compatible with older servlet containers -->
<scope>provided</scope>
</dependency>
+
+ <!-- Test Dependencies -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-jetty</artifactId>
+ <artifactId>tuscany-host-embedded</artifactId>
<version>1.0.1-incubating-SNAPSHOT</version>
<scope>test</scope>
</dependency>
-
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.0.1-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java Tue Oct 23 21:30:02 2007
@@ -19,12 +19,40 @@
package org.apache.tuscany.sca.binding.jsonrpc;
+import org.apache.tuscany.sca.assembly.Binding;
/**
* A model for the JSONRPC binding.
+ *
+ * @version $Rev$ $Date$
*/
-public class JSONRPCBinding {
-
- // empty as right now the json-rpc binding has no attributes
-
+public class JSONRPCBinding implements Binding {
+ private String name;
+ private String uri;
+
+ public String getName() {
+ return name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean isUnresolved() {
+ // The binding is always resolved
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The binding is always resolved
+ }
+
}
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceServlet.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceServlet.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceServlet.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceServlet.java Tue Oct 23 21:30:02 2007
@@ -24,17 +24,24 @@
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
-import java.text.ParseException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
import javax.servlet.ServletConfig;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import org.json.JSONObject;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONException;
+import org.osoa.sca.ServiceRuntimeException;
import com.metaparadigm.jsonrpc.JSONRPCBridge;
-import com.metaparadigm.jsonrpc.JSONRPCResult;
import com.metaparadigm.jsonrpc.JSONRPCServlet;
/**
@@ -45,12 +52,22 @@
public class JSONRPCServiceServlet extends JSONRPCServlet {
private static final long serialVersionUID = 1L;
+ transient Binding binding;
transient String serviceName;
transient Object serviceInstance;
+ transient RuntimeComponentService componentService;
+ transient InterfaceContract serviceContract;
transient Class<?> serviceInterface;
- public JSONRPCServiceServlet(String serviceName, Class<?> serviceInterface, Object serviceInstance) {
- this.serviceName = serviceName;
+ public JSONRPCServiceServlet(Binding binding,
+ RuntimeComponentService componentService,
+ InterfaceContract serviceContract,
+ Class<?> serviceInterface,
+ Object serviceInstance) {
+ this.binding = binding;
+ this.serviceName = binding.getName();
+ this.componentService = componentService;
+ this.serviceContract = serviceContract;
this.serviceInterface = serviceInterface;
this.serviceInstance = serviceInstance;
}
@@ -65,7 +82,6 @@
@Override
public void service(HttpServletRequest request, HttpServletResponse response) throws IOException {
-
if (request.getParameter("smd") != null) {
handleSMDRequest(request, response);
} else {
@@ -80,17 +96,8 @@
}
}
- private void handleServiceRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
- /*
- * Create a new bridge for every request to aviod all the problems with
- * JSON-RPC-Java storing the bridge in the session
- */
- HttpSession session = request.getSession();
-
- JSONRPCBridge jsonrpcBridge = new JSONRPCBridge();
- jsonrpcBridge.registerObject(serviceName, serviceInstance, serviceInterface);
- session.setAttribute("JSONRPCBridge", jsonrpcBridge);
-
+ private void handleServiceRequest(HttpServletRequest request, HttpServletResponse response)
+ throws IOException {
// Encode using UTF-8, although We are actually ASCII clean as
// all unicode data is JSON escaped using backslash u. This is
// less data efficient for foreign character sets but it is
@@ -118,24 +125,26 @@
data.write(buf, 0, ret);
}
- JSONObject jsonReq = null;
- JSONRPCResult jsonResp = null;
+ org.codehaus.jettison.json.JSONObject jsonReq = null;
+ String method = null;
try {
- jsonReq = new JSONObject(data.toString());
- } catch (ParseException e) {
+ jsonReq = new org.codehaus.jettison.json.JSONObject(data.toString());
+ method = jsonReq.getString("method");
+ } catch (JSONException e) {
throw new RuntimeException("Unable to parse request", e);
}
- String method = jsonReq.getString("method");
- if ((method != null) && (method.indexOf('.') < 0)) {
- jsonReq.putOpt("method", serviceName + "." + method);
+
+ // check if it's a system request
+ // or a method invocation
+ byte[] bout;
+ if (method.startsWith("system.")) {
+ bout = handleJSONRPCSystemInvocation(request, response, data.toString());
+ } else {
+ bout = handleJSONRPCMethodInvocation(request, response, jsonReq);
}
- // invoke the request
- jsonResp = jsonrpcBridge.call(new Object[] {request}, jsonReq);
-
- byte[] bout = jsonResp.toString().getBytes("UTF-8");
-
+ // Send response to client
out.write(bout);
out.flush();
out.close();
@@ -144,7 +153,8 @@
/**
* handles requests for the SMD descriptor for a service
*/
- protected void handleSMDRequest(HttpServletRequest request, HttpServletResponse response) throws IOException, UnsupportedEncodingException {
+ protected void handleSMDRequest(HttpServletRequest request, HttpServletResponse response) throws IOException,
+ UnsupportedEncodingException {
String serviceUrl = request.getRequestURL().toString();
String smd = JavaToSmd.interfaceToSmd(serviceInterface, serviceUrl);
@@ -156,5 +166,112 @@
out.flush();
out.close();
}
+
+ protected byte[] handleJSONRPCSystemInvocation(HttpServletRequest request, HttpServletResponse response, String requestData) throws IOException,
+ UnsupportedEncodingException {
+ /*
+ * Create a new bridge for every request to avoid all the problems with
+ * JSON-RPC-Java storing the bridge in the session
+ */
+ HttpSession session = request.getSession();
+
+ JSONRPCBridge jsonrpcBridge = new JSONRPCBridge();
+ jsonrpcBridge.registerObject(serviceName, serviceInstance, serviceInterface);
+ session.setAttribute("JSONRPCBridge", jsonrpcBridge);
+
+ org.json.JSONObject jsonReq = null;
+ com.metaparadigm.jsonrpc.JSONRPCResult jsonResp = null;
+ try {
+ jsonReq = new org.json.JSONObject(requestData);
+ } catch (java.text.ParseException e) {
+ throw new RuntimeException("Unable to parse request", e);
+ }
+
+ String method = jsonReq.getString("method");
+ if ((method != null) && (method.indexOf('.') < 0)) {
+ jsonReq.putOpt("method", serviceName + "." + method);
+ }
+
+ // invoke the request
+ jsonResp = jsonrpcBridge.call(new Object[] {request}, jsonReq);
+
+ return jsonResp.toString().getBytes("UTF-8");
+ }
+
+ protected byte[] handleJSONRPCMethodInvocation(HttpServletRequest request, HttpServletResponse response, org.codehaus.jettison.json.JSONObject jsonReq) throws IOException,
+ UnsupportedEncodingException {
+
+ String method = null;
+ Object[] args = null;
+ Object id = null;
+ try {
+ // Extract the method
+ method = jsonReq.getString("method");
+ if ((method != null) && (method.indexOf('.') < 0)) {
+ jsonReq.putOpt("method", serviceName + "." + method);
+ }
+
+ // Extract the arguments
+ JSONArray array = jsonReq.getJSONArray("params");
+ args = new Object[array.length()];
+ for (int i = 0; i < args.length; i++) {
+ args[i] = array.get(i);
+ }
+ id = jsonReq.get("id");
+
+ } catch (JSONException e) {
+ throw new RuntimeException("Unable to find json method name", e);
+ }
+
+ // invoke the request
+ RuntimeWire wire = componentService.getRuntimeWire(binding, serviceContract);
+ Operation jsonOperation = findOperation(method);
+ Object result = null;
+ org.codehaus.jettison.json.JSONObject jsonResponse = new org.codehaus.jettison.json.JSONObject();
+ try {
+ result = wire.invoke(jsonOperation, args);
+ try {
+ jsonResponse.put("result", result);
+ jsonResponse.putOpt("id", id);
+ } catch (JSONException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ } catch (InvocationTargetException e) {
+ try {
+ jsonResponse.put("error", e.getCause());
+ jsonResponse.putOpt("id", id);
+ } catch (JSONException e1) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ //get response to send to client
+ return jsonResponse.toString().getBytes("UTF-8");
+ }
+ /**
+ * Find the operation from the component service contract
+ * @param componentService
+ * @param method
+ * @return
+ */
+ private Operation findOperation(String method) {
+ if (method.contains(".")) {
+ method = method.substring(method.lastIndexOf(".") + 1);
+ }
+
+ List<Operation> operations = serviceContract.getInterface().getOperations();
+ //componentService.getBindingProvider(binding).getBindingInterfaceContract().getInterface().getOperations();
+
+
+ Operation result = null;
+ for (Operation o : operations) {
+ if (o.getName().equalsIgnoreCase(method)) {
+ result = o;
+ break;
+ }
+ }
+
+ return result;
+ }
}
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JavaToSmd.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JavaToSmd.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JavaToSmd.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JavaToSmd.java Tue Oct 23 21:30:02 2007
@@ -25,6 +25,8 @@
* from a Java class. See http://dojo.jot.com/SMD.
*
* TODO: Change to work from the Tuscany Interface instead of a Java class
+ *
+ * @version $Rev$ $Date$
*/
public class JavaToSmd {
Propchange: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JavaToSmd.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/ScaDomainScriptServlet.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/ScaDomainScriptServlet.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/ScaDomainScriptServlet.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/ScaDomainScriptServlet.java Tue Oct 23 21:30:02 2007
@@ -35,6 +35,8 @@
* This script wrappers the JSON-RPC-Java jsonrpc.js script
* adding in at the bottom the JavaScript to create and initialize
* the variables representing the SCA services.
+ *
+ * @version $Rev$ $Date$
*/
public class ScaDomainScriptServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java Tue Oct 23 21:30:02 2007
@@ -31,7 +31,7 @@
import com.meterware.httpunit.WebResponse;
/**
- * @version $Rev: 536083 $ $Date: 2007-05-08 02:18:29 -0400 (Tue, 08 May 2007) $
+ * @version $Rev$ $Date$
*/
public class JSONRPCServiceTestCase extends TestCase {
Propchange: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingProvider.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingProvider.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingProvider.java Tue Oct 23 21:30:02 2007
@@ -107,7 +107,7 @@
URI uri = URI.create(component.getURI() + "/" + notificationBinding.getName());
notificationBinding.setURI(uri.toString());
Interface interfaze = reference.getInterfaceContract().getInterface();
- interfaze.setDefaultDataBinding(OMElement.class.getName());
+ interfaze.resetDataBinding(OMElement.class.getName());
for (Operation operation : interfaze.getOperations()) {
operation.setNonBlocking(false);
}
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationServiceBindingProvider.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationServiceBindingProvider.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationServiceBindingProvider.java Tue Oct 23 21:30:02 2007
@@ -116,7 +116,7 @@
URI uri = URI.create(component.getURI() + "/" + notificationBinding.getName());
notificationBinding.setURI(uri.toString());
Interface interfaze = service.getInterfaceContract().getInterface();
- interfaze.setDefaultDataBinding(OMElement.class.getName());
+ interfaze.resetDataBinding(OMElement.class.getName());
for (Operation operation : interfaze.getOperations()) {
operation.setNonBlocking(false);
}
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/AxiomTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/AxiomTestCase.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/AxiomTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/AxiomTestCase.java Tue Oct 23 21:30:02 2007
@@ -21,11 +21,11 @@
import java.io.ByteArrayInputStream;
import java.io.StringWriter;
+import junit.framework.TestCase;
+
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.junit.Assert;
-
-import junit.framework.TestCase;
public class AxiomTestCase extends TestCase {
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingTestCase.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingTestCase.java Tue Oct 23 21:30:02 2007
@@ -27,39 +27,6 @@
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
-import org.apache.tuscany.sca.binding.notification.encoding.BrokerConsumerReferenceEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.BrokerEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.BrokerIDEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.BrokerProducerReferenceEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.BrokersEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.ConsumerReferenceEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.DefaultEncodingRegistry;
-import org.apache.tuscany.sca.binding.notification.encoding.EndConsumersEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.EndProducersEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.EndpointAddressEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.EndpointReference;
-import org.apache.tuscany.sca.binding.notification.encoding.EndpointReferenceEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.NeighborBrokerConsumers;
-import org.apache.tuscany.sca.binding.notification.encoding.NeighborBrokerConsumersEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.Neighbors;
-import org.apache.tuscany.sca.binding.notification.encoding.NeighborsEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.NewBroker;
-import org.apache.tuscany.sca.binding.notification.encoding.NewBrokerEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.NewBrokerResponse;
-import org.apache.tuscany.sca.binding.notification.encoding.NewBrokerResponseEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.NewConsumerResponse;
-import org.apache.tuscany.sca.binding.notification.encoding.NewConsumerResponseEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.NewProducerResponse;
-import org.apache.tuscany.sca.binding.notification.encoding.NewProducerResponseEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.ReferencePropertiesEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.RemoveBroker;
-import org.apache.tuscany.sca.binding.notification.encoding.RemoveBrokerEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.RemovedBrokerEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.ReplaceBrokerConnection;
-import org.apache.tuscany.sca.binding.notification.encoding.ReplaceBrokerConnectionEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.Subscribe;
-import org.apache.tuscany.sca.binding.notification.encoding.SubscribeEnDeCoder;
-
import junit.framework.Assert;
import junit.framework.TestCase;
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java Tue Oct 23 21:30:02 2007
@@ -18,12 +18,8 @@
*/
package org.apache.tuscany.sca.binding.sca.axis2.impl;
-import java.lang.reflect.UndeclaredThrowableException;
-import java.net.ConnectException;
-import java.util.logging.Level;
import java.util.logging.Logger;
-import org.apache.axis2.AxisFault;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java Tue Oct 23 21:30:02 2007
@@ -28,7 +28,7 @@
import org.apache.tuscany.sca.binding.ws.axis2.Axis2ReferenceBindingProvider;
import org.apache.tuscany.sca.binding.ws.axis2.Java2WSDLHelper;
import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
-import org.apache.tuscany.sca.domain.SCADomainService;
+import org.apache.tuscany.sca.domain.SCADomainSPI;
import org.apache.tuscany.sca.host.http.ServletHost;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
@@ -79,7 +79,7 @@
}
// Set to use the Axiom data binding
- contract.getInterface().setDefaultDataBinding(OMElement.class.getName());
+ contract.getInterface().resetDataBinding(OMElement.class.getName());
wsBinding.setBindingInterfaceContract(contract);
wsBinding.setName(this.binding.getName());
@@ -113,14 +113,14 @@
if ( serviceEPR == null && node != null ){
// try to resolve the service endpoint with the registry
- SCADomainService serviceDiscovery = node.getDomainService();
+ SCADomainSPI domainProxy = (SCADomainSPI)node.getDomain();
- if (serviceDiscovery != null){
+ if (domainProxy != null){
// The binding URI might be null in the case where this reference is completely
// dynamic, for example, in the case of callbacks
if (binding.getURI() != null) {
- String serviceUrl = serviceDiscovery.findServiceEndpoint(node.getDomainURI(),
+ String serviceUrl = domainProxy.findServiceEndpoint(node.getDomain().getURI(),
binding.getURI(),
SCABinding.class.getName());
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java Tue Oct 23 21:30:02 2007
@@ -34,7 +34,7 @@
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvider;
import org.apache.tuscany.sca.binding.ws.axis2.Java2WSDLHelper;
-import org.apache.tuscany.sca.domain.SCADomainService;
+import org.apache.tuscany.sca.domain.SCADomainSPI;
import org.apache.tuscany.sca.host.http.ServletHost;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
@@ -63,7 +63,7 @@
public Axis2SCAServiceBindingProvider(SCANode node,
- RuntimeComponent component,
+ RuntimeComponent component,
RuntimeComponentService service,
DistributedSCABinding binding,
ServletHost servletHost,
@@ -79,7 +79,7 @@
}
// Set to use the Axiom data binding
- contract.getInterface().setDefaultDataBinding(OMElement.class.getName());
+ contract.getInterface().resetDataBinding(OMElement.class.getName());
wsBinding.setBindingInterfaceContract(contract);
wsBinding.setName(this.binding.getName());
@@ -94,66 +94,72 @@
if (node != null){
- // get the url out of the binding and send it to the registry if
- // a distributed domain is configured
- SCADomainService domainService = node.getDomainService();
-
- if (domainService != null) {
- // work out what the component service name is that will be registered
- // it should be the path element of the binding uri
- String componentServiceName = this.binding.getURI();
-
- try {
- URI servicePath = new URI(this.binding.getURI());
- componentServiceName = servicePath.getPath();
-
- // strip any leading slash
- if (componentServiceName.charAt(0) == '/'){
- componentServiceName = componentServiceName.substring(1, componentServiceName.length());
- }
- } catch(Exception ex) {
- // do nothing, the binding uri string will be used
- }
-
- // work out what the endpoint address is that the component service name will be registered
- // against. Be default this is the url calculated by the web services binding but
- // we have to adjust that to:
- // 1. correct the host and port in the case that this is a web app as the container controlls the port
+
+ SCADomainSPI domainProxy = (SCADomainSPI)node.getDomain();
+
+ if (domainProxy != null) {
+
+ // work out what the component service name is that will be registered
+ // it should be the path element of the binding uri
+ String componentServiceName = this.binding.getURI();
+
+ try {
+ URI servicePath = new URI(this.binding.getURI());
+ componentServiceName = servicePath.getPath();
+
+ // strip any leading slash
+ if (componentServiceName.charAt(0) == '/'){
+ componentServiceName = componentServiceName.substring(1, componentServiceName.length());
+ }
+ } catch(Exception ex) {
+ // do nothing, the binding uri string will be used
+ }
+
+ // work out what the endpoint address is that the component service name will be registered
+ // against. Be default this is the url calculated by the web services binding but
+ // we have to adjust that to:
+ // 1. correct the host and port in the case that this is a web app as the container controlls the port
// 2. correct the host name in the case that it's localhost
- String componentServiceUrlString = wsBinding.getURI();
- URL componentServiceUrl;
-
- try {
- componentServiceUrl = new URL(componentServiceUrlString);
- } catch (MalformedURLException ex) {
- throw new IllegalStateException("Unable to conver url " +
- componentServiceUrlString +
- " as generated by the web service binding into a URL");
- }
-
- String originalHost = componentServiceUrl.getHost();
- String newHost = originalHost;
- int originalPort = componentServiceUrl.getPort();
- int newPort = originalPort;
-
- // TODO - could do with a change to the ServletHost API so that we can just ask the servlet
- // host if it is controlling the URL
- if (servletHost.getClass().getName().equals("WebbAppServletHost")){
- // the service URL will likely be completely different to that
- // calculated by the ws binding so replace it with the node url
- // The node url will have been set via init parameters in the web app
- URL nodeUrl = node.getNodeURL();
-
+ String componentServiceUrlString = wsBinding.getURI();
+ URL componentServiceUrl;
+
+ try {
+ componentServiceUrl = new URL(componentServiceUrlString);
+ } catch (MalformedURLException ex) {
+ throw new IllegalStateException("Unable to conver url " +
+ componentServiceUrlString +
+ " as generated by the web service binding into a URL");
+ }
+
+ String originalHost = componentServiceUrl.getHost();
+ String newHost = originalHost;
+ int originalPort = componentServiceUrl.getPort();
+ int newPort = originalPort;
+
+ // TODO - could do with a change to the ServletHost API so that we can just ask the servlet
+ // host if it is controlling the URL
+ if (servletHost.getClass().getName().equals("WebbAppServletHost")){
+ // the service URL will likely be completely different to that
+ // calculated by the ws binding so replace it with the node url
+ // The node url will have been set via init parameters in the web app
+ URL nodeUrl;
+ try {
+ URI tmpURI = new URI(node.getURI());
+ nodeUrl = tmpURI.toURL();
+ } catch (Exception ex) {
+ throw new IllegalStateException("Node running inside a webapp and node was not created with a valid node url");
+ }
+
if (nodeUrl != null){
newHost = nodeUrl.getHost();
newPort = nodeUrl.getPort();
} else {
throw new IllegalStateException("Node running inside a webapp and node was not created with a valid node url");
}
- }
-
- // no good registering localhost as a host name when nodes are spread across
- // machines
+ }
+
+ // no good registering localhost as a host name when nodes are spread across
+ // machines
if ( newHost.equals("localhost")){
try {
newHost = InetAddress.getLocalHost().getHostName();
@@ -161,41 +167,33 @@
throw new IllegalStateException("Got unknown host while trying to get the local host name in order to regsiter service with the domain");
}
}
-
- // replace the old with the new
+
+ // replace the old with the new
componentServiceUrlString = componentServiceUrlString.replace(String.valueOf(originalPort), String.valueOf(newPort));
componentServiceUrlString = componentServiceUrlString.replace(originalHost, newHost);
-
- try {
- domainService.registerServiceEndpoint(node.getDomainURI(),
- node.getNodeURI(),
- componentServiceName,
- SCABinding.class.getName(),
- componentServiceUrlString);
+
+ try {
+ domainProxy.registerServiceEndpoint(node.getDomain().getURI(),
+ node.getURI(),
+ componentServiceName,
+ SCABinding.class.getName(),
+ componentServiceUrlString);
} catch(Exception ex) {
logger.log(Level.WARNING,
"Unable to register service: " +
- node.getDomainURI() + " " +
- node.getNodeURI() + " " +
+ node.getDomain().getURI() + " " +
+ node.getURI() + " " +
componentServiceName + " " +
SCABinding.class.getName() + " " +
componentServiceUrlString);
}
- } else {
- /* don't think we should thrown an exception here as it
- * may be a stand alone node
- throw new IllegalStateException("No service manager available for component: "+
- component.getName() +
- " and service: " +
- service.getName());
- */
- }
- } else {
- throw new IllegalStateException("No distributed domain available for component: "+
- component.getName() +
- " and service: " +
- service.getName());
- }
+ }
+ } else {
+ throw new IllegalStateException("No domain available for component: "+
+ component.getName() +
+ " and service: " +
+ service.getName());
+ }
}
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java Tue Oct 23 21:30:02 2007
@@ -29,8 +29,8 @@
public class AsynchTestCase extends BaseTest {
- public static TestDomain domainA;
- public static TestDomain domainB;
+ public static TestNode nodeA;
+ public static TestNode nodeB;
@BeforeClass
public static void init() throws Exception {
@@ -38,8 +38,8 @@
try {
// create and start domains
- domainA = createDomain("nodeG");
- domainB = createDomain("nodeH");
+ nodeA = createNode("nodeG");
+ nodeB = createNode("nodeH");
} catch (Exception ex) {
System.err.println("Exception when creating domain " + ex.getMessage());
@@ -50,14 +50,14 @@
@AfterClass
public static void destroy() throws Exception {
- domainA.stop();
- domainB.stop();
+ nodeA.stop();
+ nodeB.stop();
}
@Test
public void testHelloWorldAsynch() throws Exception {
HelloWorldClient helloWorldClientB;
- helloWorldClientB = domainA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote");
+ helloWorldClientB = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote");
helloWorldClientB.getGreetings("fred");
System.out.println("Sleeping ...");
Thread.sleep(2000);
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BaseTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BaseTest.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BaseTest.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BaseTest.java Tue Oct 23 21:30:02 2007
@@ -22,10 +22,10 @@
public class BaseTest {
public static String DEFULT_DOMAIN_NAME = "mydomain";
- public static TestServiceDiscoveryImpl serviceDiscovery = new TestServiceDiscoveryImpl();
+ public static TestDomain testDomain = new TestDomain(DEFULT_DOMAIN_NAME);
- public static TestDomain createDomain(String nodeName) throws Exception {
+ public static TestNode createNode(String nodeName) throws Exception {
- return new TestDomain(DEFULT_DOMAIN_NAME, nodeName,serviceDiscovery);
+ return new TestNode(DEFULT_DOMAIN_NAME, nodeName, testDomain);
}
}
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java Tue Oct 23 21:30:02 2007
@@ -18,8 +18,6 @@
*/
package org.apache.tuscany.sca.binding.sca.axis2;
-import java.net.URL;
-
import junit.framework.Assert;
import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
@@ -29,8 +27,8 @@
public class CallbackTestCase extends BaseTest {
- public static TestDomain domainA;
- public static TestDomain domainB;
+ public static TestNode nodeA;
+ public static TestNode nodeB;
@BeforeClass
public static void init() throws Exception {
@@ -38,8 +36,8 @@
try {
// create and start domains
- domainA = createDomain("nodeE");
- domainB = createDomain("nodeF");
+ nodeA = createNode("nodeE");
+ nodeB = createNode("nodeF");
} catch (Exception ex) {
System.err.println("Exception when creating domain " + ex.getMessage());
@@ -50,21 +48,21 @@
@AfterClass
public static void destroy() throws Exception {
- domainA.stop();
- domainB.stop();
+ nodeA.stop();
+ nodeB.stop();
}
//@Test
public void testHelloWorldCallbackLocal() throws Exception {
HelloWorldClient helloWorldClientB;
- helloWorldClientB = domainB.getService(HelloWorldClient.class, "BHelloWorldClientCallbackLocal");
+ helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientCallbackLocal");
Assert.assertEquals("Hello callback fred", helloWorldClientB.getGreetings("fred"));
}
@Test
public void testHelloWorldCallbackRemote() throws Exception {
HelloWorldClient helloWorldClientA;
- helloWorldClientA = domainA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote");
+ helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote");
Assert.assertEquals("Hello callback fred", helloWorldClientA.getGreetings("fred"));
}
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java Tue Oct 23 21:30:02 2007
@@ -18,18 +18,14 @@
*/
package org.apache.tuscany.sca.binding.sca.axis2;
-import java.net.URL;
-
-import junit.framework.Assert;
-
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
public class PromotionTestCase extends BaseTest {
- public static TestDomain domainA;
- public static TestDomain domainB;
+ public static TestNode nodeA;
+ public static TestNode nodeB;
@BeforeClass
public static void init() throws Exception {
@@ -37,8 +33,8 @@
try {
// create and start domains
- domainA = createDomain("nodeC");
- domainB = createDomain("nodeD");
+ nodeA = createNode("nodeC");
+ nodeB = createNode("nodeD");
} catch (Exception ex) {
@@ -50,15 +46,15 @@
@AfterClass
public static void destroy() throws Exception {
- domainA.stop();
- domainB.stop();
+ nodeA.stop();
+ nodeB.stop();
}
@Test
public void testHelloWorldPromotion() throws Exception {
/*
HelloWorldClient helloWorldClientA;
- helloWorldClientA = domainA.getService(HelloWorldClient.class, "AHelloWorldClientRemotePromotion");
+ helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientRemotePromotion");
Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred");
*/
}
Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java Tue Oct 23 21:30:02 2007
@@ -18,8 +18,6 @@
*/
package org.apache.tuscany.sca.binding.sca.axis2;
-import java.net.URL;
-
import junit.framework.Assert;
import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
@@ -29,8 +27,8 @@
public class SimpleTestCase extends BaseTest {
- public static TestDomain domainA;
- public static TestDomain domainB;
+ public static TestNode nodeA;
+ public static TestNode nodeB;
@BeforeClass
public static void init() throws Exception {
@@ -38,8 +36,8 @@
try {
// create and start domains
- domainA = createDomain("nodeA");
- domainB = createDomain("nodeB");;
+ nodeA = createNode("nodeA");
+ nodeB = createNode("nodeB");;
} catch (Exception ex) {
System.err.println("Exception when creating domain " + ex.getMessage());
@@ -50,13 +48,13 @@
@AfterClass
public static void destroy() throws Exception {
- domainA.stop();
- domainB.stop();
+ nodeA.stop();
+ nodeB.stop();
}
@Test
public void testHelloWorldLocal() throws Exception {
- HelloWorldClient helloWorldClientA = domainA.getService(HelloWorldClient.class, "AHelloWorldClientLocal");
+ HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientLocal");
Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred");
}
@@ -64,24 +62,24 @@
@Test
public void testHelloWorldRemote() throws Exception {
HelloWorldClient helloWorldClientA;
- helloWorldClientA = domainA.getService(HelloWorldClient.class, "AHelloWorldClientRemote");
+ helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientRemote");
Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred");
}
@Test
public void testHelloWorldLocalAndRemote() throws Exception {
- HelloWorldClient helloWorldClientA = domainA.getService(HelloWorldClient.class, "AHelloWorldClientLocalAndRemote");
- HelloWorldClient helloWorldClientB = domainB.getService(HelloWorldClient.class, "BHelloWorldClientLocalAndRemote");
+ HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientLocalAndRemote");
+ HelloWorldClient helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientLocalAndRemote");
Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred");
Assert.assertEquals(helloWorldClientB.getGreetings("fred"), "Hello fred");
}
@Test
public void testHelloWorldMultipleServices() throws Exception {
- HelloWorldClient helloWorldClientA = domainA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleServices");
- HelloWorldClient helloWorldClientA2 = domainA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleServices2");
- HelloWorldClient helloWorldClientB = domainB.getService(HelloWorldClient.class, "BHelloWorldClientMultipleServices");
+ HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleServices");
+ HelloWorldClient helloWorldClientA2 = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleServices2");
+ HelloWorldClient helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientMultipleServices");
Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred");
Assert.assertEquals(helloWorldClientA2.getGreetings("fred"), "Hello fred");
Assert.assertEquals(helloWorldClientB.getGreetings("fred"), "Hello fred");
@@ -90,7 +88,7 @@
//@Test
public void testHelloWorldMultipleBindings() throws Exception {
HelloWorldClient helloWorldClientA;
- helloWorldClientA = domainA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleBindings");
+ helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleBindings");
Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org