]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-1521 screen name is no more unique. only userid is unique across all realms...
authorSanjay Dalal <sanjay.dalal@berkeley.edu>
Fri, 23 Apr 2010 23:32:09 +0000 (23:32 +0000)
committerSanjay Dalal <sanjay.dalal@berkeley.edu>
Fri, 23 Apr 2010 23:32:09 +0000 (23:32 +0000)
test: account

M    account/jaxb/src/main/resources/accounts_common.xsd
M    account/pstore/src/main/resources/db/mysql/account.sql
M    account/client/src/test/java/org/collectionspace/services/account/client/test/AccountServiceTest.java

services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountServiceTest.java
services/account/jaxb/src/main/resources/accounts_common.xsd
services/account/pstore/src/main/resources/db/mysql/account.sql

index 92826b3d3c82be31231091bf75adf7c288f80773..97028e7b08425ec3c3394c81d0f2b94fdeef4430 100644 (file)
@@ -130,27 +130,6 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         Assert.assertEquals(statusCode, Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
     }
 
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    public void createForUniqueScreenName(String testName) throws Exception {
-
-        setupCreate(testName);
-
-        // Submit the request to the service and store the response.
-        AccountsCommon account =
-                createAccountInstance("barney", "otherUser", "hithere08", "barney@dinoland.com",
-                true, false, true, true);
-        AccountClient client = new AccountClient();
-        ClientResponse<Response> res = client.create(account);
-        int statusCode = res.getStatus();
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
-        }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
-    }
 
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
     dependsOnMethods = {"create"})
index 7ee4d841287868b272b5adcb7508b6fe268624cc..4fbc5d5486a87d83570bc6852c796a9bd47c0405 100644 (file)
     <xs:element name="accounts_common">
         <xs:complexType>
             <xs:annotation>
+                <xs:documentation>
+                    AccountsCommon is the account definition in CollectionSpace
+                    - userId is unique across all realms and across all tenants in CollectionSpace
+                    - password should be &gt;8 and &lt;24 chars in length
+                    - tenant association is usually not required to be provided by the
+                    service consumer. only in cases where a user in CollectionSpace
+                    has access to the spaces of multiple tenants, this is used
+                    to associate that user with more than one tenants
+                </xs:documentation>
                 <xs:appinfo>
                     <hj:entity>
                         <orm:table name="accounts_common">
-                            <orm:unique-constraint>
-                                <orm:column-name>screen_name</orm:column-name>
-                            </orm:unique-constraint>
                         </orm:table>
                     </hj:entity>
                 </xs:appinfo>
@@ -92,6 +98,9 @@
                 <!-- userid, could be calnet id, openid URI -->
                 <xs:element name="userId" type="xs:string" minOccurs="1" maxOccurs="1">
                     <xs:annotation>
+                        <xs:documentation>
+                            userId is unique across all tenants in CollectionSpace
+                        </xs:documentation>
                         <xs:appinfo>
                             <hj:basic>
                                 <orm:column name="userid" length="128"  nullable="false"/>
                 <!-- optional base64 encoded password for default identity provider only -->
                 <xs:element name="password" type="xs:base64Binary" minOccurs="0" maxOccurs="1">
                     <xs:annotation>
+                        <xs:documentation>
+                            password should be &gt;8 and &lt;24 chars in length
+                        </xs:documentation>
                         <xs:appinfo>
                             <hj:ignored/>
                         </xs:appinfo>
                     </xs:annotation>
                 </xs:element>
                 <xs:element name="tenants" type="account_tenant" minOccurs="1" maxOccurs="unbounded">
+                    <xs:annotation>
+                        <xs:documentation>
+                            tenant association is usually not required to be provided by the
+                            service consumer. only in cases where a user in CollectionSpace
+                            has access to the spaces of multiple tenants, this is used
+                            to associate that user with more than one tenants
+                        </xs:documentation>
+                    </xs:annotation>
                 </xs:element>
                 <xs:element name="status" type="status">
                     <xs:annotation>
     <xs:element name="accounts-common-list">
         <xs:complexType>
             <xs:annotation>
+                <xs:documentation>
+                    AccountsCommonList contains information about one or more
+                    accounts. An instance of this type could be returned on
+                    index and search operations.
+                </xs:documentation>
                 <xs:appinfo>
                     <hj:ignored/>
                 </xs:appinfo>
     </xs:element>
 
     <xs:simpleType name="status">
+        <xs:annotation>
+            <xs:documentation>
+                Status of the account in CollectionSpace
+            </xs:documentation>
+        </xs:annotation>
         <xs:restriction base="xs:string">
             <xs:enumeration value="active" />
             <xs:enumeration value="inactive" />
 
     <xs:complexType name="account_tenant">
         <xs:annotation>
+            <xs:documentation>
+                AccountTenant defines the relationship between an account and a tenant
+            </xs:documentation>
             <xs:appinfo>
                 <hj:entity>
                     <orm:table name="accounts_tenants">
         </xs:sequence>
     </xs:complexType>
 
+    <!-- FIXME tenant definition could be in a separate schema -->
     <xs:complexType name="tenant">
         <xs:annotation>
+            <xs:documentation>
+                Tenant defines the tenant in CollectionSpace
+            </xs:documentation>
             <xs:appinfo>
                 <hj:entity>
                     <orm:table name="tenants"/>
index 9156e70c23a78c69c39247a26506738d3e6575bf..c920678286db89998aca2bda5a2e5cb05c4d9f43 100644 (file)
@@ -2,7 +2,7 @@ alter table accounts_tenants drop foreign key FKFDA649B05A9CEEB5;
 drop table if exists accounts_common;
 drop table if exists accounts_tenants;
 drop table if exists tenants;
-create table accounts_common (csid varchar(128) not null, created_at datetime not null, email varchar(255) not null, mobile varchar(255), person_ref_name varchar(255), phone varchar(255), screen_name varchar(128) not null, status varchar(15) not null, updated_at datetime, userid varchar(128) not null, primary key (csid), unique (screen_name));
+create table accounts_common (csid varchar(128) not null, created_at datetime not null, email varchar(255) not null, mobile varchar(255), person_ref_name varchar(255), phone varchar(255), screen_name varchar(128) not null, status varchar(15) not null, updated_at datetime, userid varchar(128) not null, primary key (csid));
 create table accounts_tenants (HJID bigint not null auto_increment, tenant_id varchar(128) not null, TENANTS_ACCOUNTSCOMMON_CSID varchar(128), primary key (HJID));
 create table tenants (id varchar(128) not null, created_at datetime not null, name varchar(255) not null, updated_at datetime, primary key (id));
 alter table accounts_tenants add index FKFDA649B05A9CEEB5 (TENANTS_ACCOUNTSCOMMON_CSID), add constraint FKFDA649B05A9CEEB5 foreign key (TENANTS_ACCOUNTSCOMMON_CSID) references accounts_common (csid);