You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by me...@apache.org on 2007/01/27 23:35:38 UTC

svn commit: r500645 [2/2] - in /incubator/tuscany/java/sca: runtime/services/ runtime/services/discovery/ runtime/services/discovery/bonjour/ runtime/services/discovery/bonjour/src/ runtime/services/discovery/bonjour/src/main/ runtime/services/discover...

Added: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/prp/TuscanyQueryHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/prp/TuscanyQueryHandler.java?view=auto&rev=500645
==============================================================================
--- incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/prp/TuscanyQueryHandler.java (added)
+++ incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/prp/TuscanyQueryHandler.java Sat Jan 27 14:35:35 2007
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.service.discovery.jxta.prp;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+import net.jxta.impl.protocol.ResolverResponse;
+import net.jxta.protocol.ResolverQueryMsg;
+import net.jxta.protocol.ResolverResponseMsg;
+import net.jxta.resolver.QueryHandler;
+import net.jxta.resolver.ResolverService;
+
+import org.apache.tuscany.service.discovery.jxta.JxtaDiscoveryService;
+import org.apache.tuscany.service.discovery.jxta.stax.StaxHelper;
+import org.apache.tuscany.spi.services.discovery.RequestListener;
+import org.apache.tuscany.spi.services.discovery.ResponseListener;
+
+/**
+ * Generic quety handler for tuscany PRP (Peer Resolver Protocol) messages. The 
+ * <code>processQuery</code> method is invoked on the receiver and the <code>
+ * processResponse</code> is invoked on the sender when the receiver responds.
+ * @version $Revision$ $Date$
+ *
+ */
+public class TuscanyQueryHandler implements QueryHandler {
+    
+    /** Resolver service for sending responses. */
+    private final ResolverService resolverService;
+    
+    /** Discovery service. */
+    private final JxtaDiscoveryService discoveryService;
+    
+    /**
+     * Initializes the JXTA resolver service and tuscany discovery service.
+     * 
+     * @param resolverService Resolver service.
+     * @param discoveryService Tuscany discovery service.
+     */
+    public TuscanyQueryHandler(final ResolverService resolverService, final JxtaDiscoveryService discoveryService) {
+        this.resolverService = resolverService;
+        this.discoveryService = discoveryService;
+    }
+
+    /**
+     * Processes a query message.
+     */
+    public int processQuery(ResolverQueryMsg queryMessage) {
+        
+        final String message = queryMessage.getQuery();
+        final int queryId = queryMessage.getQueryId();
+        final String source = queryMessage.getSrc();
+        final String handler = queryMessage.getHandlerName();
+        
+        final QName messageType = StaxHelper.getDocumentElementQName(message);
+        RequestListener messageListener = discoveryService.getRequestListener(messageType);
+        if(messageListener != null) {
+            
+            XMLStreamReader requestReader = StaxHelper.createReader(message);
+            XMLStreamReader responseReader = messageListener.onRequest(requestReader);
+            String response = StaxHelper.serialize(responseReader);
+            
+            ResolverResponse responseMessage = new ResolverResponse();
+            responseMessage.setResponse(response);
+            responseMessage.setHandlerName(handler);
+            responseMessage.setQueryId(queryId);
+
+            resolverService.sendResponse(source, responseMessage);
+            
+        }
+        return ResolverService.OK;
+        
+    }
+
+    /**
+     * Processes a response message.
+     */
+    public void processResponse(ResolverResponseMsg responseMessage) {
+        
+        final String message = responseMessage.getResponse();
+        final int queryId = responseMessage.getQueryId();
+        
+        final QName messageType = StaxHelper.getDocumentElementQName(message);
+        ResponseListener messageListener = discoveryService.getResponseListener(messageType);
+        if(messageListener != null) {     
+            XMLStreamReader responseReader = StaxHelper.createReader(message);       
+            messageListener.onResponse(responseReader, queryId);
+        }
+        
+    }
+
+}

Propchange: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/prp/TuscanyQueryHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/prp/TuscanyQueryHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/stax/StaxHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/stax/StaxHelper.java?view=auto&rev=500645
==============================================================================
--- incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/stax/StaxHelper.java (added)
+++ incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/stax/StaxHelper.java Sat Jan 27 14:35:35 2007
@@ -0,0 +1,223 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.service.discovery.jxta.stax;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.service.discovery.jxta.JxtaException;
+
+/**
+ * Utility for stax operations.
+ * 
+ * @version $Revision$ $Date$
+ *
+ */
+public abstract class StaxHelper {
+
+    /** XML input factory. */
+    private static final XMLInputFactory xmlFactory =
+        XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", StaxHelper.class.getClassLoader());;
+
+    /**
+     * Utility constructor.
+     */
+    private StaxHelper() {
+    }
+
+    /**
+     * Serializes the infoset in the stream reader.
+     * 
+     * @param reader Stream reader.
+     * @return Serialized XML.
+     */
+    public static final String serialize(XMLStreamReader reader) {
+
+        try {
+
+            StringBuffer xml = new StringBuffer();
+
+            int event = reader.getEventType();
+            while (true) {
+
+                switch (event) {
+                    case XMLStreamConstants.START_ELEMENT:
+                        onStartElement(reader, xml);
+                        onNsMappings(reader, xml);
+                        onAttributes(reader, xml);
+                        xml.append(">");
+                        break;
+                    case XMLStreamConstants.CHARACTERS:
+                        if (reader.isWhiteSpace()) {
+                            break;
+                        }
+                        xml.append(reader.getText());
+                        break;
+                    case XMLStreamConstants.END_ELEMENT:
+                        onEndElement(reader, xml);
+                        break;
+                }
+                
+                if (!reader.hasNext()) {
+                      break;
+                }
+                event = reader.next();
+
+            }
+            return xml.toString();
+
+        } catch (XMLStreamException ex) {
+            throw new JxtaException(ex);
+        } finally {
+            try {
+                reader.close();
+            } catch (XMLStreamException ex) {
+                throw new JxtaException(ex);
+            }
+        }
+
+    }
+
+    /**
+     * Creates a stream reader to the serialized XML.
+     * 
+     * @param xml Serialized XML to which reader is to be created.
+     * @return XML stream reader instance.
+     */
+    public static final XMLStreamReader createReader(String xml) {
+
+        try {
+            InputStream in = new ByteArrayInputStream(xml.getBytes());
+            return xmlFactory.createXMLStreamReader(in);
+        } catch (XMLStreamException ex) {
+            throw new JxtaException(ex);
+        }
+
+    }
+
+    /**
+     * Creates a stream reader to the serialized XML.
+     * 
+     * @param xml XML stream to which reader is to be created.
+     * @return XML stream reader instance.
+     */
+    public static final XMLStreamReader createReader(InputStream xml) {
+
+        try {
+            return xmlFactory.createXMLStreamReader(xml);
+        } catch (XMLStreamException ex) {
+            throw new JxtaException(ex);
+        }
+
+    }
+
+    /**
+     * Returns the qualified name of the document element.
+     * 
+     * @param xml Serialized xml that needs to be checked.
+     * @return Qualified name of the document element.
+     */
+    public static final QName getDocumentElementQName(String xml) {
+
+        XMLStreamReader reader = null;
+        try {
+            reader = createReader(xml);
+            reader.next();
+            return reader.getName();
+        } catch (XMLStreamException ex) {
+            throw new JxtaException(ex);
+        } finally {
+            try {
+                reader.close();
+            } catch (XMLStreamException ex) {
+                throw new JxtaException(ex);
+            }
+        }
+
+    }
+
+    /*
+     * Renders end element markup.
+     */
+    private static void onEndElement(XMLStreamReader reader, StringBuffer xml) {
+        String name = getName(reader);
+        xml.append("</");
+        xml.append(name);
+        xml.append(">");
+    }
+
+    /*
+     * Gets the fully-qualified name of the element.
+     */
+    private static String getName(XMLStreamReader reader) {
+        QName qname = reader.getName();
+        String namePrefix = qname.getPrefix();
+        String localPart = qname.getLocalPart();
+        String name =
+            namePrefix == null || "".equals(namePrefix) ? localPart : namePrefix + ":"
+                + localPart;
+        return name;
+    }
+
+    /*
+     * Render the attributes.
+     */
+    private static void onAttributes(XMLStreamReader reader, StringBuffer xml) {
+        for (int i = 0, n = reader.getAttributeCount(); i < n; ++i) {
+            xml.append(" ");
+            xml.append(reader.getAttributeLocalName(i));
+            xml.append("=");
+            xml.append("'");
+            xml.append(reader.getAttributeValue(i));
+            xml.append("'");
+        }
+    }
+
+    /*
+     * Renedr namespace mappings.
+     */
+    private static void onNsMappings(XMLStreamReader reader, StringBuffer xml) {
+        for (int i = 0, n = reader.getNamespaceCount(); i < n; ++i) {
+            String prefix = reader.getNamespacePrefix(i);
+            prefix = prefix == null ? prefix = "xmlns" : "xmlns:" + prefix;
+            xml.append(" ");
+            xml.append(prefix);
+            xml.append("=");
+            xml.append("'");
+            xml.append(reader.getNamespaceURI(i));
+            xml.append("'");
+        }
+    }
+
+    /*
+     * Render start element.
+     */
+    private static void onStartElement(XMLStreamReader reader, StringBuffer xml) {
+        xml.append("<");
+        String name = getName(reader);
+        xml.append(name);
+    }
+
+}

Propchange: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/stax/StaxHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/stax/StaxHelper.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/resources/org/apache/tuscany/service/discovery/discovery.jxta.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/resources/org/apache/tuscany/service/discovery/discovery.jxta.scdl?view=auto&rev=500645
==============================================================================
--- incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/resources/org/apache/tuscany/service/discovery/discovery.jxta.scdl (added)
+++ incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/resources/org/apache/tuscany/service/discovery/discovery.jxta.scdl Sat Jan 27 14:35:35 2007
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+-->
+<!--
+    JXTA discovery components.
+    
+    $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+           name="discovery.jxta.scdl">
+
+    <!-- JXTA discovery service. -->
+    <component name="discovery.jxta">
+        <system:implementation.system class="org.apache.tuscany.service.discovery.jxta.JxtaDiscoveryService"/>
+        <property name="interval">10000</property>
+    </component>
+
+    <!-- JXTA platform configurator -->
+    <component name="jxta.network.configurator">
+        <system:implementation.system class="net.jxta.platform.NetworkConfigurator"/>
+        <property name="principal">user</property>
+        <property name="password">password</property>
+    </component>
+
+</composite>

Propchange: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/resources/org/apache/tuscany/service/discovery/discovery.jxta.scdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/resources/org/apache/tuscany/service/discovery/discovery.jxta.scdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/main/resources/org/apache/tuscany/service/discovery/discovery.jxta.scdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/java/org/apache/tuscany/service/discovery/jxta/JxtaDiscoveryServiceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/java/org/apache/tuscany/service/discovery/jxta/JxtaDiscoveryServiceTestCase.java?view=auto&rev=500645
==============================================================================
--- incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/java/org/apache/tuscany/service/discovery/jxta/JxtaDiscoveryServiceTestCase.java (added)
+++ incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/java/org/apache/tuscany/service/discovery/jxta/JxtaDiscoveryServiceTestCase.java Sat Jan 27 14:35:35 2007
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.service.discovery.jxta;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+import net.jxta.platform.NetworkConfigurator;
+
+import org.apache.tuscany.host.RuntimeInfo;
+import org.apache.tuscany.service.discovery.jxta.stax.StaxHelper;
+import org.apache.tuscany.spi.services.discovery.RequestListener;
+import org.apache.tuscany.spi.services.discovery.ResponseListener;
+import org.apache.tuscany.spi.services.work.NotificationListener;
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Revision$ $Date$
+ *
+ */
+public class JxtaDiscoveryServiceTestCase extends TestCase {
+
+    public JxtaDiscoveryServiceTestCase(String name) {
+        super(name);
+    }
+
+    protected void setUp() throws Exception {
+    }
+
+    protected void tearDown() throws Exception {
+    }
+
+    public void testStartAndStop() throws Exception {
+        
+        JxtaDiscoveryService discoveryService = getDiscoveryService("runtime-1", "domain");
+        
+        discoveryService.start();
+        while(!discoveryService.isStarted()) {
+        }
+        
+        RequestListener requestListener = new RequestListener() {
+            public XMLStreamReader onRequest(XMLStreamReader content) {
+                System.err.println("Request received:" + StaxHelper.serialize(content));
+                return StaxHelper.createReader("<response/>");
+            }            
+        };
+        
+        ResponseListener responseListener = new ResponseListener() {
+            public void onResponse(XMLStreamReader content, int messageId) {
+                System.err.println("Response received:" + StaxHelper.serialize(content));
+            }
+            
+        };
+        
+        discoveryService.registerRequestListener(new QName("request"), requestListener);
+        discoveryService.registerResponseListener(new QName("response"), responseListener);
+        
+        XMLStreamReader reader = StaxHelper.createReader("<request/>");
+        discoveryService.sendMessage(null, reader);
+        reader.close();
+        
+    }
+    
+    private JxtaDiscoveryService getDiscoveryService(final String runtimeId, final String domain) {
+        
+        JxtaDiscoveryService discoveryService = new JxtaDiscoveryService();
+        RuntimeInfo runtimeInfo = new RuntimeInfo() {
+            public File getApplicationRootDirectory() {
+                return null;
+            }
+            public URL getBaseURL() {
+                return null;
+            }
+            public URI getDomain() {
+                try {
+                    return new URI(domain);
+                } catch (URISyntaxException ex) {
+                    throw new RuntimeException(ex);
+                }
+            }
+            public String getRuntimeId() {
+                return runtimeId;
+            }
+            public boolean isOnline() {
+                return false;
+            }
+            
+        };
+        discoveryService.setRuntimeInfo(runtimeInfo);
+        
+        NetworkConfigurator configurator = new NetworkConfigurator();
+        configurator.setPrincipal("test-user");
+        configurator.setPassword("test-password");
+        
+        discoveryService.setConfigurator(configurator);
+        discoveryService.setWorkScheduler(new WorkScheduler() {
+            public <T extends Runnable> void scheduleWork(T work, NotificationListener<T> listener) {
+                scheduleWork(work, null);
+            }
+            public <T extends Runnable> void scheduleWork(final T work) {
+                new Thread() {
+                    public void run() {
+                        work.run();
+                    }
+                }.start();
+            }            
+        });
+        return discoveryService;
+        
+    }
+
+}

Propchange: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/java/org/apache/tuscany/service/discovery/jxta/JxtaDiscoveryServiceTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/java/org/apache/tuscany/service/discovery/jxta/JxtaDiscoveryServiceTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/java/org/apache/tuscany/service/discovery/jxta/stax/StaxHelperTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/java/org/apache/tuscany/service/discovery/jxta/stax/StaxHelperTestCase.java?view=auto&rev=500645
==============================================================================
--- incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/java/org/apache/tuscany/service/discovery/jxta/stax/StaxHelperTestCase.java (added)
+++ incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/java/org/apache/tuscany/service/discovery/jxta/stax/StaxHelperTestCase.java Sat Jan 27 14:35:35 2007
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.service.discovery.jxta.stax;
+
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+/**
+ * Test case for StaxHelper
+ * 
+ * @version $Revision$ $Date$
+ *
+ */
+public class StaxHelperTestCase extends TestCase {
+
+    public StaxHelperTestCase(String name) {
+        super(name);
+    }
+
+    public void testSerialize() throws Exception {
+        
+        InputStream in = getClass().getClassLoader().getResourceAsStream("test.scdl");
+        XMLStreamReader reader = StaxHelper.createReader(in);
+        StaxHelper.serialize(reader);
+        // TODO Do assertions
+    }
+
+    public void testGetDocumentElementQName() {
+        InputStream in = getClass().getClassLoader().getResourceAsStream("test.scdl");
+        XMLStreamReader reader = StaxHelper.createReader(in);
+        String xml = StaxHelper.serialize(reader);
+        QName qname = StaxHelper.getDocumentElementQName(xml);
+        assertEquals("http://www.osoa.org/xmlns/sca/1.0", qname.getNamespaceURI());
+        assertEquals("composite", qname.getLocalPart());
+    }
+
+}

Propchange: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/java/org/apache/tuscany/service/discovery/jxta/stax/StaxHelperTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/java/org/apache/tuscany/service/discovery/jxta/stax/StaxHelperTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/resources/test.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/resources/test.scdl?view=auto&rev=500645
==============================================================================
--- incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/resources/test.scdl (added)
+++ incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/resources/test.scdl Sat Jan 27 14:35:35 2007
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+-->
+<!--
+    Test for stax.
+    
+    $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+           name="test.scdl">
+
+    <component name="test.component">
+        <system:implementation.system class="test.class"/>
+        <property name="testProperty">123</property>
+    </component>
+
+</composite>

Propchange: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/resources/test.scdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/resources/test.scdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/runtime/services/discovery/jxta/src/test/resources/test.scdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/runtime/services/discovery/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/services/discovery/pom.xml?view=auto&rev=500645
==============================================================================
--- incubator/tuscany/java/sca/runtime/services/discovery/pom.xml (added)
+++ incubator/tuscany/java/sca/runtime/services/discovery/pom.xml Sat Jan 27 14:35:35 2007
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+-->
+<project>
+    <parent>
+        <groupId>org.apache.tuscany.sca.runtime.services</groupId>
+        <artifactId>services</artifactId>
+        <version>1.0-incubator-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.tuscany.sca.runtime.services.discovery</groupId>
+    <artifactId>discovery</artifactId>
+    <packaging>pom</packaging>
+    <name>Tuscany SCA Discovery Services</name>
+
+    <modules>
+        <module>installjxta</module>
+        <module>jxta</module>
+        <module>bonjour</module>
+    </modules>
+</project>

Propchange: incubator/tuscany/java/sca/runtime/services/discovery/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/runtime/services/discovery/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/runtime/services/discovery/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/runtime/services/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/services/pom.xml?view=auto&rev=500645
==============================================================================
--- incubator/tuscany/java/sca/runtime/services/pom.xml (added)
+++ incubator/tuscany/java/sca/runtime/services/pom.xml Sat Jan 27 14:35:35 2007
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+-->
+<project>
+
+    <parent>
+        <groupId>org.apache.tuscany.sca.runtime</groupId>
+        <artifactId>parent</artifactId>
+        <version>1.0-incubator-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.tuscany.sca.runtime.services</groupId>
+    <artifactId>services</artifactId>
+    <packaging>pom</packaging>
+    <name>Apache Tuscany Runtime Services</name>
+
+    <modules>
+        <module>management</module>
+        <module>maven</module>
+        <module>discovery</module>
+    </modules>
+    
+</project>

Propchange: incubator/tuscany/java/sca/runtime/services/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/runtime/services/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/runtime/services/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/tuscany/java/sca/services/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/pom.xml?view=diff&rev=500645&r1=500644&r2=500645
==============================================================================
--- incubator/tuscany/java/sca/services/pom.xml (original)
+++ incubator/tuscany/java/sca/services/pom.xml Sat Jan 27 14:35:35 2007
@@ -62,7 +62,6 @@
         <module>bindings</module>
         <module>persistence</module>
         <module>transaction</module>
-        <module>discovery</module>
 <!--
         <module>transports/http.jetty</module>
 -->



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org