From 5a315d4ba3fe1c046e139269ea82ad2330c25a06 Mon Sep 17 00:00:00 2001 From: antelder Date: Mon, 28 Jul 2008 12:32:27 +0000 Subject: Update to use web-uri attribute git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@680334 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/implementation/web/WebImplementation.java | 4 ++-- .../sca/implementation/web/impl/WebImplementationImpl.java | 10 ++++++++++ .../implementation/web/xml/WebImplementationProcessor.java | 13 ++++++++----- .../tuscany/sca/implementation/web/xml/ReadTestCase.java | 2 +- .../tuscany/sca/implementation/web/xml/WriteTestCase.java | 2 +- .../tuscany/sca/implementation/web/xml/TestWeb.composite | 2 +- 6 files changed, 23 insertions(+), 10 deletions(-) (limited to 'java/sca/modules/implementation-web') diff --git a/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/WebImplementation.java b/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/WebImplementation.java index 0870afc977..86af3d7204 100644 --- a/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/WebImplementation.java +++ b/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/WebImplementation.java @@ -31,12 +31,12 @@ public interface WebImplementation extends Implementation { * Returns the webapp URI. * @return the webapp URI */ - String getURI(); + String getWebURI(); /** * Sets the Webapp URI. * @param uri the webapp URI */ - void setURI(String webappURI); + void setWebURI(String webappURI); } diff --git a/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java b/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java index 79705dee7c..6a46eb03c5 100644 --- a/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java +++ b/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java @@ -38,6 +38,8 @@ class WebImplementationImpl implements WebImplementation { private List references = new ArrayList(); private String uri; private boolean unresolved; + + private String webURI; /** * Constructs a new Web implementation. @@ -81,4 +83,12 @@ class WebImplementationImpl implements WebImplementation { public void setUnresolved(boolean unresolved) { this.unresolved = unresolved; } + + public String getWebURI() { + return webURI; + } + + public void setWebURI(String webURI) { + this.webURI = webURI; + } } diff --git a/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/xml/WebImplementationProcessor.java b/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/xml/WebImplementationProcessor.java index cd8e47f5ba..d4a0ab7ef1 100644 --- a/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/xml/WebImplementationProcessor.java +++ b/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/xml/WebImplementationProcessor.java @@ -72,10 +72,13 @@ public class WebImplementationProcessor extends BaseStAXArtifactProcessor implem WebImplementation implementation = implementationFactory.createWebImplementation(); implementation.setUnresolved(true); - // Read the uri attribute - String webappURI = getString(reader, "uri"); - if (webappURI != null) { - implementation.setURI(webappURI); + // Read the webapp uri attribute + String webURI = getString(reader, "web-uri"); + if (webURI != null) { + implementation.setWebURI(webURI); + + // Set the URI of the component type + implementation.setURI(webURI); } // Skip to end element @@ -111,7 +114,7 @@ public class WebImplementationProcessor extends BaseStAXArtifactProcessor implem // Write writeStart(writer, IMPLEMENTATION_WEB.getNamespaceURI(), IMPLEMENTATION_WEB.getLocalPart(), - new XAttr("uri", implementation.getURI())); + new XAttr("web-uri", implementation.getWebURI())); writeEnd(writer); } diff --git a/java/sca/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/ReadTestCase.java b/java/sca/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/ReadTestCase.java index b47aa0fbe1..10a7df7ae5 100644 --- a/java/sca/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/ReadTestCase.java +++ b/java/sca/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/ReadTestCase.java @@ -75,7 +75,7 @@ public class ReadTestCase extends TestCase { compositeBuilder.build(composite); - assertTrue(((WebImplementation) composite.getComponents().get(0).getImplementation()).getURI().equals("MyWebapp")); + assertTrue(((WebImplementation) composite.getComponents().get(0).getImplementation()).getWebURI().equals("MyWebapp")); } } diff --git a/java/sca/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/WriteTestCase.java b/java/sca/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/WriteTestCase.java index 7e609f5868..723672270d 100644 --- a/java/sca/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/WriteTestCase.java +++ b/java/sca/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/WriteTestCase.java @@ -59,7 +59,7 @@ public class WriteTestCase extends TestCase { ByteArrayOutputStream bos = new ByteArrayOutputStream(); staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos)); - assertTrue(bos.toString().contains("MyWebapp")); + assertTrue(bos.toString().contains("web-uri=\"MyWebapp\"")); } diff --git a/java/sca/modules/implementation-web/src/test/resources/org/apache/tuscany/sca/implementation/web/xml/TestWeb.composite b/java/sca/modules/implementation-web/src/test/resources/org/apache/tuscany/sca/implementation/web/xml/TestWeb.composite index 8d8db875af..181de3772b 100644 --- a/java/sca/modules/implementation-web/src/test/resources/org/apache/tuscany/sca/implementation/web/xml/TestWeb.composite +++ b/java/sca/modules/implementation-web/src/test/resources/org/apache/tuscany/sca/implementation/web/xml/TestWeb.composite @@ -23,7 +23,7 @@ name="TestWeb"> - + -- cgit v1.2.3