You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2008/05/30 18:45:53 UTC
svn commit: r661788 [3/3] - in /incubator/tuscany/java/sca:
itest/validation/ itest/validation/src/main/java/impl/osgi/
itest/validation/src/main/java/impl/spring/
itest/validation/src/main/resources/META-INF/
itest/validation/src/main/resources/META-I...
Added: incubator/tuscany/java/sca/itest/validation/src/test/java/binding/jms/UnexpectedElementTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/validation/src/test/java/binding/jms/UnexpectedElementTestCase.java?rev=661788&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/validation/src/test/java/binding/jms/UnexpectedElementTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/validation/src/test/java/binding/jms/UnexpectedElementTestCase.java Fri May 30 09:45:50 2008
@@ -0,0 +1,58 @@
+/*
+ * 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 binding.jms;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.impl.DefaultLoggingMonitorImpl;
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class UnexpectedElementTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/UnexpectedElement/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/UnexpectedElement/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("UnexpectedElement", problem.getMessageId());
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/binding/jms/UnexpectedElementTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/binding/jms/UnexpectedElementTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/validation/src/test/java/binding/jms/UnexpectedResponseElementTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/validation/src/test/java/binding/jms/UnexpectedResponseElementTestCase.java?rev=661788&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/validation/src/test/java/binding/jms/UnexpectedResponseElementTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/validation/src/test/java/binding/jms/UnexpectedResponseElementTestCase.java Fri May 30 09:45:50 2008
@@ -0,0 +1,58 @@
+/*
+ * 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 binding.jms;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.impl.DefaultLoggingMonitorImpl;
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class UnexpectedResponseElementTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/UnexpectedResponseElement/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/UnexpectedResponseElement/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("UnexpectedResponseElement", problem.getMessageId());
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/binding/jms/UnexpectedResponseElementTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/binding/jms/UnexpectedResponseElementTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/itest/validation/src/test/java/domain/CustomCompositeBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/validation/src/test/java/domain/CustomCompositeBuilder.java?rev=661788&r1=661787&r2=661788&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/validation/src/test/java/domain/CustomCompositeBuilder.java (original)
+++ incubator/tuscany/java/sca/itest/validation/src/test/java/domain/CustomCompositeBuilder.java Fri May 30 09:45:50 2008
@@ -16,6 +16,8 @@
import org.apache.tuscany.sca.assembly.SCABindingFactory;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint;
+import org.apache.tuscany.sca.context.DefaultContextFactoryExtensionPoint;
import org.apache.tuscany.sca.contribution.Contribution;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory;
@@ -32,8 +34,14 @@
import org.apache.tuscany.sca.core.ModuleActivator;
import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint;
import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.core.invocation.DefaultProxyFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.invocation.MessageFactoryImpl;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
+import org.apache.tuscany.sca.implementation.node.builder.impl.NodeCompositeBuilderImpl;
import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.monitor.MonitorFactory;
import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
@@ -73,31 +81,43 @@
private static CustomCompositeBuilder ref;
- private void init() {
- // Create extension point registry
+ private void init() {
+
+ // Create extension point registry
ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ // Create a monitor
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ monitor = monitorFactory.createMonitor();
+
+ // Create an interface contract mapper
+ InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+ extensionPoints.addExtensionPoint(mapper);
+
+ // Create Message factory
+ MessageFactory messageFactory = new MessageFactoryImpl();
+
+ // Create Proxy factory
+ ProxyFactory proxyFactory = new DefaultProxyFactoryExtensionPoint(messageFactory, mapper);
+ extensionPoints.addExtensionPoint(proxyFactory);
+
+ // Create context factory extension point
+ ContextFactoryExtensionPoint contextFactories = new DefaultContextFactoryExtensionPoint(extensionPoints);
+ extensionPoints.addExtensionPoint(contextFactories);
+
// Initialize the Tuscany module activators
ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class);
for (ModuleActivator activator: moduleActivators.getModuleActivators()) {
- //activator.start(extensionPoints);
+ activator.start(extensionPoints);
}
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
- monitor = monitorFactory.createMonitor();
-
// Get XML input/output factories
modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
- outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
+ outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
- // Create a validation XML schema extension point
- ValidationSchemaExtensionPoint schemas = extensionPoints.getExtensionPoint(ValidationSchemaExtensionPoint.class);
- // Create a validating XML input factory
- XMLInputFactory validatingInputFactory = new DefaultValidatingXMLInputFactory(inputFactory, schemas, monitor);
- //modelFactories.addFactory(validatingInputFactory);
+ modelFactories.addFactory(messageFactory);
// Get contribution workspace and assembly model factories
workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class);
@@ -112,8 +132,6 @@
// Create contribution content processor
URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class);
- //policyDefinitions = new ArrayList<SCADefinitions>();
- //docProcessorExtensions.addArtifactProcessor(new CompositeDocumentProcessor(xmlProcessor, validatingInputFactory, policyDefinitions, monitor));
// Get the model resolvers
modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
@@ -126,6 +144,9 @@
IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class);
domainCompositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, contractMapper, monitor);
+
+ // Create a node composite builder
+ nodeCompositeBuilder = new NodeCompositeBuilderImpl(assemblyFactory, scaBindingFactory, contractMapper, null, monitor);
}
public void loadContribution(String compositeURL, String sourceURI, String sourceURL) throws Exception {
Modified: incubator/tuscany/java/sca/itest/validation/src/test/java/impl/java/ContributionResolveExceptionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/validation/src/test/java/impl/java/ContributionResolveExceptionTestCase.java?rev=661788&r1=661787&r2=661788&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/validation/src/test/java/impl/java/ContributionResolveExceptionTestCase.java (original)
+++ incubator/tuscany/java/sca/itest/validation/src/test/java/impl/java/ContributionResolveExceptionTestCase.java Fri May 30 09:45:50 2008
@@ -54,7 +54,7 @@
Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
- //assertNotNull(problem);
- //assertEquals("ContributionResolveException", problem.getMessageId());
+ assertNotNull(problem);
+ assertEquals("ContributionResolveException", problem.getMessageId());
}
}
Added: incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/CouldNotLocateOSGiBundleTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/CouldNotLocateOSGiBundleTestCase.java?rev=661788&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/CouldNotLocateOSGiBundleTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/CouldNotLocateOSGiBundleTestCase.java Fri May 30 09:45:50 2008
@@ -0,0 +1,62 @@
+/*
+ * 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.osgi;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CouldNotLocateOSGiBundleTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ //OSGiTestBundles.createBundle("src/main/resources/impl/osgi/MissingComponentTypeFile/OSGiTestService.jar", OSGiTestInterface.class, OSGiTestImpl.class);
+
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/osgi/CouldNotLocateOSGiBundle/osgitest.composite",
+ "TestContribution", "src/main/resources/impl/osgi/CouldNotLocateOSGiBundle/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ OSGiRuntime.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("CouldNotLocateOSGiBundle", problem.getMessageId());
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/CouldNotLocateOSGiBundleTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/CouldNotLocateOSGiBundleTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/MissingComponentTypeFileTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/MissingComponentTypeFileTestCase.java?rev=661788&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/MissingComponentTypeFileTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/MissingComponentTypeFileTestCase.java Fri May 30 09:45:50 2008
@@ -0,0 +1,62 @@
+/*
+ * 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.osgi;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class MissingComponentTypeFileTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ OSGiTestBundles.createBundle("src/main/resources/impl/osgi/MissingComponentTypeFile/OSGiTestService.jar", OSGiTestInterface.class, OSGiTestImpl.class);
+
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/osgi/MissingComponentTypeFile/osgitest.composite",
+ "TestContribution", "src/main/resources/impl/osgi/MissingComponentTypeFile/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ OSGiRuntime.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("MissingComponentTypeFile", problem.getMessageId());
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/MissingComponentTypeFileTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/MissingComponentTypeFileTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/OSGiTestBundles.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/OSGiTestBundles.java?rev=661788&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/OSGiTestBundles.java (added)
+++ incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/OSGiTestBundles.java Fri May 30 09:45:50 2008
@@ -0,0 +1,111 @@
+/*
+ * 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.osgi;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.net.URL;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
+
+
+/**
+ *
+ * Utility class to create OSGi bundles
+ *
+ * @version $Rev$ $Date$
+ */
+public class OSGiTestBundles {
+
+ public static void createBundle(String jarName,
+ Class<?> interfaceClass, Class<?> implClass) throws Exception {
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ String EOL = System.getProperty("line.separator");
+
+ String packageName = interfaceClass.getPackage().getName();
+ String bundleName = interfaceClass.getName();
+
+ String manifestStr = "Manifest-Version: 1.0" + EOL
+ + "Bundle-ManifestVersion: 2" + EOL + "Bundle-Name: "
+ + bundleName + EOL + "Bundle-SymbolicName: " + bundleName + EOL
+ + "Bundle-Version: " + "1.0.0" + EOL
+ + "Bundle-Localization: plugin" + EOL;
+
+ StringBuilder manifestBuf = new StringBuilder();
+ manifestBuf.append(manifestStr);
+ manifestBuf.append("Export-Package: " + packageName + EOL);
+ manifestBuf.append("Import-Package: org.osgi.framework" + EOL);
+ manifestBuf.append("Bundle-Activator: " + implClass.getName() + EOL);
+
+ ByteArrayInputStream manifestStream = new ByteArrayInputStream(manifestBuf.toString().getBytes());
+ Manifest manifest = new Manifest();
+ manifest.read(manifestStream);
+
+
+ JarOutputStream jarOut = new JarOutputStream(out, manifest);
+
+ String interfaceClassName = interfaceClass.getName().replaceAll("\\.",
+ "/")
+ + ".class";
+
+ URL url = interfaceClass.getClassLoader().getResource(
+ interfaceClassName);
+ String path = url.getPath();
+
+ ZipEntry ze = new ZipEntry(interfaceClassName);
+
+ jarOut.putNextEntry(ze);
+ FileInputStream file = new FileInputStream(path);
+ byte[] fileContents = new byte[file.available()];
+ file.read(fileContents);
+ jarOut.write(fileContents);
+
+ String implClassName = implClass.getName().replaceAll("\\.",
+ "/")
+ + ".class";
+
+ url = implClass.getClassLoader().getResource(implClassName);
+ path = url.getPath();
+
+ ze = new ZipEntry(implClassName);
+
+ jarOut.putNextEntry(ze);
+ file = new FileInputStream(path);
+ fileContents = new byte[file.available()];
+ file.read(fileContents);
+ jarOut.write(fileContents);
+
+ file.close();
+
+ jarOut.close();
+ out.close();
+
+ FileOutputStream fileOut = new FileOutputStream(jarName);
+ fileOut.write(out.toByteArray());
+ fileOut.close();
+
+
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/OSGiTestBundles.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/OSGiTestBundles.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/PropertyShouldSpecifySRTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/PropertyShouldSpecifySRTestCase.java?rev=661788&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/PropertyShouldSpecifySRTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/PropertyShouldSpecifySRTestCase.java Fri May 30 09:45:50 2008
@@ -0,0 +1,62 @@
+/*
+ * 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.osgi;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class PropertyShouldSpecifySRTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ OSGiTestBundles.createBundle("src/main/resources/impl/osgi/PropertyShouldSpecifySR/OSGiTestService.jar", OSGiTestInterface.class, OSGiTestImpl.class);
+
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/osgi/PropertyShouldSpecifySR/osgitest.composite",
+ "TestContribution", "src/main/resources/impl/osgi/PropertyShouldSpecifySR/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ OSGiRuntime.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("PropertyShouldSpecifySR", problem.getMessageId());
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/PropertyShouldSpecifySRTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/impl/osgi/PropertyShouldSpecifySRTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/AlwaysProvidedIntentNotFoundTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/AlwaysProvidedIntentNotFoundTestCase.java?rev=661788&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/AlwaysProvidedIntentNotFoundTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/AlwaysProvidedIntentNotFoundTestCase.java Fri May 30 09:45:50 2008
@@ -0,0 +1,58 @@
+/*
+ * 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 policy.xml;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.impl.DefaultLoggingMonitorImpl;
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class AlwaysProvidedIntentNotFoundTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/policy/xml/AlwaysProvidedIntentNotFound/Calculator.composite",
+ "TestContribution", "src/main/resources/policy/xml/AlwaysProvidedIntentNotFound/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("AlwaysProvidedIntentNotFound", problem.getMessageId());
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/AlwaysProvidedIntentNotFoundTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/AlwaysProvidedIntentNotFoundTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/ErrorInPolicyIntentDefinitionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/ErrorInPolicyIntentDefinitionTestCase.java?rev=661788&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/ErrorInPolicyIntentDefinitionTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/ErrorInPolicyIntentDefinitionTestCase.java Fri May 30 09:45:50 2008
@@ -0,0 +1,58 @@
+/*
+ * 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 policy.xml;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.impl.DefaultLoggingMonitorImpl;
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class ErrorInPolicyIntentDefinitionTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/policy/xml/ErrorInPolicyIntentDefinition/Calculator.composite",
+ "TestContribution", "src/main/resources/policy/xml/ErrorInPolicyIntentDefinition/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("ErrorInPolicyIntentDefinition", problem.getMessageId());
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/ErrorInPolicyIntentDefinitionTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/ErrorInPolicyIntentDefinitionTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/IntentNotSpecifiedTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/IntentNotSpecifiedTestCase.java?rev=661788&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/IntentNotSpecifiedTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/IntentNotSpecifiedTestCase.java Fri May 30 09:45:50 2008
@@ -0,0 +1,58 @@
+/*
+ * 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 policy.xml;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.impl.DefaultLoggingMonitorImpl;
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class IntentNotSpecifiedTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/policy/xml/IntentNotSpecified/Calculator.composite",
+ "TestContribution", "src/main/resources/policy/xml/IntentNotSpecified/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("IntentNotSpecified", problem.getMessageId());
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/IntentNotSpecifiedTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/IntentNotSpecifiedTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/MayProvideIntentNotFoundTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/MayProvideIntentNotFoundTestCase.java?rev=661788&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/MayProvideIntentNotFoundTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/MayProvideIntentNotFoundTestCase.java Fri May 30 09:45:50 2008
@@ -0,0 +1,58 @@
+/*
+ * 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 policy.xml;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.impl.DefaultLoggingMonitorImpl;
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class MayProvideIntentNotFoundTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/policy/xml/MayProvideIntentNotFound/Calculator.composite",
+ "TestContribution", "src/main/resources/policy/xml/MayProvideIntentNotFound/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("MayProvideIntentNotFound", problem.getMessageId());
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/MayProvideIntentNotFoundTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/MayProvideIntentNotFoundTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/RequiredAttributeMissingTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/RequiredAttributeMissingTestCase.java?rev=661788&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/RequiredAttributeMissingTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/RequiredAttributeMissingTestCase.java Fri May 30 09:45:50 2008
@@ -0,0 +1,58 @@
+/*
+ * 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 policy.xml;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.impl.DefaultLoggingMonitorImpl;
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class RequiredAttributeMissingTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/policy/xml/RequiredAttributeMissing/Calculator.composite",
+ "TestContribution", "src/main/resources/policy/xml/RequiredAttributeMissing/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("RequiredAttributeMissing", problem.getMessageId());
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/RequiredAttributeMissingTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/RequiredAttributeMissingTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/UnableToMapPoliciesTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/UnableToMapPoliciesTestCase.java?rev=661788&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/UnableToMapPoliciesTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/UnableToMapPoliciesTestCase.java Fri May 30 09:45:50 2008
@@ -0,0 +1,58 @@
+/*
+ * 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 policy.xml;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.impl.DefaultLoggingMonitorImpl;
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class UnableToMapPoliciesTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/policy/xml/UnableToMapPolicies/Calculator.composite",
+ "TestContribution", "src/main/resources/policy/xml/UnableToMapPolicies/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("UnableToMapPolicies", problem.getMessageId());
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/UnableToMapPoliciesTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/UnableToMapPoliciesTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/UnrecognizedIntentAttachPointTypeTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/UnrecognizedIntentAttachPointTypeTestCase.java?rev=661788&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/UnrecognizedIntentAttachPointTypeTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/UnrecognizedIntentAttachPointTypeTestCase.java Fri May 30 09:45:50 2008
@@ -0,0 +1,58 @@
+/*
+ * 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 policy.xml;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.impl.DefaultLoggingMonitorImpl;
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class UnrecognizedIntentAttachPointTypeTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/policy/xml/UnrecognizedIntentAttachPointType/Calculator.composite",
+ "TestContribution", "src/main/resources/policy/xml/UnrecognizedIntentAttachPointType/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("UnrecognizedIntentAttachPointType", problem.getMessageId());
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/UnrecognizedIntentAttachPointTypeTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/validation/src/test/java/policy/xml/UnrecognizedIntentAttachPointTypeTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.java?rev=661788&r1=661787&r2=661788&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.java Fri May 30 09:45:50 2008
@@ -46,6 +46,9 @@
import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
import org.apache.tuscany.sca.definitions.SCADefinitions;
import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
import org.apache.tuscany.sca.policy.IntentAttachPoint;
import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
@@ -60,6 +63,7 @@
private ModelResolver resolver;
private CompositeBuilder compositeBuilder;
private Composite composite;
+ private Monitor monitor;
@Override
public void setUp() throws Exception {
@@ -70,7 +74,11 @@
IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
List<SCADefinitions> policyDefinitions = new ArrayList<SCADefinitions>();
resolver = new DefaultModelResolver();
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, new InterfaceContractMapperImpl(), null);
+
+ MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
+ monitor = monitorFactory.createMonitor();
+
+ compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, new InterfaceContractMapperImpl(), monitor);
URLArtifactProcessorExtensionPoint documentProcessors = new DefaultURLArtifactProcessorExtensionPoint(extensionPoints);
documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors, null);
policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java?rev=661788&r1=661787&r2=661788&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java Fri May 30 09:45:50 2008
@@ -46,6 +46,9 @@
import org.apache.tuscany.sca.definitions.SCADefinitions;
import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
/**
@@ -60,6 +63,7 @@
private ModelResolver resolver;
private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor;
private CompositeBuilder compositeBuilder;
+ private Monitor monitor;
@Override
public void setUp() throws Exception {
@@ -69,12 +73,15 @@
staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
resolver = new DefaultModelResolver();
+ MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
+ monitor = monitorFactory.createMonitor();
+
ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
SCABindingFactory scaBindingFactory = new TestSCABindingFactoryImpl();
IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
+ compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, monitor);
URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java?rev=661788&r1=661787&r2=661788&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java Fri May 30 09:45:50 2008
@@ -49,6 +49,9 @@
import org.apache.tuscany.sca.definitions.SCADefinitions;
import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
/**
@@ -63,6 +66,7 @@
private ModelResolver resolver;
private CompositeBuilder compositeBuilder;
private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor;
+ private Monitor monitor;
@Override
public void setUp() throws Exception {
@@ -78,7 +82,11 @@
SCABindingFactory scaBindingFactory = new TestSCABindingFactoryImpl();
IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
+
+ MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
+ monitor = monitorFactory.createMonitor();
+
+ compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, monitor);
URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java?rev=661788&r1=661787&r2=661788&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java Fri May 30 09:45:50 2008
@@ -298,8 +298,10 @@
* @param model
*/
private void warning(String message, Object model, String... messageParameters) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
}
/**
Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java?rev=661788&r1=661787&r2=661788&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java Fri May 30 09:45:50 2008
@@ -203,8 +203,10 @@
* @param model
*/
private void warning(String message, Object model, String... messageParameters) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
}
/**
Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java?rev=661788&r1=661787&r2=661788&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java Fri May 30 09:45:50 2008
@@ -91,7 +91,7 @@
endpointFactory = new DefaultEndpointFactory();
}
- if (monitor == null){
+ /*if (monitor == null) {
monitor = new Monitor () {
public void problem(Problem problem) {
@@ -114,7 +114,7 @@
}
}
};
- }
+ }*/
compositeIncludeBuilder = new CompositeIncludeBuilderImpl(monitor);
Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java?rev=661788&r1=661787&r2=661788&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java Fri May 30 09:45:50 2008
@@ -42,8 +42,10 @@
}
private void warning(String message, Object model, String... messageParameters) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
+ if (monitor != null){
+ Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
}
/**
Modified: incubator/tuscany/java/sca/modules/databinding-sdo/src/main/resources/databinding-sdo-validation-messages.properties
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databinding-sdo/src/main/resources/databinding-sdo-validation-messages.properties?rev=661788&r1=661787&r2=661788&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/databinding-sdo/src/main/resources/databinding-sdo-validation-messages.properties (original)
+++ incubator/tuscany/java/sca/modules/databinding-sdo/src/main/resources/databinding-sdo-validation-messages.properties Fri May 30 09:45:50 2008
@@ -21,5 +21,3 @@
FailToResolveClass = Fail to resolve class: {0}
FailToResolveLocation = Fail to resolve location: {0}
ContributionResolveException = ContributionResolveException occured due to:
-IOException = IOException occured due to:
-AttributeCompositeMissing = Attribute 'composite' is missing
\ No newline at end of file
Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java?rev=661788&r1=661787&r2=661788&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java Fri May 30 09:45:50 2008
@@ -63,6 +63,7 @@
import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
import org.apache.tuscany.sca.policy.Intent;
@@ -150,9 +151,11 @@
if (monitorFactory != null){
monitor = monitorFactory.createMonitor();
} else {
- logger.fine("No MonitorFactory is found on the classpath.");
+ monitorFactory = new DefaultMonitorFactoryImpl();
+ monitor = monitorFactory.createMonitor();
+ utilities.addUtility(monitorFactory);
+ //logger.fine("No MonitorFactory is found on the classpath.");
}
-
// Create a contribution service
policyDefinitions = new ArrayList<SCADefinitions>();
Modified: incubator/tuscany/java/sca/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java?rev=661788&r1=661787&r2=661788&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java Fri May 30 09:45:50 2008
@@ -57,6 +57,34 @@
this.monitor = monitor;
}
+ /**
+ * Report a exception.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "interface-javaxml-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * 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(), "interface-javaxml-validation-messages", Severity.ERROR, model, message,(Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
private JavaInterface createJavaInterface(String interfaceName) {
JavaInterface javaInterface = javaFactory.createJavaInterface();
javaInterface.setUnresolved(true);
@@ -120,8 +148,7 @@
classReference = resolver.resolveModel(ClassReference.class, classReference);
Class javaClass = classReference.getJavaClass();
if (javaClass == null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "interface-javaxml-validation-messages", Severity.ERROR, javaInterface, "ClassNotFoundException", javaInterface.getName());
- monitor.problem(problem);
+ error("ClassNotFoundException", resolver, javaInterface.getName());
throw new ContributionResolveException(new ClassNotFoundException(javaInterface.getName()));
}
try {
@@ -131,7 +158,9 @@
javaFactory.createJavaInterface(javaInterface, javaClass);
} catch (InvalidInterfaceException e) {
- throw new ContributionResolveException(e);
+ ContributionResolveException ce = new ContributionResolveException(e);
+ error("ContributionResolveException", javaFactory, ce);
+ throw ce;
}
// Cache the resolved interface
Added: incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorFactoryImpl.java?rev=661788&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorFactoryImpl.java (added)
+++ incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorFactoryImpl.java Fri May 30 09:45:50 2008
@@ -0,0 +1,41 @@
+/*
+ * 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.sca.monitor.impl;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+
+
+/**
+ * A factory for creating validation monitors
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultMonitorFactoryImpl implements MonitorFactory {
+
+ private Monitor monitor = null;
+
+ public Monitor createMonitor() {
+ if (monitor == null){
+ monitor = new DefaultMonitorImpl();
+ }
+ return monitor ;
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorFactoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorFactoryImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorImpl.java?rev=661788&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorImpl.java (added)
+++ incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorImpl.java Fri May 30 09:45:50 2008
@@ -0,0 +1,70 @@
+/*
+ * 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.sca.monitor.impl;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * A monitor for the watching for validation problems
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultMonitorImpl implements Monitor {
+ private static final Logger logger = Logger.getLogger(DefaultMonitorImpl.class.getName());
+
+ // remembers the last logged problem for testing purposes
+ private Problem lastProblem = null;
+
+ /**
+ * Reports a build problem.
+ *
+ * @param problem
+ */
+ public void problem(Problem problem) {
+
+ lastProblem = problem;
+
+ Logger problemLogger = Logger.getLogger(problem.getSourceClassName(), problem.getBundleName());
+
+ if (problemLogger == null){
+ logger.severe("Can't get logger " + problem.getSourceClassName()+ " with bundle " + problem.getBundleName());
+ }
+
+ if (problem.getSeverity() == Severity.INFO) {
+ problemLogger.log(Level.INFO, problem.getMessageId(), problem.getMessageParams());
+ } else if (problem.getSeverity() == Severity.WARNING) {
+ problemLogger.log(Level.WARNING, problem.getMessageId(), problem.getMessageParams());
+ } else if (problem.getSeverity() == Severity.ERROR) {
+ if (problem.getCause() != null) {
+ problemLogger.log(Level.SEVERE, problem.getMessageId(), problem.getCause());
+ } else {
+ problemLogger.log(Level.SEVERE, problem.getMessageId(), problem.getMessageParams());
+ }
+ }
+ }
+
+ public Problem getLastLoggedProblem(){
+ return lastProblem;
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties?rev=661788&r1=661787&r2=661788&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties (original)
+++ incubator/tuscany/java/sca/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties Fri May 30 09:45:50 2008
@@ -30,6 +30,7 @@
ErrorInPolicyIntentDefinition = Error in PolicyIntent Definition - {0} {1}
ExcludedIntentNotFound = Excluded Intent {0} not found for intent {1}
UnrecognizedIntentAttachPointType = Unrecognized IntentAttachPointType - {0}
-RequiredAttributeMissing = Required attribute '{0}' missing from BindingType Definition
+RequiredAttributeMissing = Required attribute {0} missing from BindingType Definition
AlwaysProvidedIntentNotFound = Always Provided Intent - {0} not found for ExtensionType {1}
-MayProvideIntentNotFound = May Provide Intent - {0} not found for ExtensionType {1}
\ No newline at end of file
+MayProvideIntentNotFound = May Provide Intent - {0} not found for ExtensionType {1}
+ContributionReadException = ContributionReadException occured due to:
\ No newline at end of file