diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2008-08-11 21:17:34 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2008-08-11 21:17:34 +0000 |
commit | 993ff15cd6749572834e83f61ac9efeb0e27ad97 (patch) | |
tree | 00e6b61d6d17ec9acadd5e607ea5a6936d12d5dc /sandbox/lresende/sca/samples/organization-das | |
parent | e28d47b5d1a2ed8623e62fa36ee35a77671e92ef (diff) |
Updates to remove @Remotable to avoid SDO copyHelper bug
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@684934 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/lresende/sca/samples/organization-das')
5 files changed, 35 insertions, 11 deletions
diff --git a/sandbox/lresende/sca/samples/organization-das/pom.xml b/sandbox/lresende/sca/samples/organization-das/pom.xml index f100e8d647..b39c125f25 100644 --- a/sandbox/lresende/sca/samples/organization-das/pom.xml +++ b/sandbox/lresende/sca/samples/organization-das/pom.xml @@ -140,7 +140,6 @@ <id>config</id> <configuration> <schemaFile>${basedir}/src/main/resources/sdo-types.xsd</schemaFile> - <noNotification>true</noNotification> <noUnsettable>true</noUnsettable> </configuration> <goals> diff --git a/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/das/OrganizationDataService.java b/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/das/OrganizationDataService.java index e035720769..af71558b14 100644 --- a/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/das/OrganizationDataService.java +++ b/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/das/OrganizationDataService.java @@ -19,10 +19,8 @@ package organization.das; -import org.osoa.sca.annotations.Remotable; import org.soa.types.SchemaInfoType; -@Remotable public interface OrganizationDataService { public commonj.sdo.DataObject findOrganizationBugTwo(java.lang.String id, SchemaInfoType schemaInfo); diff --git a/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/das/OrganizationDataServiceImpl.java b/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/das/OrganizationDataServiceImpl.java index 07c435d2bd..2f99dc84f5 100644 --- a/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/das/OrganizationDataServiceImpl.java +++ b/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/das/OrganizationDataServiceImpl.java @@ -80,7 +80,10 @@ public class OrganizationDataServiceImpl implements OrganizationDataService { java.sql.Connection conn = ConnectionHelper.getConnection(schemaInfo); DAS das = DAS.FACTORY.createDAS(in, conn); - - das.applyChanges(organization); + try { + das.applyChanges(organization); + } catch (Exception e) { + e.printStackTrace(); + } } } diff --git a/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/services/OrganizationService.java b/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/services/OrganizationService.java index f29d94e30b..d821da47e5 100644 --- a/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/services/OrganizationService.java +++ b/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/services/OrganizationService.java @@ -19,12 +19,10 @@ package organization.services; -import org.osoa.sca.annotations.Remotable; import org.soa.types.SchemaInfoType; import commonj.sdo.DataObject; -@Remotable public interface OrganizationService { public DataObject findOrganizationBugTwo(String id, SchemaInfoType schemaInfo); diff --git a/sandbox/lresende/sca/samples/organization-das/src/test/java/organization/OrganizationTestCase.java b/sandbox/lresende/sca/samples/organization-das/src/test/java/organization/OrganizationTestCase.java index f4d8ea1564..33810f4325 100644 --- a/sandbox/lresende/sca/samples/organization-das/src/test/java/organization/OrganizationTestCase.java +++ b/sandbox/lresende/sca/samples/organization-das/src/test/java/organization/OrganizationTestCase.java @@ -27,8 +27,8 @@ import org.apache.tuscany.sca.host.embedded.SCADomain; import org.junit.Test; import org.soa.types.SchemaInfoType; import org.soa.types.TypesFactory; - import organization.services.OrganizationService; + import util.ConnectionHelper; import commonj.sdo.DataObject; @@ -79,7 +79,31 @@ public class OrganizationTestCase { } + @Test + public void testRetrieveOrganizationAndSaveDAS() { + DataObject root = null; + InputStream in = getClass().getClassLoader().getResourceAsStream("organizationConfiguration.xml"); + + // Need to put in valid values for your DB + SchemaInfoType schemaInfo = TypesFactory.INSTANCE.createSchemaInfoType(); + schemaInfo.setPASSWORD(""); + schemaInfo.setSCHEMA(""); + schemaInfo.setUSERNAME(""); + + java.sql.Connection conn = ConnectionHelper.getConnection(schemaInfo); + + DAS das = DAS.FACTORY.createDAS(in, conn); + Command read = das.getCommand("getAccountByID"); + read.setParameter(1, Integer.valueOf(id)); + root = read.executeQuery(); + + das.applyChanges(root); + } + + /** + * This represents BUG_TWO from TUSCANY-2525 + */ @Test public void testRetrieveOrganizationSCA() { @@ -106,9 +130,11 @@ public class OrganizationTestCase { // This doesn't work either. The root datagraph is null // If you call das.applyChanges for a dataObject that has null as the dataGraph, // it hurls. - //commonj.sdo.DataObject rootOne = organizationService.findOrganizationBugTwo(id, schemaInfo); - //System.out.println("rootOne dataGraph -> " + rootOne.getDataGraph()); - //organizationService.updateOrganization(rootOne, schemaInfo); + DataObject rootOne = organizationService.findOrganizationBugTwo(id, schemaInfo); + ////account = root.getDataObject("ACCOUNT[1]"); + ////account.set("ACCOUNT_NAME", "something"); + System.out.println("rootOne dataGraph -> " + rootOne.getDataGraph()); + organizationService.updateOrganization(rootOne, schemaInfo); scaDomain.close(); } |