diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:07:53 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:07:53 +0000 |
commit | 89d72264d0af4c65c9bf0b7a6f823f13d69162aa (patch) | |
tree | f6a4ea43b576d56a43adf10ccbed4cd75a9eb827 /sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test | |
parent | 6a3ca6736c808c1647854e405ef379b609f276db (diff) |
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835127 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test')
92 files changed, 5995 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/assembly/xml/ContributionReadException.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/assembly/xml/ContributionReadException.java new file mode 100644 index 0000000000..9b0d51eb59 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/assembly/xml/ContributionReadException.java @@ -0,0 +1,61 @@ +/* + * 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 assembly.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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class ContributionReadException extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/assemblyxml/ContributionReadException/Calculator.composite", + "TestContribution", "src/main/resources/assemblyxml/ContributionReadException/"); + } 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("ContributionReadException", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/assembly/xml/PolicyImplValidationException.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/assembly/xml/PolicyImplValidationException.java new file mode 100644 index 0000000000..e8476991a9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/assembly/xml/PolicyImplValidationException.java @@ -0,0 +1,61 @@ +/* + * 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 assembly.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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class PolicyImplValidationException extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/assemblyxml/PolicyImplValidationException/Calculator.composite", + "TestContribution", "src/main/resources/assemblyxml/PolicyImplValidationException/"); + } 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("PolicyImplValidationException", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/assembly/xml/PolicyServiceValidationException.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/assembly/xml/PolicyServiceValidationException.java new file mode 100644 index 0000000000..8ae156d63e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/assembly/xml/PolicyServiceValidationException.java @@ -0,0 +1,61 @@ +/* + * 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 assembly.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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class PolicyServiceValidationException extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/assemblyxml/PolicyServiceValidationException/Calculator.composite", + "TestContribution", "src/main/resources/assemblyxml/PolicyServiceValidationException/"); + } 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("PolicyServiceValidationException", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/assembly/xml/UnexpectedBindingElement.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/assembly/xml/UnexpectedBindingElement.java new file mode 100644 index 0000000000..d757ff98dd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/assembly/xml/UnexpectedBindingElement.java @@ -0,0 +1,61 @@ +/* + * 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 assembly.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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class UnexpectedBindingElement extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/assemblyxml/UnexpectedBindingElement/Calculator.composite", + "TestContribution", "src/main/resources/assemblyxml/UnexpectedBindingElement/"); + } 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("UnexpectedBindingElement", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/assembly/xml/UnexpectedImplementationElement.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/assembly/xml/UnexpectedImplementationElement.java new file mode 100644 index 0000000000..9a231a18c7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/assembly/xml/UnexpectedImplementationElement.java @@ -0,0 +1,61 @@ +/* + * 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 assembly.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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class UnexpectedImplementationElement extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/assemblyxml/UnexpectedImplementationElement/Calculator.composite", + "TestContribution", "src/main/resources/assemblyxml/UnexpectedImplementationElement/"); + } 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("UnexpectedImplementationElement", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/assembly/xml/UnexpectedInterfaceElement.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/assembly/xml/UnexpectedInterfaceElement.java new file mode 100644 index 0000000000..4ae88b9ba3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/assembly/xml/UnexpectedInterfaceElement.java @@ -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 assembly.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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; +/** + * This shows how to test the Calculator service component. + */ +public class UnexpectedInterfaceElement extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/assemblyxml/UnexpectedInterfaceElement/Calculator.composite", + "TestContribution", "src/main/resources/assemblyxml/UnexpectedInterfaceElement/"); + } 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("UnexpectedInterfaceElement", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/ejb/UnknownEJBSessionTypeTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/ejb/UnknownEJBSessionTypeTestCase.java new file mode 100644 index 0000000000..1cef8a902e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/ejb/UnknownEJBSessionTypeTestCase.java @@ -0,0 +1,63 @@ +/* + * 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.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 UnknownEJBSessionTypeTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception { + System.setProperty("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory"); + System.setProperty("java.naming.provider.url", "ejbd://localhost:8085"); + System.setProperty("managed", "false"); + + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/bindingejb/UnknownEJBSessionType/account.composite", + "TestContribution", "src/main/resources/bindingejb/UnknownEJBSessionType/"); + } 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("UnknownEJBSessionType", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/ejb/UnknownEJBVersionTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/ejb/UnknownEJBVersionTestCase.java new file mode 100644 index 0000000000..bacddc93a8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/ejb/UnknownEJBVersionTestCase.java @@ -0,0 +1,63 @@ +/* + * 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.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 UnknownEJBVersionTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception { + System.setProperty("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory"); + System.setProperty("java.naming.provider.url", "ejbd://localhost:8085"); + System.setProperty("managed", "false"); + + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/bindingejb/UnknownEJBVersion/account.composite", + "TestContribution", "src/main/resources/bindingejb/UnknownEJBVersion/"); + } 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("UnknownEJBVersion", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessActivationSpecTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessActivationSpecTestCase.java new file mode 100644 index 0000000000..e0e5347d96 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessActivationSpecTestCase.java @@ -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 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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class DoesntProcessActivationSpecTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/bindingjms/DoesntProcessActivationSpec/service.composite", + "TestContribution", "src/main/resources/bindingjms/DoesntProcessActivationSpec/"); + } 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("DoesntProcessActivationSpec", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessDestinationTypeTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessDestinationTypeTestCase.java new file mode 100644 index 0000000000..9e08afec09 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessDestinationTypeTestCase.java @@ -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 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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class DoesntProcessDestinationTypeTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/bindingjms/DoesntProcessDestinationType/service.composite", + "TestContribution", "src/main/resources/bindingjms/DoesntProcessDestinationType/"); + } 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("DoesntProcessDestinationType", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessHeadersTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessHeadersTestCase.java new file mode 100644 index 0000000000..bae9656433 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessHeadersTestCase.java @@ -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 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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class DoesntProcessHeadersTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/bindingjms/DoesntProcessHeaders/service.composite", + "TestContribution", "src/main/resources/bindingjms/DoesntProcessHeaders/"); + } 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("DoesntProcessHeaders", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessResourceAdapterTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessResourceAdapterTestCase.java new file mode 100644 index 0000000000..a2a5b0b872 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessResourceAdapterTestCase.java @@ -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 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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class DoesntProcessResourceAdapterTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/bindingjms/DoesntProcessResourceAdapter/service.composite", + "TestContribution", "src/main/resources/bindingjms/DoesntProcessResourceAdapter/"); + } 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("DoesntProcessResourceAdapter", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessResponseActivationSpecTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessResponseActivationSpecTestCase.java new file mode 100644 index 0000000000..64b41623de --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessResponseActivationSpecTestCase.java @@ -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 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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class DoesntProcessResponseActivationSpecTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/bindingjms/DoesntProcessResponseActivationSpec/service.composite", + "TestContribution", "src/main/resources/bindingjms/DoesntProcessResponseActivationSpec/"); + } 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("DoesntProcessResponseActivationSpec", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessResponseConnectionFactoryTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessResponseConnectionFactoryTestCase.java new file mode 100644 index 0000000000..86fbe51dad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessResponseConnectionFactoryTestCase.java @@ -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 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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class DoesntProcessResponseConnectionFactoryTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/bindingjms/DoesntProcessResponseConnectionFactory/service.composite", + "TestContribution", "src/main/resources/bindingjms/DoesntProcessResponseConnectionFactory/"); + } 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("DoesntProcessResponseConnectionFactory", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessResponseDestinationTypeTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessResponseDestinationTypeTestCase.java new file mode 100644 index 0000000000..6e884c41cd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/DoesntProcessResponseDestinationTypeTestCase.java @@ -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 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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class DoesntProcessResponseDestinationTypeTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/bindingjms/DoesntProcessResponseDestinationType/service.composite", + "TestContribution", "src/main/resources/bindingjms/DoesntProcessResponseDestinationType/"); + } 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("DoesntProcessResponseDestinationType", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/InvalidCorrelationSchemeTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/InvalidCorrelationSchemeTestCase.java new file mode 100644 index 0000000000..c237f8af18 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/InvalidCorrelationSchemeTestCase.java @@ -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 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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class InvalidCorrelationSchemeTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/bindingjms/InvalidCorrelationScheme/service.composite", + "TestContribution", "src/main/resources/bindingjms/InvalidCorrelationScheme/"); + } 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("InvalidCorrelationScheme", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/InvalidResponseDestinationTypeTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/InvalidResponseDestinationTypeTestCase.java new file mode 100644 index 0000000000..949ec02134 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/InvalidResponseDestinationTypeTestCase.java @@ -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 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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class InvalidResponseDestinationTypeTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/bindingjms/InvalidResponseDestinationType/service.composite", + "TestContribution", "src/main/resources/bindingjms/InvalidResponseDestinationType/"); + } 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("InvalidResponseDestinationType", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/MissingActivationSpecNameTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/MissingActivationSpecNameTestCase.java new file mode 100644 index 0000000000..a974ef0db4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/MissingActivationSpecNameTestCase.java @@ -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 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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class MissingActivationSpecNameTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/bindingjms/MissingActivationSpecName/service.composite", + "TestContribution", "src/main/resources/bindingjms/MissingActivationSpecName/"); + } 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("MissingActivationSpecName", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/MissingConnectionFactoryNameTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/MissingConnectionFactoryNameTestCase.java new file mode 100644 index 0000000000..adbaa50dc0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/MissingConnectionFactoryNameTestCase.java @@ -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 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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class MissingConnectionFactoryNameTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/bindingjms/MissingConnectionFactoryName/service.composite", + "TestContribution", "src/main/resources/bindingjms/MissingConnectionFactoryName/"); + } 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("MissingConnectionFactoryName", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/MissingResponseActivationSpecTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/MissingResponseActivationSpecTestCase.java new file mode 100644 index 0000000000..4bba6b74de --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/MissingResponseActivationSpecTestCase.java @@ -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 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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class MissingResponseActivationSpecTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/bindingjms/MissingResponseActivationSpec/service.composite", + "TestContribution", "src/main/resources/bindingjms/MissingResponseActivationSpec/"); + } 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("MissingResponseActivationSpec", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/MissingResponseConnectionFactoryTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/MissingResponseConnectionFactoryTestCase.java new file mode 100644 index 0000000000..8f4fc1a739 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/MissingResponseConnectionFactoryTestCase.java @@ -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 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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class MissingResponseConnectionFactoryTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/bindingjms/MissingResponseConnectionFactory/service.composite", + "TestContribution", "src/main/resources/bindingjms/MissingResponseConnectionFactory/"); + } 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("MissingResponseConnectionFactory", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/MustStartWithSchemaTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/MustStartWithSchemaTestCase.java new file mode 100644 index 0000000000..d9e1c782a8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/MustStartWithSchemaTestCase.java @@ -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 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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class MustStartWithSchemaTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/bindingjms/MustStartWithSchema/service.composite", + "TestContribution", "src/main/resources/bindingjms/MustStartWithSchema/"); + } 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("MustStartWithSchema", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/UnexpectedElementTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/UnexpectedElementTestCase.java new file mode 100644 index 0000000000..3e4e36d839 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/UnexpectedElementTestCase.java @@ -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 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.logging.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()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/UnexpectedResponseElementTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/UnexpectedResponseElementTestCase.java new file mode 100644 index 0000000000..60ea47a85f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/UnexpectedResponseElementTestCase.java @@ -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 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.logging.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()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/UnknownTokenInURITestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/UnknownTokenInURITestCase.java new file mode 100644 index 0000000000..6a75a35f99 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/jms/UnknownTokenInURITestCase.java @@ -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 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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class UnknownTokenInURITestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/bindingjms/UnknownTokenInURI/service.composite", + "TestContribution", "src/main/resources/bindingjms/UnknownTokenInURI/"); + } 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("UnknownTokenInURI", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/wsxml/InvalidWsdlElementAttrTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/wsxml/InvalidWsdlElementAttrTestCase.java new file mode 100644 index 0000000000..c0f60a848f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/wsxml/InvalidWsdlElementAttrTestCase.java @@ -0,0 +1,61 @@ +/* + * 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.wsxml; + +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 InvalidWsdlElementAttrTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/binding/wsxml/InvalidWsdlElementAttr/Calculator.composite", + "TestContribution", "src/main/resources/binding/wsxml/InvalidWsdlElementAttr/"); + } 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("InvalidWsdlElementAttr", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/wsxml/MustUseWsdlBindingTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/wsxml/MustUseWsdlBindingTestCase.java new file mode 100644 index 0000000000..5a74194796 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/wsxml/MustUseWsdlBindingTestCase.java @@ -0,0 +1,61 @@ +/* + * 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.wsxml; + +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 MustUseWsdlBindingTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/binding/wsxml/MustUseWsdlBinding/Calculator.composite", + "TestContribution", "src/main/resources/binding/wsxml/MustUseWsdlBinding/"); + } 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("MustUseWsdlBinding", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/wsxml/WsdlBindingDoesNotMatchTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/wsxml/WsdlBindingDoesNotMatchTestCase.java new file mode 100644 index 0000000000..7991de7176 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/wsxml/WsdlBindingDoesNotMatchTestCase.java @@ -0,0 +1,61 @@ +/* + * 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.wsxml; + +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 WsdlBindingDoesNotMatchTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/binding/wsxml/WsdlBindingDoesNotMatch/helloworldwsjms.composite", + "TestContribution", "src/main/resources/binding/wsxml/WsdlBindingDoesNotMatch/"); + } 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("WsdlBindingDoesNotMatch", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/wsxml/WsdlServiceDoesNotMatchTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/wsxml/WsdlServiceDoesNotMatchTestCase.java new file mode 100644 index 0000000000..a0a7d12b9f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/binding/wsxml/WsdlServiceDoesNotMatchTestCase.java @@ -0,0 +1,61 @@ +/* + * 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.wsxml; + +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 WsdlServiceDoesNotMatchTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/binding/wsxml/WsdlServiceDoesNotMatch/helloworldwsjms.composite", + "TestContribution", "src/main/resources/binding/wsxml/WsdlServiceDoesNotMatch/"); + } 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("WsdlServiceDoesNotMatch", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ComponentReferenceTargetNotFoundTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ComponentReferenceTargetNotFoundTestCase.java new file mode 100644 index 0000000000..84c77ae297 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ComponentReferenceTargetNotFoundTestCase.java @@ -0,0 +1,77 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class ComponentReferenceTargetNotFoundTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/ComponentReferenceTargetNotFound/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/ComponentReferenceTargetNotFound").toURL().toString())); + + try { + node.start(); + } catch (Exception ex){ + // do nothing - the SCA binding throws and exception here + // because the interface for the reference is not remotable + } + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("ComponentReferenceTargetNotFound", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/DuplicateComponentNameTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/DuplicateComponentNameTestCase.java new file mode 100644 index 0000000000..ff1bd6cb09 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/DuplicateComponentNameTestCase.java @@ -0,0 +1,74 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class DuplicateComponentNameTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/DuplicateComponentName/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/DuplicateComponentName").toURL().toString())); + /* + node = SCANode2Factory.createSCANodeWithComposite("DuplicateComponentName/Calculator.composite"); + */ + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("DuplicateComponentName", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/DuplicateImplementationPropertyNameTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/DuplicateImplementationPropertyNameTestCase.java new file mode 100644 index 0000000000..65dab38ee3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/DuplicateImplementationPropertyNameTestCase.java @@ -0,0 +1,65 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class DuplicateImplementationPropertyNameTestCase extends TestCase { + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/DuplicateImplementationPropertyName/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/DuplicateImplementationPropertyName").toURL().toString())); + } + + @Override + protected void tearDown() throws Exception { + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("DuplicateImplementationPropertyName", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/DuplicateImplementationReferenceNameTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/DuplicateImplementationReferenceNameTestCase.java new file mode 100644 index 0000000000..6c10d1279c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/DuplicateImplementationReferenceNameTestCase.java @@ -0,0 +1,66 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class DuplicateImplementationReferenceNameTestCase extends TestCase { + + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/DuplicateImplementationReferenceName/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/DuplicateImplementationReferenceName").toURL().toString())); + } + + @Override + protected void tearDown() throws Exception { + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("DuplicateImplementationReferenceName", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/DuplicatePropertyNameTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/DuplicatePropertyNameTestCase.java new file mode 100644 index 0000000000..4531564ccb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/DuplicatePropertyNameTestCase.java @@ -0,0 +1,71 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class DuplicatePropertyNameTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/DuplicatePropertyName/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/DuplicatePropertyName").toURL().toString())); + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("DuplicateComponentPropertyName", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/DuplicateReferenceNameTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/DuplicateReferenceNameTestCase.java new file mode 100644 index 0000000000..3b024c58c7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/DuplicateReferenceNameTestCase.java @@ -0,0 +1,71 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class DuplicateReferenceNameTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/DuplicateReferenceName/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/DuplicateReferenceName").toURL().toString())); + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("DuplicateComponentReferenceName", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/MultipleBindingsForServiceTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/MultipleBindingsForServiceTestCase.java new file mode 100644 index 0000000000..4f54b023f4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/MultipleBindingsForServiceTestCase.java @@ -0,0 +1,71 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class MultipleBindingsForServiceTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/MultipleBindingsForService/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/MultipleBindingsForService").toURL().toString())); + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("MultipleBindingsForService", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/NoComponentImplementationTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/NoComponentImplementationTestCase.java new file mode 100644 index 0000000000..14af754860 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/NoComponentImplementationTestCase.java @@ -0,0 +1,67 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class NoComponentImplementationTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/NoComponentImplementation/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/NoComponentImplementation").toURL().toString())); + } + + @Override + protected void tearDown() throws Exception { + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("NoComponentImplementation", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/NoCompositeNamespaceTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/NoCompositeNamespaceTestCase.java new file mode 100644 index 0000000000..2f2e87f9af --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/NoCompositeNamespaceTestCase.java @@ -0,0 +1,71 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class NoCompositeNamespaceTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/NoCompositeNamespace/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/NoCompositeNamespace").toURL().toString())); + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("NoCompositeNamespace", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/NoMatchingBindingTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/NoMatchingBindingTestCase.java new file mode 100644 index 0000000000..eb1f514240 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/NoMatchingBindingTestCase.java @@ -0,0 +1,74 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; + +/** + * This shows how to test the Calculator service component. + */ +public class NoMatchingBindingTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + try { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/NoMatchingBinding/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/NoMatchingBinding").toURL().toString())); + + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } catch (Exception ex){ + // do nothing + return; + } + Assert.fail(); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + /* + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("NoMatchingBinding", problem.getMessageId()); + */ + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/PromotedReferenceNotFoundTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/PromotedReferenceNotFoundTestCase.java new file mode 100644 index 0000000000..07c75decbc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/PromotedReferenceNotFoundTestCase.java @@ -0,0 +1,71 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class PromotedReferenceNotFoundTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/PromotedReferenceNotFound/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/PromotedReferenceNotFound").toURL().toString())); + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("PromotedReferenceNotFound", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/PromotedServiceNotFoundTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/PromotedServiceNotFoundTestCase.java new file mode 100644 index 0000000000..26c988c1c1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/PromotedServiceNotFoundTestCase.java @@ -0,0 +1,71 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class PromotedServiceNotFoundTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/PromotedServiceNotFound/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/PromotedServiceNotFound").toURL().toString())); + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("PromotedServiceNotFound", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/PropertyAttributeMustSupplyNullTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/PropertyAttributeMustSupplyNullTestCase.java new file mode 100644 index 0000000000..3753fc278c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/PropertyAttributeMustSupplyNullTestCase.java @@ -0,0 +1,71 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class PropertyAttributeMustSupplyNullTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/PropertyAttribute/CalculatorNullMustSupply.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/PropertyAttribute").toURL().toString())); + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("PropertyMustSupplyNull", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/PropertyAttributeTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/PropertyAttributeTestCase.java new file mode 100644 index 0000000000..08e5a9861b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/PropertyAttributeTestCase.java @@ -0,0 +1,71 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class PropertyAttributeTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/PropertyAttribute/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/PropertyAttribute").toURL().toString())); + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("PropertyMustSupplyIncompatible", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/PropertyNotFoundTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/PropertyNotFoundTestCase.java new file mode 100644 index 0000000000..4af2675c09 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/PropertyNotFoundTestCase.java @@ -0,0 +1,71 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class PropertyNotFoundTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/PropertyNotFound/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/PropertyNotFound").toURL().toString())); + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("PropertyNotFound", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/PropertyOverrideManyAttributeTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/PropertyOverrideManyAttributeTestCase.java new file mode 100644 index 0000000000..11fde0a73d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/PropertyOverrideManyAttributeTestCase.java @@ -0,0 +1,71 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class PropertyOverrideManyAttributeTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/PropertyAttribute/CalculatorOverrideManyAttribute.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/PropertyAttribute").toURL().toString())); + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("PropertyOverrideManyAttribute", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleComponentInterfaceTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleComponentInterfaceTestCase.java new file mode 100644 index 0000000000..19b04e6940 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleComponentInterfaceTestCase.java @@ -0,0 +1,71 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class ReferenceIncompatibleComponentInterfaceTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/ReferenceIncompatibleComponentInterface/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/ReferenceIncompatibleComponentInterface").toURL().toString())); + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("ReferenceIncompatibleComponentInterface", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleInterfaceTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleInterfaceTestCase.java new file mode 100644 index 0000000000..3180539898 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleInterfaceTestCase.java @@ -0,0 +1,71 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class ReferenceIncompatibleInterfaceTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/ReferenceIncompatibleInterface/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/ReferenceIncompatibleInterface").toURL().toString())); + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("ReferenceIncompatibleInterface", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleMultiplicityTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleMultiplicityTestCase.java new file mode 100644 index 0000000000..87ae0f0e3c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleMultiplicityTestCase.java @@ -0,0 +1,71 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class ReferenceIncompatibleMultiplicityTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/ReferenceIncompatibleMultiplicity/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/ReferenceIncompatibleMultiplicity").toURL().toString())); + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("ReferenceIncompatibleMultiplicity", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ReferenceNotFoundTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ReferenceNotFoundTestCase.java new file mode 100644 index 0000000000..4856ba507f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ReferenceNotFoundTestCase.java @@ -0,0 +1,71 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class ReferenceNotFoundTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/ReferenceNotFound/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/ReferenceNotFound").toURL().toString())); + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("ReferenceNotFound", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ReferenceWithoutTargetsTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ReferenceWithoutTargetsTestCase.java new file mode 100644 index 0000000000..f456ae40af --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ReferenceWithoutTargetsTestCase.java @@ -0,0 +1,71 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class ReferenceWithoutTargetsTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/ReferenceWithoutTargets/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/ReferenceWithoutTargets").toURL().toString())); + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("ReferenceWithoutTargets", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ServiceNotFoundForComponentServiceTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ServiceNotFoundForComponentServiceTestCase.java new file mode 100644 index 0000000000..51adc22848 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/ServiceNotFoundForComponentServiceTestCase.java @@ -0,0 +1,71 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class ServiceNotFoundForComponentServiceTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/ServiceNotFoundForComponentService/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/ServiceNotFoundForComponentService").toURL().toString())); + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("ServiceNotFoundForComponentService", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/UnresolvedComponentImplementationTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/UnresolvedComponentImplementationTestCase.java new file mode 100644 index 0000000000..918108c275 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/UnresolvedComponentImplementationTestCase.java @@ -0,0 +1,67 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + +/** + * This shows how to test the Calculator service component. + */ +public class UnresolvedComponentImplementationTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/UnresolvedComponentImplementation/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/UnresolvedComponentImplementation").toURL().toString())); + } + + @Override + protected void tearDown() throws Exception { + } + + public void testCalculator() throws Exception { + ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("UnresolvedComponentImplementation", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/XSDValidationTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/XSDValidationTestCase.java new file mode 100644 index 0000000000..93edfa2e21 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/calculator/warning/XSDValidationTestCase.java @@ -0,0 +1,67 @@ +/* + * 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 calculator.warning; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; + +/** + * This shows how to test the Calculator service component. + */ +public class XSDValidationTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCANode2 node; + private Exception startUpException; + + @Override + protected void setUp() throws Exception { + SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); + try { + node = nodeFactory.createSCANode(new File("src/main/resources/XsdValidation/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/XsdValidation").toURL().toString())); + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } catch (Exception ex){ + startUpException = ex; + } + } + + @Override + protected void tearDown() throws Exception { + if (node != null){ + node.stop(); + } + } + + + public void testCalculator() throws Exception { + + assertEquals("org.osoa.sca.ServiceRuntimeException: Unexpected <binding> element found. It should appear inside a <service> or <reference> element.", startUpException.getMessage()); + + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/contribution/java/AttributePackageMissingTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/contribution/java/AttributePackageMissingTestCase.java new file mode 100644 index 0000000000..04135ab2cc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/contribution/java/AttributePackageMissingTestCase.java @@ -0,0 +1,61 @@ +/* + * 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 contribution.java; + +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 AttributePackageMissingTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/contribution/java/AttributePackageMissing/Calculator.composite", + "TestContribution", "src/main/resources/contribution/java/AttributePackageMissing/"); + } 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("AttributePackageMissing", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/contribution/namespace/AttributeNameSpaceMissingTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/contribution/namespace/AttributeNameSpaceMissingTestCase.java new file mode 100644 index 0000000000..ab0afc6f65 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/contribution/namespace/AttributeNameSpaceMissingTestCase.java @@ -0,0 +1,61 @@ +/* + * 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 contribution.namespace; + +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 AttributeNameSpaceMissingTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/contribution/namespace/AttributeNameSpaceMissing/Calculator.composite", + "TestContribution", "src/main/resources/contribution/namespace/AttributeNameSpaceMissing/"); + } 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("AttributeNameSpaceMissing", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/contribution/resource/AttributeURIMissingTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/contribution/resource/AttributeURIMissingTestCase.java new file mode 100644 index 0000000000..a1b42bf815 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/contribution/resource/AttributeURIMissingTestCase.java @@ -0,0 +1,61 @@ +/* + * 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 contribution.resource; + +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 AttributeURIMissingTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/contribution/resource/AttributeURIMissing/Calculator.composite", + "TestContribution", "src/main/resources/contribution/resource/AttributeURIMissing/"); + } 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("AttributeURIMissing", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/contribution/xml/AttributeCompositeMissingTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/contribution/xml/AttributeCompositeMissingTestCase.java new file mode 100644 index 0000000000..32c1a8b3a8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/contribution/xml/AttributeCompositeMissingTestCase.java @@ -0,0 +1,61 @@ +/* + * 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 contribution.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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class AttributeCompositeMissingTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/contribution/xml/AttributeCompositeMissing/Calculator.composite", + "TestContribution", "src/main/resources/contribution/xml/AttributeCompositeMissing/"); + } 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("AttributeCompositeMissing", problem.getMessageId()); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/domain/CustomCompositeBuilder.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/domain/CustomCompositeBuilder.java new file mode 100644 index 0000000000..9ad5407ed6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/domain/CustomCompositeBuilder.java @@ -0,0 +1,207 @@ +/* + * 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 domain; + +import java.io.File; +import java.net.URI; +import java.net.URL; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLOutputFactory; + +import org.apache.tuscany.sca.assembly.AssemblyFactory; +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.contribution.Contribution; +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; +import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver; +import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint; +import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +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.definitions.SCADefinitions; +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.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory; +import org.apache.tuscany.sca.workspace.Workspace; +import org.apache.tuscany.sca.workspace.WorkspaceFactory; +import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder; +import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl; + +public class CustomCompositeBuilder { + private URLArtifactProcessor<Contribution> contributionProcessor; + private ModelResolverExtensionPoint modelResolvers; + private ModelFactoryExtensionPoint modelFactories; + private WorkspaceFactory workspaceFactory; + private AssemblyFactory assemblyFactory; + private XMLOutputFactory outputFactory; + private StAXArtifactProcessor<Object> xmlProcessor; + private ContributionDependencyBuilder contributionDependencyBuilder; + private CompositeBuilder domainCompositeBuilder; + private CompositeBuilder nodeCompositeBuilder; + private NodeImplementationFactory nodeFactory; + //private AtomBindingFactory atomBindingFactory; + private static Workspace workspace; + private List<SCADefinitions> policyDefinitions; + private Monitor monitor; + + private CustomCompositeBuilder() { + // no code req'd + } + + public static CustomCompositeBuilder getInstance() + { + if (ref == null) + ref = new CustomCompositeBuilder(); + return ref; + } + + private static CustomCompositeBuilder ref; + + 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(); + + // Initialize the Tuscany module activators + ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class); + for (ModuleActivator activator: moduleActivators.getModuleActivators()) { + activator.start(extensionPoints); + } + + // Get XML input/output factories + modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); + outputFactory = modelFactories.getFactory(XMLOutputFactory.class); + + // Get contribution workspace and assembly model factories + workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class); + assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); + nodeFactory = modelFactories.getFactory(NodeImplementationFactory.class); + //atomBindingFactory = modelFactories.getFactory(AtomBindingFactory.class); + + // Create XML artifact processors + StAXArtifactProcessorExtensionPoint xmlProcessorExtensions = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); + xmlProcessor = new ExtensibleStAXArtifactProcessor(xmlProcessorExtensions, inputFactory, outputFactory, monitor); + + // Create contribution content processor + URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); + contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class); + + // Get the model resolvers + modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class); + + // Create a contribution dependency builder + contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor); + + // Create a composite builder + SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class); + 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 { + init(); + + // Create workspace model + workspace = workspaceFactory.createWorkspace(); + workspace.setModelResolver(new ExtensibleModelResolver(workspace, modelResolvers, modelFactories)); + + // Read the sample store contribution + URI artifactURI = URI.create(sourceURI); + //URL contributionURL = FileHelper.toFile(new URL(sourceURL)).toURI().toURL(); + URL artifactURL = new File(sourceURL).toURI().toURL(); + URL contributionURL = new File(compositeURL).toURI().toURL(); + Contribution storeContribution = contributionProcessor.read(contributionURL, artifactURI, artifactURL); + workspace.getContributions().add(storeContribution); + + // Build the contribution dependencies + Map<Contribution, List<Contribution>> contributionDependencies = new HashMap<Contribution, List<Contribution>>(); + Set<Contribution> resolved = new HashSet<Contribution>(); + for (Contribution contribution: workspace.getContributions()) { + List<Contribution> dependencies = contributionDependencyBuilder.buildContributionDependencies(contribution, workspace); + + // Resolve contributions + for (Contribution dependency: dependencies) { + if (!resolved.contains(dependency)) { + resolved.add(dependency); + contributionProcessor.resolve(dependency, workspace.getModelResolver()); + } + } + + contributionDependencies.put(contribution, dependencies); + } + + // Create a composite model for the domain + /*Composite domainComposite = assemblyFactory.createComposite(); + domainComposite.setName(new QName(Constants.SCA10_NS, "domain")); + + // Add all deployables to it, normally the domain administrator would select + // the deployables to include + domainComposite.getIncludes().addAll(workspace.getDeployables()); + + // Build the domain composite and wire the components included in it + domainCompositeBuilder.build(domainComposite);*/ + } + + public Monitor getMonitorInstance() { + return monitor; + } + + public void readContribution(String compositeURL, String sourceURI, String sourceURL) throws Exception { + init(); + + // Create workspace model + workspace = workspaceFactory.createWorkspace(); + workspace.setModelResolver(new ExtensibleModelResolver(workspace, modelResolvers, modelFactories)); + + // Read the sample store contribution + URI artifactURI = URI.create(sourceURI); + //URL contributionURL = FileHelper.toFile(new URL(sourceURL)).toURI().toURL(); + URL artifactURL = new File(sourceURL).toURI().toURL(); + URL contributionURL = new File(compositeURL).toURI().toURL(); + Contribution storeContribution = contributionProcessor.read(contributionURL, artifactURI, artifactURL); + workspace.getContributions().add(storeContribution); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/AttributeUnrecognizedNamespaceTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/AttributeUnrecognizedNamespaceTestCase.java new file mode 100644 index 0000000000..9d97e3611a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/AttributeUnrecognizedNamespaceTestCase.java @@ -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.bpel; + +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 AttributeUnrecognizedNamespaceTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/bpel/AttributeUnrecognizedNamespace/helloworld.composite", + "TestContribution", "src/main/resources/impl/bpel/AttributeUnrecognizedNamespace/"); + } 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("AttributeUnrecognizedNamespace", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/AttributeWithoutNamespaceTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/AttributeWithoutNamespaceTestCase.java new file mode 100644 index 0000000000..80c15dc444 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/AttributeWithoutNamespaceTestCase.java @@ -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.bpel; + +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 AttributeWithoutNamespaceTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/bpel/AttributeWithoutNamespace/helloworld.composite", + "TestContribution", "src/main/resources/impl/bpel/AttributeWithoutNamespace/"); + } 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("AttributeWithoutNamespace", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/BPELProcessNotFoundTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/BPELProcessNotFoundTestCase.java new file mode 100644 index 0000000000..81e8aecfeb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/BPELProcessNotFoundTestCase.java @@ -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.bpel; + +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 BPELProcessNotFoundTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/bpel/BPELProcessNotFound/helloworld.composite", + "TestContribution", "src/main/resources/impl/bpel/BPELProcessNotFound/"); + } 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("BPELProcessNotFound", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/CannotResolveWSDLReferenceTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/CannotResolveWSDLReferenceTestCase.java new file mode 100644 index 0000000000..fb0c525aea --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/CannotResolveWSDLReferenceTestCase.java @@ -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.bpel; + +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 CannotResolveWSDLReferenceTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/bpel/CannotResolveWSDLReference/helloworld.composite", + "TestContribution", "src/main/resources/impl/bpel/CannotResolveWSDLReference/"); + } 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("CannotResolveWSDLReference", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/MyRolePartnerRoleNullTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/MyRolePartnerRoleNullTestCase.java new file mode 100644 index 0000000000..445629457e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/MyRolePartnerRoleNullTestCase.java @@ -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.bpel; + +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 MyRolePartnerRoleNullTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/bpel/MyRolePartnerRoleNull/helloworld.composite", + "TestContribution", "src/main/resources/impl/bpel/MyRolePartnerRoleNull/"); + } 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("MyRolePartnerRoleNull", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/PartnerLinkHasBothAttrTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/PartnerLinkHasBothAttrTestCase.java new file mode 100644 index 0000000000..00b904ae65 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/PartnerLinkHasBothAttrTestCase.java @@ -0,0 +1,59 @@ +/* + * 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.bpel; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class PartnerLinkHasBothAttrTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/bpel/PartnerLinkHasBothAttr/helloworld.composite", + "TestContribution", "src/main/resources/impl/bpel/PartnerLinkHasBothAttr/"); + } catch (Exception ex){ + //throw ex; + } + } + + @Override + protected void tearDown() throws Exception { + //nothing to do + } + + public void testCalculator() { + Monitor monitor = customDomain.getMonitorInstance(); + assertTrue(((DefaultLoggingMonitorImpl)monitor).isMessageLogged("PartnerLinkHasBothAttr")); + /*Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + assertNotNull(problem); + assertEquals("PartnerLinkHasBothAttr", problem.getMessageId());*/ + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/PartnerLinkNoMatchingTypeTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/PartnerLinkNoMatchingTypeTestCase.java new file mode 100644 index 0000000000..b7a4ee6fef --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/PartnerLinkNoMatchingTypeTestCase.java @@ -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.bpel; + +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 PartnerLinkNoMatchingTypeTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/bpel/PartnerLinkNoMatchingType/helloworld.composite", + "TestContribution", "src/main/resources/impl/bpel/PartnerLinkNoMatchingType/"); + } 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("PartnerLinkNoMatchingType", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/PartnerLinkTypeNoRolesTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/PartnerLinkTypeNoRolesTestCase.java new file mode 100644 index 0000000000..32d3211f36 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/bpel/PartnerLinkTypeNoRolesTestCase.java @@ -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.bpel; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class PartnerLinkTypeNoRolesTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/helloworld.composite", + "TestContribution", "src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/"); + } catch (Exception ex){ + //throw ex; + } + } + + @Override + protected void tearDown() throws Exception { + //nothing to do + } + + public void testCalculator() { + Monitor monitor = customDomain.getMonitorInstance(); + assertTrue(((DefaultLoggingMonitorImpl)monitor).isMessageLogged("PartnerLinkTypeNoRoles")); + /*Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + assertNotNull(problem); + assertEquals("PartnerLinkTypeNoRoles", problem.getMessageId());*/ + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/java/ClassNotFoundExceptionTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/java/ClassNotFoundExceptionTestCase.java new file mode 100644 index 0000000000..3a7745722a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/java/ClassNotFoundExceptionTestCase.java @@ -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.java; + +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 ClassNotFoundExceptionTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/java/ClassNotFoundException/Calculator.composite", + "TestContribution", "src/main/resources/impl/java/ClassNotFoundException/"); + } 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("ClassNotFoundException", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/java/ContributionResolveExceptionTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/java/ContributionResolveExceptionTestCase.java new file mode 100644 index 0000000000..59fc3ce79c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/java/ContributionResolveExceptionTestCase.java @@ -0,0 +1,61 @@ +/* + * 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.java; + +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 ContributionResolveExceptionTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/java/ContributionResolveException/Calculator.composite", + "TestContribution", "src/main/resources/impl/java/ContributionResolveException/"); + } 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("ContributionResolveException", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/osgi/CouldNotLocateOSGiBundleTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/osgi/CouldNotLocateOSGiBundleTestCase.java new file mode 100644 index 0000000000..6f54ad140c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/osgi/CouldNotLocateOSGiBundleTestCase.java @@ -0,0 +1,64 @@ +/* + * 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.logging.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()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/osgi/MissingComponentTypeFileTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/osgi/MissingComponentTypeFileTestCase.java new file mode 100644 index 0000000000..3d75fa8ccc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/osgi/MissingComponentTypeFileTestCase.java @@ -0,0 +1,64 @@ +/* + * 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.logging.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()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/osgi/OSGiTestBundles.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/osgi/OSGiTestBundles.java new file mode 100644 index 0000000000..398c028dd8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/osgi/OSGiTestBundles.java @@ -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(); + + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/osgi/PropertyShouldSpecifySRTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/osgi/PropertyShouldSpecifySRTestCase.java new file mode 100644 index 0000000000..117a94337a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/osgi/PropertyShouldSpecifySRTestCase.java @@ -0,0 +1,64 @@ +/* + * 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.logging.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()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/resource/CouldNotResolveLocationTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/resource/CouldNotResolveLocationTestCase.java new file mode 100644 index 0000000000..14ba8e992e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/resource/CouldNotResolveLocationTestCase.java @@ -0,0 +1,59 @@ +/* + * 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.resource; + +import junit.framework.Assert; +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 CouldNotResolveLocationTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/resource/CouldNotResolveLocation/resource.composite", + "TestContribution", "src/main/resources/impl/resource/CouldNotResolveLocation/"); + } catch (Exception ex){ + //throw ex; + } + } + + protected void tearDown() throws Exception { + //nothing to do + } + + public void testCalculator() { + Monitor monitor = customDomain.getMonitorInstance(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + Assert.assertNotNull(problem); + Assert.assertEquals("CouldNotResolveLocation", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/resource/LocationAttributeMissingTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/resource/LocationAttributeMissingTestCase.java new file mode 100644 index 0000000000..461895f824 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/resource/LocationAttributeMissingTestCase.java @@ -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.resource; + +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 LocationAttributeMissingTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/resource/LocationAttributeMissing/resource.composite", + "TestContribution", "src/main/resources/impl/resource/LocationAttributeMissing/"); + } 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("LocationAttributeMissing", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/spring/ContributionResolveExceptionTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/spring/ContributionResolveExceptionTestCase.java new file mode 100644 index 0000000000..9b7dbef3dd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/spring/ContributionResolveExceptionTestCase.java @@ -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 impl.spring; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class ContributionResolveExceptionTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/spring/ContributionResolveException/SpringHelloWorld.composite", + "TestContribution", "src/main/resources/impl/spring/ContributionResolveException/"); + } catch (Exception ex){ + //throw ex; + } + } + + @Override + protected void tearDown() throws Exception { + //node.stop(); + } + + public void testCalculator() { + Monitor monitor = customDomain.getMonitorInstance(); + assertTrue(((DefaultLoggingMonitorImpl)monitor).isMessageLogged("ContributionResolveException")); + //assertEquals("ContributionResolveException", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/spring/LocationAttributeMissingTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/spring/LocationAttributeMissingTestCase.java new file mode 100644 index 0000000000..cd38b53f66 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/spring/LocationAttributeMissingTestCase.java @@ -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.spring; + +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 LocationAttributeMissingTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/spring/LocationAttributeMissing/SpringHelloWorld.composite", + "TestContribution", "src/main/resources/impl/spring/LocationAttributeMissing/"); + } 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("LocationAttributeMissing", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/spring/UnableToResolveComponentTypeTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/spring/UnableToResolveComponentTypeTestCase.java new file mode 100644 index 0000000000..83550ae58d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/spring/UnableToResolveComponentTypeTestCase.java @@ -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.spring; + +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 UnableToResolveComponentTypeTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/spring/UnableToResolveComponentType/SpringHelloWorld.composite", + "TestContribution", "src/main/resources/impl/spring/UnableToResolveComponentType/"); + } 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("UnableToResolveComponentType", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/widget/CouldNotResolveLocationTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/widget/CouldNotResolveLocationTestCase.java new file mode 100644 index 0000000000..d098bb4bf8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/widget/CouldNotResolveLocationTestCase.java @@ -0,0 +1,59 @@ +/* + * 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.widget; + +import junit.framework.Assert; +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 CouldNotResolveLocationTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/widget/CouldNotResolveLocation/widget.composite", + "TestContribution", "src/main/resources/impl/widget/CouldNotResolveLocation/"); + } catch (Exception ex){ + //throw ex; + } + } + + protected void tearDown() throws Exception { + //nothing to do + } + + public void testCalculator() { + Monitor monitor = customDomain.getMonitorInstance(); + Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + + Assert.assertNotNull(problem); + Assert.assertEquals("CouldNotResolveLocation", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/widget/LocationAttributeMissingTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/widget/LocationAttributeMissingTestCase.java new file mode 100644 index 0000000000..2f85d8ed4a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/widget/LocationAttributeMissingTestCase.java @@ -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.widget; + +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 LocationAttributeMissingTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/widget/LocationAttributeMissing/widget.composite", + "TestContribution", "src/main/resources/impl/widget/LocationAttributeMissing/"); + } 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("LocationAttributeMissing", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/xquery/CouldNotLocateFileTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/xquery/CouldNotLocateFileTestCase.java new file mode 100644 index 0000000000..f90fc3b83f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/xquery/CouldNotLocateFileTestCase.java @@ -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.xquery; + +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 CouldNotLocateFileTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/xquery/CouldNotLocateFile/HelloWorld.composite", + "TestContribution", "src/main/resources/impl/xquery/CouldNotLocateFile/"); + } 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("CouldNotLocateFile", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/xquery/LocationAttributeMissingTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/xquery/LocationAttributeMissingTestCase.java new file mode 100644 index 0000000000..01450a8836 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/impl/xquery/LocationAttributeMissingTestCase.java @@ -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.xquery; + +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 LocationAttributeMissingTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/xquery/LocationAttributeMissing/HelloWorld.composite", + "TestContribution", "src/main/resources/impl/xquery/LocationAttributeMissing/"); + } 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("LocationAttributeMissing", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/interfacejava/xml/ClassNotFoundTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/interfacejava/xml/ClassNotFoundTestCase.java new file mode 100644 index 0000000000..a03e056298 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/interfacejava/xml/ClassNotFoundTestCase.java @@ -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 interfacejava.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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class ClassNotFoundTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/interfacejava/xml/ClassNotFoundException/Calculator.composite", + "TestContribution", "src/main/resources/interfacejava/xml/ClassNotFoundException/"); + } 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("ClassNotFoundException", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/interfacejava/xml/ContributionResolveExceptionTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/interfacejava/xml/ContributionResolveExceptionTestCase.java new file mode 100644 index 0000000000..e0524f57b7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/interfacejava/xml/ContributionResolveExceptionTestCase.java @@ -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 interfacejava.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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class ContributionResolveExceptionTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/interfacejava/xml/ContributionResolveException/Calculator.composite", + "TestContribution", "src/main/resources/interfacejava/xml/ContributionResolveException/"); + } 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("ContributionResolveException", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/interfacewsdl/xml/InvalidWSDLInterfaceAttrTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/interfacewsdl/xml/InvalidWSDLInterfaceAttrTestCase.java new file mode 100644 index 0000000000..e212477c61 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/interfacewsdl/xml/InvalidWSDLInterfaceAttrTestCase.java @@ -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 interfacewsdl.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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class InvalidWSDLInterfaceAttrTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/interfacewsdl/xml/InvalidWSDLInterfaceAttr/Calculator.composite", + "TestContribution", "src/main/resources/interfacewsdl/xml/InvalidWSDLInterfaceAttr/"); + } 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("InvalidWSDLInterfaceAttr", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/interfacewsdl/xml/WsdlInterfaceDoesNotMatchTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/interfacewsdl/xml/WsdlInterfaceDoesNotMatchTestCase.java new file mode 100644 index 0000000000..df2a2671df --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/interfacewsdl/xml/WsdlInterfaceDoesNotMatchTestCase.java @@ -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 interfacewsdl.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.logging.impl.DefaultLoggingMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class WsdlInterfaceDoesNotMatchTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/interfacewsdl/xml/WsdlInterfaceDoesNotMatch/helloworldwsjms.composite", + "TestContribution", "src/main/resources/interfacewsdl/xml/WsdlInterfaceDoesNotMatch/"); + } 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("WsdlInterfaceDoesNotMatch", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/AlwaysProvidedIntentNotFoundTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/AlwaysProvidedIntentNotFoundTestCase.java new file mode 100644 index 0000000000..361e2f2bfb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/AlwaysProvidedIntentNotFoundTestCase.java @@ -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 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.logging.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()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/ErrorInPolicyIntentDefinitionTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/ErrorInPolicyIntentDefinitionTestCase.java new file mode 100644 index 0000000000..a85dc334f4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/ErrorInPolicyIntentDefinitionTestCase.java @@ -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 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.logging.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()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/IntentNotSpecifiedTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/IntentNotSpecifiedTestCase.java new file mode 100644 index 0000000000..3f98757ce5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/IntentNotSpecifiedTestCase.java @@ -0,0 +1,59 @@ +/* + * 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.logging.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(); + assertTrue(((DefaultLoggingMonitorImpl)monitor).isMessageLogged("IntentNotSpecified")); + /*Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + assertNotNull(problem); + assertEquals("IntentNotSpecified", problem.getMessageId());*/ + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/MayProvideIntentNotFoundTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/MayProvideIntentNotFoundTestCase.java new file mode 100644 index 0000000000..3b8d075165 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/MayProvideIntentNotFoundTestCase.java @@ -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 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.logging.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()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/RequiredAttributeMissingTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/RequiredAttributeMissingTestCase.java new file mode 100644 index 0000000000..bcf1f82392 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/RequiredAttributeMissingTestCase.java @@ -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 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.logging.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()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/UnableToMapPoliciesTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/UnableToMapPoliciesTestCase.java new file mode 100644 index 0000000000..2a767d3550 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/UnableToMapPoliciesTestCase.java @@ -0,0 +1,59 @@ +/* + * 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.logging.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(); + assertTrue(((DefaultLoggingMonitorImpl)monitor).isMessageLogged("UnableToMapPolicies")); + /*Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem(); + assertNotNull(problem); + assertEquals("UnableToMapPolicies", problem.getMessageId());*/ + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/UnrecognizedIntentAttachPointTypeTestCase.java b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/UnrecognizedIntentAttachPointTypeTestCase.java new file mode 100644 index 0000000000..eec39d711e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/itest/validation/src/test/java/policy/xml/UnrecognizedIntentAttachPointTypeTestCase.java @@ -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 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.logging.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()); + } +} |