You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2008/08/04 09:22:32 UTC

svn commit: r682275 - in /tuscany/java/sca: itest/validation/ itest/validation/src/main/resources/impl/ejb/ itest/validation/src/main/resources/impl/ejb/EJBLinkAttributeMissing/ itest/validation/src/main/resources/impl/osgi/MissingComponentTypeFile/ it...

Author: lresende
Date: Mon Aug  4 00:22:31 2008
New Revision: 682275

URL: http://svn.apache.org/viewvc?rev=682275&view=rev
Log:
TUSCANY-2403 - Applying patch from Ram

Added:
    tuscany/java/sca/itest/validation/src/main/resources/impl/ejb/
    tuscany/java/sca/itest/validation/src/main/resources/impl/ejb/EJBLinkAttributeMissing/
    tuscany/java/sca/itest/validation/src/main/resources/impl/ejb/EJBLinkAttributeMissing/ejb.composite   (with props)
    tuscany/java/sca/itest/validation/src/test/java/impl/ejb/
    tuscany/java/sca/itest/validation/src/test/java/impl/ejb/EJBLinkAttributeMissingTestCase.java   (with props)
    tuscany/java/sca/modules/implementation-ejb/src/main/resources/impl-ejb-validation-messages.properties   (with props)
Modified:
    tuscany/java/sca/itest/validation/pom.xml
    tuscany/java/sca/itest/validation/src/main/resources/impl/osgi/MissingComponentTypeFile/OSGiTestService.jar
    tuscany/java/sca/itest/validation/src/main/resources/impl/osgi/PropertyShouldSpecifySR/OSGiTestService.jar
    tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java

Modified: tuscany/java/sca/itest/validation/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/validation/pom.xml?rev=682275&r1=682274&r2=682275&view=diff
==============================================================================
--- tuscany/java/sca/itest/validation/pom.xml (original)
+++ tuscany/java/sca/itest/validation/pom.xml Mon Aug  4 00:22:31 2008
@@ -83,6 +83,13 @@
             <artifactId>tuscany-implementation-osgi</artifactId>
             <version>1.4-SNAPSHOT</version>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-ejb</artifactId>
+            <version>1.4-SNAPSHOT</version>
+        </dependency>
+
         
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>

Added: tuscany/java/sca/itest/validation/src/main/resources/impl/ejb/EJBLinkAttributeMissing/ejb.composite
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/validation/src/main/resources/impl/ejb/EJBLinkAttributeMissing/ejb.composite?rev=682275&view=auto
==============================================================================
--- tuscany/java/sca/itest/validation/src/main/resources/impl/ejb/EJBLinkAttributeMissing/ejb.composite (added)
+++ tuscany/java/sca/itest/validation/src/main/resources/impl/ejb/EJBLinkAttributeMissing/ejb.composite Mon Aug  4 00:22:31 2008
@@ -0,0 +1,29 @@
+<?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.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+	targetNamespace="http://sample/ejb"
+	xmlns:sc="http://sample/composite"
+	name="TestEJB">
+
+    <component name="TestEJB">
+        <implementation.ejb/>
+    </component>
+
+</composite>

Propchange: tuscany/java/sca/itest/validation/src/main/resources/impl/ejb/EJBLinkAttributeMissing/ejb.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/itest/validation/src/main/resources/impl/ejb/EJBLinkAttributeMissing/ejb.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/java/sca/itest/validation/src/main/resources/impl/ejb/EJBLinkAttributeMissing/ejb.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: tuscany/java/sca/itest/validation/src/main/resources/impl/osgi/MissingComponentTypeFile/OSGiTestService.jar
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/validation/src/main/resources/impl/osgi/MissingComponentTypeFile/OSGiTestService.jar?rev=682275&r1=682274&r2=682275&view=diff
==============================================================================
Binary files - no diff available.

Modified: tuscany/java/sca/itest/validation/src/main/resources/impl/osgi/PropertyShouldSpecifySR/OSGiTestService.jar
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/validation/src/main/resources/impl/osgi/PropertyShouldSpecifySR/OSGiTestService.jar?rev=682275&r1=682274&r2=682275&view=diff
==============================================================================
Binary files - no diff available.

Added: tuscany/java/sca/itest/validation/src/test/java/impl/ejb/EJBLinkAttributeMissingTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/validation/src/test/java/impl/ejb/EJBLinkAttributeMissingTestCase.java?rev=682275&view=auto
==============================================================================
--- tuscany/java/sca/itest/validation/src/test/java/impl/ejb/EJBLinkAttributeMissingTestCase.java (added)
+++ tuscany/java/sca/itest/validation/src/test/java/impl/ejb/EJBLinkAttributeMissingTestCase.java Mon Aug  4 00:22:31 2008
@@ -0,0 +1,60 @@
+/*
+ * 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 impl.ejb;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class EJBLinkAttributeMissingTestCase extends TestCase {
+
+    private CustomCompositeBuilder customDomain;
+	
+    @Override
+    protected void setUp() throws Exception 
+    {
+        customDomain = CustomCompositeBuilder.getInstance();
+        try {
+            customDomain.loadContribution("src/main/resources/impl/ejb/EJBLinkAttributeMissing/ejb.composite", 
+                      "TestContribution", "src/main/resources/impl/ejb/EJBLinkAttributeMissing/");
+        } catch (Exception ex){
+            //throw ex;
+        }
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+    	//nothing to do
+    }
+
+    public void testCalculator() {
+        Monitor monitor = customDomain.getMonitorInstance();
+        Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+        
+        assertNotNull(problem);
+        assertEquals("EJBLinkAttributeMissing", problem.getMessageId());
+    }
+}

Propchange: tuscany/java/sca/itest/validation/src/test/java/impl/ejb/EJBLinkAttributeMissingTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/itest/validation/src/test/java/impl/ejb/EJBLinkAttributeMissingTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java?rev=682275&r1=682274&r2=682275&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java (original)
+++ tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java Mon Aug  4 00:22:31 2008
@@ -27,6 +27,7 @@
 
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
 import org.apache.tuscany.sca.assembly.xml.Constants;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
@@ -38,6 +39,8 @@
 import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
 import org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory;
 import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
 
 
 /**
@@ -57,6 +60,20 @@
         this.implementationFactory = modelFactories.getFactory(EJBImplementationFactory.class);
         this.monitor = monitor;
     }
+    
+    /**
+     * Report a error.
+     *
+     * @param problems
+     * @param message
+     * @param model
+     */
+    private void error(String message, Object model, Object... messageParameters) {
+        if (monitor != null) {
+            Problem problem = new ProblemImpl(this.getClass().getName(), "impl-ejb-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+            monitor.problem(problem);
+        }
+    }
 
     public QName getArtifactType() {
         // Returns the QName of the XML element processed by this processor
@@ -87,6 +104,8 @@
             } else {
                 implementation.setURI(ejbLink);
             }
+        } else {
+            error("EJBLinkAttributeMissing", reader);
         }
 
         // Skip to end element

Added: tuscany/java/sca/modules/implementation-ejb/src/main/resources/impl-ejb-validation-messages.properties
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-ejb/src/main/resources/impl-ejb-validation-messages.properties?rev=682275&view=auto
==============================================================================
--- tuscany/java/sca/modules/implementation-ejb/src/main/resources/impl-ejb-validation-messages.properties (added)
+++ tuscany/java/sca/modules/implementation-ejb/src/main/resources/impl-ejb-validation-messages.properties Mon Aug  4 00:22:31 2008
@@ -0,0 +1,21 @@
+#
+#
+#    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.
+#
+#
+EJBLinkAttributeMissing = Reading implementation.ejb - ejb-link attribute missing
\ No newline at end of file

Propchange: tuscany/java/sca/modules/implementation-ejb/src/main/resources/impl-ejb-validation-messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/implementation-ejb/src/main/resources/impl-ejb-validation-messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/java/sca/modules/implementation-ejb/src/main/resources/impl-ejb-validation-messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain