diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:13:16 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:13:16 +0000 |
commit | 3ac2d800d840f03618fc364090d786effde84b1f (patch) | |
tree | e334754cd5c37e1465230497b48cc79584c1f571 /branches/sca-java-20080910/modules/implementation-data-xml/src/test/java | |
parent | 9bed5ae38c581999db465b42b504026a7097af95 (diff) |
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835142 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-20080910/modules/implementation-data-xml/src/test/java')
5 files changed, 0 insertions, 497 deletions
diff --git a/branches/sca-java-20080910/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATACollectionTestCaseFIXME.java b/branches/sca-java-20080910/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATACollectionTestCaseFIXME.java deleted file mode 100644 index 458025dd66..0000000000 --- a/branches/sca-java-20080910/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATACollectionTestCaseFIXME.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.implementation.data; - -import java.io.FileInputStream; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; -import junit.framework.TestCase; -import org.apache.tuscany.sca.databinding.xml.XMLStreamReader2String; -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.apache.tuscany.sca.implementation.data.DATACollection; - -public class DATACollectionTestCaseFIXME extends TestCase { - - private SCADomain scaDomain; - private DATACollection dataService; - - /** - * @throws java.lang.Exception - */ - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("data.composite"); - dataService = scaDomain.getService(DATACollection.class, "DataComponent/COMPANY"); - } - - /** - * @throws java.lang.Exception - */ - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void testInsert() throws Exception { - System.out.println(">testInsert"); - - //Read and process the XML file - FileInputStream fileInputStream = new FileInputStream("src/test/resources/insert.xml"); - XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(fileInputStream); - - String result = dataService.post(null, reader); - assertEquals(result, "2"); - - System.out.println("Number of rows inserted: " + result); - - reader.close(); - } - - public void testGet() throws Exception { - - System.out.println(">testGet"); - - XMLStreamReader reader = dataService.get(null); - assertNotNull(reader); - String xml = new XMLStreamReader2String().transform(reader, null); - System.out.println(xml); - reader.close(); - } - - public void testUpdate() throws Exception { - - System.out.println(">testUpdate"); - - //Read and process the XML file - FileInputStream fileInputStream = new FileInputStream("src/test/resources/update.xml"); - XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(fileInputStream); - - dataService.put(null,reader); - - reader.close(); - } - - public void testGetByID() throws Exception { - System.out.println(">testGetByID"); - - Integer companyID = new Integer(4); - - XMLStreamReader reader = dataService.get(companyID.toString()); - assertNotNull(reader); - String xml = new XMLStreamReader2String().transform(reader, null); - System.out.println(xml); - reader.close(); - } - - public void testDeleteByID() throws Exception { - System.out.println(">testDeleteByID"); - - Integer companyID = new Integer(4); - dataService.delete(companyID.toString()); - } - - public void testDelete() throws Exception { - System.out.println(">testDelete"); - - dataService.delete(null); - - System.out.println("recreating database..."); - //Helper.createDB(); - System.out.println("done!"); - } -} diff --git a/branches/sca-java-20080910/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessorTestCase.java b/branches/sca-java-20080910/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessorTestCase.java deleted file mode 100644 index dcf87d8c68..0000000000 --- a/branches/sca-java-20080910/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessorTestCase.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.implementation.data; - -import java.io.StringReader; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Composite; -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.assembly.xml.Constants; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint; -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.core.DefaultExtensionPointRegistry; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.data.engine.config.ConnectionInfo; -import org.apache.tuscany.sca.data.engine.config.ConnectionProperties; -import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; -import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl; -import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory; - -/** - * @version $Rev: 538445 $ $Date: 2007-05-15 23:20:37 -0700 (Tue, 15 May 2007) $ - */ -public class DATAImplementationProcessorTestCase extends TestCase { - - protected static final QName IMPLEMENTATION_DATA = new QName(Constants.SCA10_TUSCANY_NS, "implementation.data.xml"); - - private static final String COMPOSITE_USING_DATASOURCE = - "<?xml version=\"1.0\" encoding=\"ASCII\"?>" - + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.0\" targetNamespace=\"http://data\" name=\"data\">" - + " <component name=\"DataComponent\">" - + " <tuscany:implementation.data.xml>" - + " <tuscany:connectionInfo datasource=\"dataSource\"/>" - + " </tuscany:implementation.data.xml>" - + " </component>" - + "</composite>"; - - private static final String COMPOSITE_USING_CONNECTION_PROPERTIES = - "<?xml version=\"1.0\" encoding=\"ASCII\"?>" - + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.0\" targetNamespace=\"http://data\" name=\"data\">" - + " <component name=\"DataComponent\">" - + " <tuscany:implementation.data.xml>" - + " <tuscany:connectionInfo>" - + " <tuscany:connectionProperties" - + " driverClass=\"driverClass\"" - + " databaseURL=\"databaseURL\"" - + " loginTimeout=\"1\"/>" - + " </tuscany:connectionInfo>" - + " </tuscany:implementation.data.xml>" - + " </component>" - + "</composite>"; - - private XMLInputFactory inputFactory; - private StAXArtifactProcessor<Object> staxProcessor; - private CompositeBuilder compositeBuilder; - - @Override - protected void setUp() throws Exception { - DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); - inputFactory = XMLInputFactory.newInstance(); - StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints); - staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null); - - ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); - AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); - SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class); - UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); - InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class); - IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class); - compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null); - } - - public void testLoadCompositeUsingDatasource() throws Exception { - XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE_USING_DATASOURCE)); - - Composite composite = (Composite)staxProcessor.read(reader); - DATAImplementation implementation = (DATAImplementation)composite.getComponents().get(0).getImplementation(); - assertNotNull(implementation); - - ConnectionInfo connInfo = implementation.getConnectionInfo(); - assertNotNull(connInfo); - assertEquals("dataSource", connInfo.getDataSource()); - - ConnectionProperties connProperties = connInfo.getConnectionProperties(); - assertNull(connProperties); - } - - public void testLoadCompositeUsingConnectionProperties() throws Exception { - XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE_USING_CONNECTION_PROPERTIES)); - - Composite composite = (Composite)staxProcessor.read(reader); - DATAImplementation implementation = (DATAImplementation)composite.getComponents().get(0).getImplementation(); - assertNotNull(implementation); - - ConnectionInfo connInfo = implementation.getConnectionInfo(); - assertNotNull(connInfo); - assertNull("dataSource", connInfo.getDataSource()); - - ConnectionProperties connProperties = connInfo.getConnectionProperties(); - assertNotNull(connProperties); - assertEquals("driverClass",connProperties.getDriverClass()); - assertEquals("databaseURL",connProperties.getDatabaseURL()); - assertEquals(1,connProperties.getLoginTimeout().intValue()); - } -} diff --git a/branches/sca-java-20080910/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATATestCase.java b/branches/sca-java-20080910/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATATestCase.java deleted file mode 100644 index 4010cb63d3..0000000000 --- a/branches/sca-java-20080910/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATATestCase.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.implementation.data; - -import java.io.FileInputStream; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.databinding.xml.XMLStreamReader2String; -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.apache.tuscany.sca.implementation.data.DATA; - -/** - * Tests the DAS service - * - * @version $Rev$ $Date$ - */ -public class DATATestCase extends TestCase { - private SCADomain scaDomain; - private DATA dataService; - - /** - * @throws java.lang.Exception - */ - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("data.composite"); - dataService = scaDomain.getService(DATA.class, "DataComponent/COMPANY_DATA"); - } - - /** - * @throws java.lang.Exception - */ - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void testInsert() throws Exception { - System.out.println(">testInsert"); - - //Read and process the XML file - FileInputStream fileInputStream = new FileInputStream("src/test/resources/insert.xml"); - XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(fileInputStream); - - int result = dataService.insert(reader); - assertEquals(result,2); - - System.out.println("Number of rows inserted: "+result); - - reader.close(); - } - - public void testGet() throws Exception { - - System.out.println(">testGet"); - - XMLStreamReader reader = dataService.get(null); - assertNotNull(reader); - String xml = new XMLStreamReader2String().transform(reader, null); - System.out.println(xml); - reader.close(); - } - - public void testUpdate() throws Exception { - - System.out.println(">testUpdate"); - - //Read and process the XML file - FileInputStream fileInputStream = new FileInputStream("src/test/resources/update.xml"); - XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(fileInputStream); - - int result = dataService.update(reader); - assertEquals(result,1); - System.out.println("Number of rows affected: "+result); - - reader.close(); - } - - public void testGetByID() throws Exception { - System.out.println(">testGetByID"); - - Integer companyID = new Integer(4); - - XMLStreamReader reader = dataService.get(companyID.toString()); - assertNotNull(reader); - String xml = new XMLStreamReader2String().transform(reader, null); - System.out.println(xml); - reader.close(); - } - - public void testDeleteByID() throws Exception { - System.out.println(">testDeleteByID"); - - Integer companyID = new Integer(4); - int result = dataService.delete(companyID.toString()); - assertEquals(result,1); - System.out.println("Number of rows deleted: "+result); - } - - public void testDelete() throws Exception { - System.out.println(">testDelete"); - - int result = dataService.delete(null); - assertEquals(result,4); - System.out.println("Number of rows deleted: "+result); - - System.out.println("recreating database..."); - //Helper.createDB(); - System.out.println("done!"); - } - -} diff --git a/branches/sca-java-20080910/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/companyFeed/CompanyFeed.java b/branches/sca-java-20080910/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/companyFeed/CompanyFeed.java deleted file mode 100644 index 7f0707c0bc..0000000000 --- a/branches/sca-java-20080910/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/companyFeed/CompanyFeed.java +++ /dev/null @@ -1,62 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.data.companyFeed;
-
-import org.apache.tuscany.sca.data.collection.Collection;
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.NotFoundException;
-import org.apache.tuscany.sca.implementation.data.DATA;
-import org.osoa.sca.annotations.Reference;
-
-import commonj.sdo.DataObject;
-
-public class CompanyFeed implements Collection<String, DataObject> {
-
- @Reference
- protected DATA dataService;
-
- public Entry<String, DataObject>[] getAll() {
- return null;
- }
-
- public DataObject get(String id) throws NotFoundException{
-
- DataObject data = null;//dataService.get(id);
- if(data == null) {
- throw new NotFoundException();
- } else {
- return data;
- }
- }
-
- public void delete(String id) throws NotFoundException {
- }
-
- public String post(String key, DataObject item) {
- return null;
- }
-
- public void put(String key, DataObject item) throws NotFoundException {
- }
-
- public Entry<String, DataObject>[] query(String queryString) {
- return null;
- }
-}
diff --git a/branches/sca-java-20080910/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/companyFeed/CompanyFeedTestCaseFIXME.java b/branches/sca-java-20080910/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/companyFeed/CompanyFeedTestCaseFIXME.java deleted file mode 100644 index b72ff89e3b..0000000000 --- a/branches/sca-java-20080910/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/companyFeed/CompanyFeedTestCaseFIXME.java +++ /dev/null @@ -1,51 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.data.companyFeed;
-
-import java.io.IOException;
-import java.net.Socket;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-/**
- * @version $Rev: 543175 $ $Date: 2007-05-31 09:09:12 -0700 (Thu, 31 May 2007) $
- */
-public class CompanyFeedTestCaseFIXME extends TestCase {
- private SCADomain scaDomain;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- scaDomain = SCADomain.newInstance("data-feed.composite");
- //System.in.read();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- scaDomain.close();
- }
-
- public void testPing() throws IOException {
- new Socket("127.0.0.1", 8085);
- }
-
-}
|