From 4ef0430519e276c2bdecea75f7a0f42f49f0cf30 Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 11 Nov 2009 23:08:37 +0000 Subject: Moving 1.x branches git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835132 13f79535-47bb-0310-9956-ffa450edef68 --- .../AttributeUnrecognizedNamespaceTestCase.java | 61 +++++++++++ .../bpel/AttributeWithoutNamespaceTestCase.java | 60 +++++++++++ .../impl/bpel/BPELProcessNotFoundTestCase.java | 60 +++++++++++ .../bpel/CannotResolveWSDLReferenceTestCase.java | 62 ++++++++++++ .../impl/bpel/MyRolePartnerRoleNullTestCase.java | 60 +++++++++++ .../impl/bpel/PartnerLinkHasBothAttrTestCase.java | 59 +++++++++++ .../bpel/PartnerLinkNoMatchingTypeTestCase.java | 61 +++++++++++ .../impl/bpel/PartnerLinkTypeNoRolesTestCase.java | 61 +++++++++++ .../impl/ejb/EJBLinkAttributeMissingTestCase.java | 60 +++++++++++ .../impl/java/ClassNotFoundExceptionTestCase.java | 60 +++++++++++ .../java/ContributionResolveExceptionTestCase.java | 61 +++++++++++ .../osgi/CouldNotLocateOSGiBundleTestCase.java | 64 ++++++++++++ .../osgi/MissingComponentTypeFileTestCase.java | 66 ++++++++++++ .../src/test/java/impl/osgi/OSGiTestBundles.java | 111 +++++++++++++++++++++ .../impl/osgi/PropertyShouldSpecifySRTestCase.java | 64 ++++++++++++ .../resource/CouldNotResolveLocationTestCase.java | 59 +++++++++++ .../resource/LocationAttributeMissingTestCase.java | 60 +++++++++++ .../ContributionResolveExceptionTestCase.java | 57 +++++++++++ .../spring/LocationAttributeMissingTestCase.java | 60 +++++++++++ .../UnableToResolveComponentTypeTestCase.java | 60 +++++++++++ .../widget/CouldNotResolveLocationTestCase.java | 59 +++++++++++ .../widget/LocationAttributeMissingTestCase.java | 60 +++++++++++ .../impl/xquery/CouldNotLocateFileTestCase.java | 60 +++++++++++ .../xquery/LocationAttributeMissingTestCase.java | 60 +++++++++++ 24 files changed, 1505 insertions(+) create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/AttributeUnrecognizedNamespaceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/AttributeWithoutNamespaceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/BPELProcessNotFoundTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/CannotResolveWSDLReferenceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/MyRolePartnerRoleNullTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/PartnerLinkHasBothAttrTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/PartnerLinkNoMatchingTypeTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/PartnerLinkTypeNoRolesTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/ejb/EJBLinkAttributeMissingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/java/ClassNotFoundExceptionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/java/ContributionResolveExceptionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/osgi/CouldNotLocateOSGiBundleTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/osgi/MissingComponentTypeFileTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/osgi/OSGiTestBundles.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/osgi/PropertyShouldSpecifySRTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/resource/CouldNotResolveLocationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/resource/LocationAttributeMissingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/spring/ContributionResolveExceptionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/spring/LocationAttributeMissingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/spring/UnableToResolveComponentTypeTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/widget/CouldNotResolveLocationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/widget/LocationAttributeMissingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/xquery/CouldNotLocateFileTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/xquery/LocationAttributeMissingTestCase.java (limited to 'sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl') diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/AttributeUnrecognizedNamespaceTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/AttributeUnrecognizedNamespaceTestCase.java new file mode 100644 index 0000000000..cbc9e199e3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/AttributeUnrecognizedNamespaceTestCase.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.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.impl.DefaultMonitorImpl; + +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 = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + System.out.println("AttributeUnrecognizedNamespaceTestCase problem:" + problem.getMessageId()); + assertEquals("AttributeUnrecognizedNamespace", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/AttributeWithoutNamespaceTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/AttributeWithoutNamespaceTestCase.java new file mode 100644 index 0000000000..eb2eedb340 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/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.impl.DefaultMonitorImpl; + +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 = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("AttributeWithoutNamespace", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/BPELProcessNotFoundTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/BPELProcessNotFoundTestCase.java new file mode 100644 index 0000000000..e93918a94c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/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.impl.DefaultMonitorImpl; + +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 = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("BPELProcessNotFound", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/CannotResolveWSDLReferenceTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/CannotResolveWSDLReferenceTestCase.java new file mode 100644 index 0000000000..d711758a21 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/CannotResolveWSDLReferenceTestCase.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package impl.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.impl.DefaultMonitorImpl; + +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() { +// TUSCANY-2970:tests don't work in continuum build + +// Monitor monitor = customDomain.getMonitorInstance(); +// Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + +// assertNotNull(problem); +// assertEquals("CannotResolveWSDLReference", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/MyRolePartnerRoleNullTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/MyRolePartnerRoleNullTestCase.java new file mode 100644 index 0000000000..b6c3b6c7c9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/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.impl.DefaultMonitorImpl; + +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 = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("MyRolePartnerRoleNull", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/PartnerLinkHasBothAttrTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/PartnerLinkHasBothAttrTestCase.java new file mode 100644 index 0000000000..c623c2b157 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/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.impl.DefaultMonitorImpl; + +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(((DefaultMonitorImpl)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.5/itest/validation/src/test/java/impl/bpel/PartnerLinkNoMatchingTypeTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/PartnerLinkNoMatchingTypeTestCase.java new file mode 100644 index 0000000000..311a1fd8e7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/PartnerLinkNoMatchingTypeTestCase.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.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.impl.DefaultMonitorImpl; + +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() { +// TUSCANY-2970:tests don't work in continuum build +// Monitor monitor = customDomain.getMonitorInstance(); +// Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + +// assertNotNull(problem); +// assertEquals("PartnerLinkNoMatchingType", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/PartnerLinkTypeNoRolesTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/PartnerLinkTypeNoRolesTestCase.java new file mode 100644 index 0000000000..999f4a4955 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/bpel/PartnerLinkTypeNoRolesTestCase.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.bpel; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.impl.DefaultMonitorImpl; + +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() { +// TUSCANY-2970:tests don't work in continuum build +// Monitor monitor = customDomain.getMonitorInstance(); +// assertTrue(((DefaultMonitorImpl)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.5/itest/validation/src/test/java/impl/ejb/EJBLinkAttributeMissingTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/ejb/EJBLinkAttributeMissingTestCase.java new file mode 100644 index 0000000000..e0a3216d52 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/ejb/EJBLinkAttributeMissingTestCase.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.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.impl.DefaultMonitorImpl; + +import domain.CustomCompositeBuilder; + +/** + * This shows how to test the Calculator service component. + */ +public class EJBLinkAttributeMissingTestCase extends TestCase { + + private CustomCompositeBuilder customDomain; + + @Override + protected void setUp() throws Exception + { + customDomain = CustomCompositeBuilder.getInstance(); + try { + customDomain.loadContribution("src/main/resources/impl/ejb/EJBLinkAttributeMissing/ejb.composite", + "TestContribution", "src/main/resources/impl/ejb/EJBLinkAttributeMissing/"); + } catch (Exception ex){ + //throw ex; + } + } + + @Override + protected void tearDown() throws Exception { + //nothing to do + } + + public void testCalculator() { + Monitor monitor = customDomain.getMonitorInstance(); + Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("EJBLinkAttributeMissing", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/java/ClassNotFoundExceptionTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/java/ClassNotFoundExceptionTestCase.java new file mode 100644 index 0000000000..24d1c197a6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/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.impl.DefaultMonitorImpl; + +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 = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("ClassNotFoundException", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/java/ContributionResolveExceptionTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/java/ContributionResolveExceptionTestCase.java new file mode 100644 index 0000000000..e3e38e86c3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/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.impl.DefaultMonitorImpl; + +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 = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + + + assertNotNull(problem); + assertEquals("ContributionResolveException", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/osgi/CouldNotLocateOSGiBundleTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/osgi/CouldNotLocateOSGiBundleTestCase.java new file mode 100644 index 0000000000..b51403fec1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/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.impl.DefaultMonitorImpl; +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 = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("CouldNotLocateOSGiBundle", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/osgi/MissingComponentTypeFileTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/osgi/MissingComponentTypeFileTestCase.java new file mode 100644 index 0000000000..1939455192 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/osgi/MissingComponentTypeFileTestCase.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 impl.osgi; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.impl.DefaultMonitorImpl; +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){ + System.out.println(ex.toString()); + ex.printStackTrace(); + //throw ex; + } + } + + @Override + protected void tearDown() throws Exception { + //nothing to do + OSGiRuntime.stop(); + } + + public void testCalculator() { + Monitor monitor = customDomain.getMonitorInstance(); + Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("MissingComponentTypeFile", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/osgi/OSGiTestBundles.java b/sca-java-1.x/branches/sca-java-1.5/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.5/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.5/itest/validation/src/test/java/impl/osgi/PropertyShouldSpecifySRTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/osgi/PropertyShouldSpecifySRTestCase.java new file mode 100644 index 0000000000..4a82f569de --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/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.impl.DefaultMonitorImpl; +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 = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("PropertyShouldSpecifySR", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/resource/CouldNotResolveLocationTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/resource/CouldNotResolveLocationTestCase.java new file mode 100644 index 0000000000..5881d866a0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/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.impl.DefaultMonitorImpl; + +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 = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + + Assert.assertNotNull(problem); + Assert.assertEquals("CouldNotResolveLocation", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/resource/LocationAttributeMissingTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/resource/LocationAttributeMissingTestCase.java new file mode 100644 index 0000000000..8fefaa05eb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/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.impl.DefaultMonitorImpl; + +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 = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("LocationAttributeMissing", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/spring/ContributionResolveExceptionTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/spring/ContributionResolveExceptionTestCase.java new file mode 100644 index 0000000000..ebdd05d980 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/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.impl.DefaultMonitorImpl; + +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(((DefaultMonitorImpl)monitor).isMessageLogged("ContributionResolveException")); + //assertEquals("ContributionResolveException", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/spring/LocationAttributeMissingTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/spring/LocationAttributeMissingTestCase.java new file mode 100644 index 0000000000..7974aa5daf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/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.impl.DefaultMonitorImpl; + +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 = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("LocationAttributeMissing", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/spring/UnableToResolveComponentTypeTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/spring/UnableToResolveComponentTypeTestCase.java new file mode 100644 index 0000000000..0ad7bc0918 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/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.impl.DefaultMonitorImpl; + +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 = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + + //assertNotNull(problem); + //assertEquals("UnableToResolveComponentType", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/widget/CouldNotResolveLocationTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/widget/CouldNotResolveLocationTestCase.java new file mode 100644 index 0000000000..3935afa79c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/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.impl.DefaultMonitorImpl; + +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 = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + + Assert.assertNotNull(problem); + Assert.assertEquals("CouldNotResolveLocation", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/widget/LocationAttributeMissingTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/widget/LocationAttributeMissingTestCase.java new file mode 100644 index 0000000000..daf8eab56f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/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.impl.DefaultMonitorImpl; + +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 = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("LocationAttributeMissing", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/xquery/CouldNotLocateFileTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/xquery/CouldNotLocateFileTestCase.java new file mode 100644 index 0000000000..3dbbc61d9c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/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.impl.DefaultMonitorImpl; + +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 = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("CouldNotLocateFile", problem.getMessageId()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/xquery/LocationAttributeMissingTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/validation/src/test/java/impl/xquery/LocationAttributeMissingTestCase.java new file mode 100644 index 0000000000..584c11c061 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/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.impl.DefaultMonitorImpl; + +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 = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + + assertNotNull(problem); + assertEquals("LocationAttributeMissing", problem.getMessageId()); + } +} -- cgit v1.2.3