Skip to content
Snippets Groups Projects
Commit 3550cead authored by pkupczyk's avatar pkupczyk
Browse files

SP-159 / BIS-93: YeastLab: Implement a way to download template files as part...

SP-159 / BIS-93: YeastLab: Implement a way to download template files as part of the Custom Import functionality:
- added unique constraint on project.perm_id
- added some junits

SVN: 26365
parent 80757199
No related branches found
No related tags found
No related merge requests found
...@@ -366,6 +366,7 @@ ALTER TABLE MATERIAL_TYPE_PROPERTY_TYPES ADD CONSTRAINT MTPT_BK_UK UNIQUE(MATY_I ...@@ -366,6 +366,7 @@ ALTER TABLE MATERIAL_TYPE_PROPERTY_TYPES ADD CONSTRAINT MTPT_BK_UK UNIQUE(MATY_I
ALTER TABLE DATA_SET_TYPES ADD CONSTRAINT DSTY_BK_UK UNIQUE(CODE,DBIN_ID); ALTER TABLE DATA_SET_TYPES ADD CONSTRAINT DSTY_BK_UK UNIQUE(CODE,DBIN_ID);
ALTER TABLE PERSONS ADD CONSTRAINT PERS_BK_UK UNIQUE(DBIN_ID,USER_ID); ALTER TABLE PERSONS ADD CONSTRAINT PERS_BK_UK UNIQUE(DBIN_ID,USER_ID);
ALTER TABLE PROJECTS ADD CONSTRAINT PROJ_BK_UK UNIQUE(CODE,SPACE_ID); ALTER TABLE PROJECTS ADD CONSTRAINT PROJ_BK_UK UNIQUE(CODE,SPACE_ID);
ALTER TABLE PROJECTS ADD CONSTRAINT PROJ_PI_UK UNIQUE(PERM_ID);
ALTER TABLE PROPERTY_TYPES ADD CONSTRAINT PRTY_BK_UK UNIQUE(CODE,IS_INTERNAL_NAMESPACE,DBIN_ID); ALTER TABLE PROPERTY_TYPES ADD CONSTRAINT PRTY_BK_UK UNIQUE(CODE,IS_INTERNAL_NAMESPACE,DBIN_ID);
ALTER TABLE ROLE_ASSIGNMENTS ADD CONSTRAINT ROAS_PE_SPACE_BK_UK UNIQUE(PERS_ID_GRANTEE,ROLE_CODE,SPACE_ID); ALTER TABLE ROLE_ASSIGNMENTS ADD CONSTRAINT ROAS_PE_SPACE_BK_UK UNIQUE(PERS_ID_GRANTEE,ROLE_CODE,SPACE_ID);
ALTER TABLE ROLE_ASSIGNMENTS ADD CONSTRAINT ROAS_PE_INSTANCE_BK_UK UNIQUE(PERS_ID_GRANTEE,ROLE_CODE,DBIN_ID); ALTER TABLE ROLE_ASSIGNMENTS ADD CONSTRAINT ROAS_PE_INSTANCE_BK_UK UNIQUE(PERS_ID_GRANTEE,ROLE_CODE,DBIN_ID);
......
...@@ -22,3 +22,4 @@ DROP function GENERATE_PROJECT_PERM_IDS(); ...@@ -22,3 +22,4 @@ DROP function GENERATE_PROJECT_PERM_IDS();
-- change perm id column to not null -- change perm id column to not null
ALTER TABLE projects ALTER COLUMN perm_id SET NOT NULL; ALTER TABLE projects ALTER COLUMN perm_id SET NOT NULL;
ALTER TABLE PROJECTS ADD CONSTRAINT PROJ_PI_UK UNIQUE(PERM_ID);
...@@ -111,6 +111,7 @@ public class ProjectDAOTest extends AbstractDAOTest ...@@ -111,6 +111,7 @@ public class ProjectDAOTest extends AbstractDAOTest
final List<ProjectPE> allProjects = daoFactory.getProjectDAO().listProjects(); final List<ProjectPE> allProjects = daoFactory.getProjectDAO().listProjects();
Collections.sort(allProjects); Collections.sort(allProjects);
final ProjectPE templateProject = allProjects.get(4); final ProjectPE templateProject = allProjects.get(4);
assertEquals(templateProject.getCode(), TESTPROJ); assertEquals(templateProject.getCode(), TESTPROJ);
ProjectPE found = ProjectPE found =
...@@ -143,6 +144,20 @@ public class ProjectDAOTest extends AbstractDAOTest ...@@ -143,6 +144,20 @@ public class ProjectDAOTest extends AbstractDAOTest
templateProject.getSpace().getCode(), templateProject.getCode())); templateProject.getSpace().getCode(), templateProject.getCode()));
} }
@Test
public void testTryGetByPermID() throws Exception
{
ProjectPE found = daoFactory.getProjectDAO().tryGetByPermID("20120814110011738-105");
assertEquals(TEST_PROJECT, found.getCode());
}
@Test
public void testTryGetByPermIDNonexistent() throws Exception
{
ProjectPE found = daoFactory.getProjectDAO().tryGetByPermID("UNKNOWN-PERM-ID");
assertNull(found);
}
@Test @Test
public void testCreateProject() throws Exception public void testCreateProject() throws Exception
{ {
......
...@@ -148,6 +148,8 @@ ALTER TABLE ONLY post_registration_dataset_queue ...@@ -148,6 +148,8 @@ ALTER TABLE ONLY post_registration_dataset_queue
ADD CONSTRAINT prdq_pk PRIMARY KEY (id); ADD CONSTRAINT prdq_pk PRIMARY KEY (id);
ALTER TABLE ONLY projects ALTER TABLE ONLY projects
ADD CONSTRAINT proj_bk_uk UNIQUE (code, space_id); ADD CONSTRAINT proj_bk_uk UNIQUE (code, space_id);
ALTER TABLE ONLY projects
ADD CONSTRAINT proj_pi_uk UNIQUE (perm_id);
ALTER TABLE ONLY projects ALTER TABLE ONLY projects
ADD CONSTRAINT proj_pk PRIMARY KEY (id); ADD CONSTRAINT proj_pk PRIMARY KEY (id);
ALTER TABLE ONLY project_relationships_history ALTER TABLE ONLY project_relationships_history
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment