From 33c7a21fd05fe523ae1d6e31f6a1bccbf1083fbd Mon Sep 17 00:00:00 2001
From: pkupczyk <pkupczyk>
Date: Wed, 13 Aug 2014 14:10:56 +0000
Subject: [PATCH] SSDM-137 : V3 AS API - fully cover existing functionality
 with system tests - create js-test for V3 API

SVN: 32183
---
 .../html/openbis-new-api-test.js              | 224 +++++++++++++++++-
 .../systemtest/api/v3/ExperimentJsonTest.java | 116 ---------
 .../createExperiments.json                    |  37 ---
 .../fetchOptions.json                         |  31 ---
 .../listExperiments.json                      |  12 -
 .../v3/ExperimentJsonTestResources/login.json |   9 -
 .../searchExperiments.json                    |  21 --
 .../updateExperiments.json                    |  48 ----
 .../systemtest/api/v3/SampleJsonTest.java     | 137 -----------
 .../createSamples.json                        |  36 ---
 .../SampleJsonTestResources/fetchOptions.json |  51 ----
 .../SampleJsonTestResources/listSamples.json  |  12 -
 .../api/v3/SampleJsonTestResources/login.json |   9 -
 .../searchSamples.json                        |  21 --
 .../updateSamples.json                        |  49 ----
 15 files changed, 223 insertions(+), 590 deletions(-)
 delete mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTest.java
 delete mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/createExperiments.json
 delete mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/fetchOptions.json
 delete mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/listExperiments.json
 delete mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/login.json
 delete mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/searchExperiments.json
 delete mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/updateExperiments.json
 delete mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTest.java
 delete mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/createSamples.json
 delete mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/fetchOptions.json
 delete mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/listSamples.json
 delete mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/login.json
 delete mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/searchSamples.json
 delete mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/updateSamples.json

diff --git a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-new-api-test/html/openbis-new-api-test.js b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-new-api-test/html/openbis-new-api-test.js
index 315769e9682..29bc8a8052f 100644
--- a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-new-api-test/html/openbis-new-api-test.js
+++ b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-new-api-test/html/openbis-new-api-test.js
@@ -161,6 +161,50 @@ var createExperimentFetchOptions = function() {
 	}
 }
 
+var createSampleFetchOptions = function() {
+	return {
+		"@type" : "SampleFetchOptions",
+
+		"sampleType" : {
+			"@type" : "SampleTypeFetchOptions"
+		},
+
+		"experiment" : {
+			"@type" : "ExperimentFetchOptions",
+			"project" : {
+				"@type" : "ProjectFetchOptions",
+				"space" : {
+					"@type" : "SpaceFetchOptions"
+				}
+			}
+		},
+
+		"space" : {
+			"@type" : "SpaceFetchOptions"
+		},
+
+		"properties" : {
+			"@type" : "PropertyFetchOptions"
+		},
+
+		"tags" : {
+			"@type" : "TagFetchOptions"
+		},
+
+		"registrator" : {
+			"@type" : "PersonFetchOptions"
+		},
+
+		"modifier" : {
+			"@type" : "PersonFetchOptions"
+		},
+
+		"attachments" : {
+			"@type" : "AttachmentFetchOptions"
+		}
+	}
+}
+
 test("listExperiments()", function() {
 	createFacadeAndLogin(function(facade) {
 		facade.ajaxRequest({
@@ -186,6 +230,32 @@ test("listExperiments()", function() {
 	});
 });
 
+test("listSamples()", function() {
+	createFacadeAndLogin(function(facade) {
+		facade.ajaxRequest({
+			url : testApiUrl,
+			data : {
+				"method" : "listSamples",
+				"params" : [ facade.sessionToken, [ {
+					"@type" : "SamplePermId",
+					"permId" : "20130412140147735-20"
+				} ], createSampleFetchOptions() ]
+			},
+			success : function(samples) {
+				assertObjectsCount(samples, 1);
+
+				var sample = samples[0];
+				equal(sample.code, "PLATE-1", "Sample code");
+				equal(sample.sampleType.code, "PLATE", "Type code");
+				equal(sample.experiment.code, "EXP-1", "Experiment code");
+				equal(sample.experiment.project.code, "SCREENING-EXAMPLES", "Project code");
+				equal(sample.space.code, "PLATONIC", "Space code");
+				facade.close();
+			}
+		});
+	});
+});
+
 test("searchExperiments()", function() {
 	createFacadeAndLogin(function(facade) {
 		facade.ajaxRequest({
@@ -217,6 +287,38 @@ test("searchExperiments()", function() {
 	});
 });
 
+test("searchSamples()", function() {
+	createFacadeAndLogin(function(facade) {
+		facade.ajaxRequest({
+			url : testApiUrl,
+			data : {
+				"method" : "searchSamples",
+				"params" : [ facade.sessionToken, {
+					"@type" : "SampleSearchCriterion",
+					"criteria" : [ {
+						"@type" : "CodeSearchCriterion",
+						"fieldValue" : {
+							"@type" : "StringEqualToValue",
+							"value" : "PLATE-1"
+						}
+					} ]
+				}, createSampleFetchOptions() ]
+			},
+			success : function(samples) {
+				assertObjectsCount(samples, 1);
+
+				var sample = samples[0];
+				equal(sample.code, "PLATE-1", "Sample code");
+				equal(sample.sampleType.code, "PLATE", "Type code");
+				equal(sample.experiment.code, "EXP-1", "Experiment code");
+				equal(sample.experiment.project.code, "SCREENING-EXAMPLES", "Project code");
+				equal(sample.space.code, "PLATONIC", "Space code");
+				facade.close();
+			}
+		});
+	});
+});
+
 test("createExperiments()", function() {
 	createFacadeAndLogin(function(facade) {
 		var code = "CREATE_JSON_EXPERIMENT_" + (new Date().getTime());
@@ -271,6 +373,58 @@ test("createExperiments()", function() {
 	});
 });
 
+test("createSamples()", function() {
+	createFacadeAndLogin(function(facade) {
+		var code = "CREATE_JSON_SAMPLE_" + (new Date().getTime());
+
+		facade.ajaxRequest({
+			url : testApiUrl,
+			data : {
+				"method" : "createSamples",
+				"params" : [ facade.sessionToken, [ {
+					"@type" : "SampleCreation",
+
+					"typeId" : {
+						"@type" : "EntityTypePermId",
+						"permId" : "UNKNOWN"
+					},
+
+					"code" : code,
+
+					"spaceId" : {
+						"@type" : "SpacePermId",
+						"permId" : "TEST"
+					},
+
+					"tagIds" : [ {
+						"@type" : "TagNameId",
+						"name" : "CREATE_JSON_TAG"
+					} ]
+
+				} ] ]
+			},
+			success : function(samplePermIds) {
+				facade.ajaxRequest({
+					url : testApiUrl,
+					data : {
+						"method" : "listSamples",
+						"params" : [ facade.sessionToken, [ samplePermIds[0] ], createSampleFetchOptions() ]
+					},
+					success : function(samples) {
+						assertObjectsCount(samples, 1);
+
+						var sample = samples[0];
+						equal(sample.code, code, "Sample code");
+						equal(sample.sampleType.code, "UNKNOWN", "Type code");
+						equal(sample.space.code, "TEST", "Space code");
+						facade.close();
+					}
+				});
+			}
+		});
+	});
+});
+
 test("updateExperiments()", function() {
 	createFacadeAndLogin(function(facade) {
 		var code = "UPDATE_JSON_EXPERIMENT_" + (new Date().getTime());
@@ -313,7 +467,7 @@ test("updateExperiments()", function() {
 
 						} ] ]
 					},
-					success : function(experiments) {
+					success : function() {
 
 						facade.ajaxRequest({
 							url : testApiUrl,
@@ -338,3 +492,71 @@ test("updateExperiments()", function() {
 		});
 	});
 });
+
+test("updateSamples()", function() {
+	createFacadeAndLogin(function(facade) {
+		var code = "UPDATE_JSON_SAMPLE_" + (new Date().getTime());
+
+		facade.ajaxRequest({
+			url : testApiUrl,
+			data : {
+				"method" : "createSamples",
+				"params" : [ facade.sessionToken, [ {
+					"@type" : "SampleCreation",
+
+					"typeId" : {
+						"@type" : "EntityTypePermId",
+						"permId" : "UNKNOWN"
+					},
+
+					"code" : code,
+
+					"spaceId" : {
+						"@type" : "SpacePermId",
+						"permId" : "PLATONIC"
+					}
+
+				} ] ]
+			},
+			success : function(samplePermIds) {
+				facade.ajaxRequest({
+					url : testApiUrl,
+					data : {
+						"method" : "updateSamples",
+						"params" : [ facade.sessionToken, [ {
+							"@type" : "SampleUpdate",
+
+							"sampleId" : samplePermIds[0],
+
+							"spaceId" : {
+								"@type" : "SpacePermId",
+								"permId" : "TEST"
+							}
+
+						} ] ]
+					},
+					success : function() {
+
+						facade.ajaxRequest({
+							url : testApiUrl,
+							data : {
+								"method" : "listSamples",
+								"params" : [ facade.sessionToken, [ samplePermIds[0] ], createSampleFetchOptions() ]
+							},
+							success : function(samples) {
+								assertObjectsCount(samples, 1);
+
+								var sample = samples[0];
+								equal(sample.code, code, "Sample code");
+								equal(sample.sampleType.code, "UNKNOWN", "Type code");
+								equal(sample.space.code, "TEST", "Space code");
+								facade.close();
+							}
+						});
+					}
+				});
+			}
+		});
+	});
+});
+
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTest.java
deleted file mode 100644
index 392ca08c6ee..00000000000
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTest.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright 2014 ETH Zuerich, CISD
- *
- * Licensed 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 ch.systemsx.cisd.openbis.systemtest.api.v3;
-
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertFalse;
-
-import org.testng.annotations.Test;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * @author pkupczyk
- */
-@Test(enabled = false)
-public class ExperimentJsonTest extends AbstractJsonTest
-{
-
-    @Test(enabled = false)
-    public void testListExperiments() throws Exception
-    {
-        String sessionToken = login();
-        String fetchOptions = getFileContent("fetchOptions.json");
-
-        JsonNode response = sendRequest("listExperiments.json", sessionToken, "200811050951882-1028", fetchOptions);
-
-        assertResultCount(response, 1);
-
-        JsonNode experimentNode = response.get("result").get(0);
-        assertEquals("EXP1", experimentNode.get("code").asText());
-        assertEquals("/CISD/NEMO/EXP1", experimentNode.get("identifier").get("identifier").asText());
-        assertEquals("200811050951882-1028", experimentNode.get("permId").get("permId").asText());
-        assertEquals("SIRNA_HCS", experimentNode.get("type").get("code").asText());
-        assertEquals("NEMO", experimentNode.get("project").get("code").asText());
-        assertEquals("A simple experiment", experimentNode.get("properties").get("DESCRIPTION").asText());
-        assertEquals("test", experimentNode.get("registrator").get("userId").asText());
-        JsonNode attachments = experimentNode.get("attachments");
-        assertChildrenCount(attachments, 1);
-        assertEquals("exampleExperiments.txt", attachments.get(0).get("fileName").asText());
-        assertFalse(experimentNode.get("registrationDate").isNull());
-        assertFalse(experimentNode.get("modificationDate").isNull());
-    }
-
-    @Test(enabled = false)
-    public void testCreateExperiments() throws Exception
-    {
-        String sessionToken = login();
-
-        JsonNode createResponse = sendRequest("createExperiments.json", sessionToken, "NEW_JSON_EXPERIMENT");
-
-        assertResultCount(createResponse, 1);
-
-        String experimentPermId = createResponse.get("result").get(0).get("permId").asText();
-        String fetchOptions = getFileContent("fetchOptions.json");
-
-        JsonNode listResponse = sendRequest("listExperiments.json", sessionToken, experimentPermId, fetchOptions);
-
-        assertResultCount(listResponse, 1);
-
-        JsonNode experimentNode = listResponse.get("result").get(0);
-        assertEquals(experimentPermId, experimentNode.get("permId").get("permId").asText());
-        assertEquals("NEW_JSON_EXPERIMENT", experimentNode.get("code").asText());
-        assertEquals("/CISD/NEMO/NEW_JSON_EXPERIMENT", experimentNode.get("identifier").get("identifier").asText());
-        assertEquals("COMPOUND_HCS", experimentNode.get("type").get("code").asText());
-        assertEquals("NEMO", experimentNode.get("project").get("code").asText());
-        assertEquals("hello", experimentNode.get("properties").get("DESCRIPTION").asText());
-        JsonNode tagsNode = experimentNode.get("tags");
-        assertChildrenCount(tagsNode, 1);
-        assertEquals("NEW_JSON_TAG", tagsNode.get(0).get("name").asText());
-        assertEquals("test", experimentNode.get("registrator").get("userId").asText());
-        assertFalse(experimentNode.get("modifier").isNull());
-        assertFalse(experimentNode.get("registrationDate").isNull());
-        assertFalse(experimentNode.get("modificationDate").isNull());
-    }
-
-    @Test(enabled = false)
-    public void testUpdateExperiments() throws Exception
-    {
-        // updateExperiments method is not yet implemented in the new API
-    }
-
-    @Test(enabled = false)
-    public void testSearchExperiments() throws Exception
-    {
-        String sessionToken = login();
-        String fetchOptions = getFileContent("fetchOptions.json");
-
-        JsonNode response = sendRequest("searchExperiments.json", sessionToken, "EXP1", fetchOptions);
-
-        assertResultCount(response, 1);
-
-        JsonNode experimentNode = response.get("result").get(0);
-        assertEquals("EXP1", experimentNode.get("code").asText());
-        assertEquals("/CISD/NEMO/EXP1", experimentNode.get("identifier").get("identifier").asText());
-        assertEquals("200811050951882-1028", experimentNode.get("permId").get("permId").asText());
-        assertEquals("SIRNA_HCS", experimentNode.get("type").get("code").asText());
-        assertEquals("NEMO", experimentNode.get("project").get("code").asText());
-        assertEquals("A simple experiment", experimentNode.get("properties").get("DESCRIPTION").asText());
-        assertEquals("test_role", experimentNode.get("modifier").get("userId").asText());
-    }
-
-}
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/createExperiments.json b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/createExperiments.json
deleted file mode 100644
index 59d54f75f8e..00000000000
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/createExperiments.json
+++ /dev/null
@@ -1,37 +0,0 @@
-{
-	"method":"createExperiments",
-	"params":[
-		"%s",
-		[
-			{
-				"@type" : "ExperimentCreation",
-
-				"typeId" : {
-					"@type" : "EntityTypePermId",
-					"permId" : "COMPOUND_HCS"
-					
-				},
-				
-				"code" : "%s",
-
-				"projectId" : {
-					"@type" : "ProjectIdentifier",
-					"identifier" : "/CISD/NEMO"
-				},
-
-				"tagIds" : [
-					{
-						"@type" : "TagNameId",
-						"name" : "NEW_JSON_TAG"
-					}
-				],
-				
-				"properties" : {
-					"DESCRIPTION" : "hello"
-				}
-			}
-		]
-	],
-	"id":"1",
-	"jsonrpc":"2.0"
-}
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/fetchOptions.json b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/fetchOptions.json
deleted file mode 100644
index 1b68aa6099c..00000000000
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/fetchOptions.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
-	"@type" : "ExperimentFetchOptions",
-	
-	"type" : {
-		"@type" : "ExperimentTypeFetchOptions"
-	},
-	
-	"project" : {
-		"@type" : "ProjectFetchOptions"
-	},
-	
-	"properties" : {
-		"@type" : "PropertyFetchOptions"
-	},
-	
-	"tags" : {
-		"@type" : "TagFetchOptions"
-	},
-	
-	"registrator" : {
-		"@type" : "PersonFetchOptions"
-	},
-	
-	"modifier" : {
-		"@type" : "PersonFetchOptions"
-	},
-	
-	"attachments" : {
-		"@type" : "AttachmentFetchOptions"
-	}
-}
\ No newline at end of file
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/listExperiments.json b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/listExperiments.json
deleted file mode 100644
index 5ffca2172f3..00000000000
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/listExperiments.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
-	"method":"listExperiments",
-	"params":[
-		"%s",
-		[
-			{"@type" : "ExperimentPermId", "permId" : "%s"}
-		],
-		%s
-	],
-	"id":"1",
-	"jsonrpc":"2.0"
-}
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/login.json b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/login.json
deleted file mode 100644
index 89d28a67819..00000000000
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/login.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
-	"method" : "login",
-	"params" : [
-		"test",
-		"password"
-	],
-	"id" : "1",
-	"jsonrpc" : "2.0"
-}
\ No newline at end of file
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/searchExperiments.json b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/searchExperiments.json
deleted file mode 100644
index 24ce669bd28..00000000000
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/searchExperiments.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
-	"method":"searchExperiments",
-	"params":[
-		"%s",
-		{
-			"@type" : "ExperimentSearchCriterion",
-			"criteria" : [
-    			 {
-    			     "@type" : "CodeSearchCriterion",
-    			     "fieldValue" : {
-    			         "@type" : "StringEqualToValue",
-    			         "value" : "%s"
-    			     }
-    			 }
-			]
-		},
-		%s
-	],
-	"id":"1",
-	"jsonrpc":"2.0"
-}
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/updateExperiments.json b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/updateExperiments.json
deleted file mode 100644
index c9a107b09f8..00000000000
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/ExperimentJsonTestResources/updateExperiments.json
+++ /dev/null
@@ -1,48 +0,0 @@
-{
-	"method":"updateExperiments",
-	"params":[
-		"%s",
-		[
-			{
-				"@type" : "ExperimentUpdate",
-				
-				"experimentId" : {
-					"@type" : "ExperimentIdentifer",
-					"identifier" : "%s"
-				},
-				
-				"projectId" : {
-					"@type" : "ProjectIdentifier",
-					"identifier" : "/CISD/NOE"
-				},
-				
-				"tagsActions" : [
-					{
-						"@type" : "AddAction",
-						"ids" : [
-							{
-								"@type" : "TagNameId",
-								"name" : "NEW_JSON_TAG_2"
-							}
-						]	
-					},
-					{
-						"@type" : "RemoveAction",
-						"ids" : [
-							{
-								"@type" : "TagNameId",
-								"name" : "NEW_JSON_TAG"
-							}
-						]	
-					}
-				],
-				
-				"properties" : {
-					"DESCRIPTION" : "hello 2"
-				}
-			}
-		]
-	],
-	"id":"1",
-	"jsonrpc":"2.0"
-}
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTest.java
deleted file mode 100644
index 53ae8ce5e32..00000000000
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTest.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright 2014 ETH Zuerich, CISD
- *
- * Licensed 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 ch.systemsx.cisd.openbis.systemtest.api.v3;
-
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertTrue;
-
-import org.testng.annotations.Test;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * @author pkupczyk
- */
-@Test(enabled = false)
-public class SampleJsonTest extends AbstractJsonTest
-{
-
-    @Test(enabled = false)
-    public void testListSamples() throws Exception
-    {
-        String sessionToken = login();
-        String fetchOptions = getFileContent("fetchOptions.json");
-
-        JsonNode response = sendRequest("listSamples.json", sessionToken, "200811050919915-8", fetchOptions);
-
-        assertResultCount(response, 1);
-
-        JsonNode sampleNode = response.get("result").get(0);
-        assertEquals("CL1", sampleNode.get("code").asText());
-        assertEquals("CONTROL_LAYOUT", sampleNode.get("sampleType").get("code").asText());
-        assertEquals("CISD", sampleNode.get("space").get("code").asText());
-        assertTrue(sampleNode.get("experiment").isNull());
-        assertTrue(sampleNode.get("container").isNull());
-        assertEquals("384_WELLS_16X24", sampleNode.get("properties").get("$PLATE_GEOMETRY").asText());
-        assertEquals("test control layout", sampleNode.get("properties").get("DESCRIPTION").asText());
-    }
-
-    @Test(enabled = false)
-    public void testCreateSamples() throws Exception
-    {
-        String sessionToken = login();
-
-        JsonNode createResponse = sendRequest("createSamples.json", sessionToken, "NEW_JSON_SAMPLE");
-
-        assertResultCount(createResponse, 1);
-
-        String samplePermId = createResponse.get("result").get(0).get("permId").asText();
-        String fetchOptions = getFileContent("fetchOptions.json");
-
-        JsonNode listResponse = sendRequest("listSamples.json", sessionToken, samplePermId, fetchOptions);
-
-        assertResultCount(listResponse, 1);
-
-        JsonNode sampleNode = listResponse.get("result").get(0);
-        assertEquals(samplePermId, sampleNode.get("permId").get("permId").asText());
-        assertEquals("NEW_JSON_SAMPLE", sampleNode.get("code").asText());
-        assertEquals("CELL_PLATE", sampleNode.get("sampleType").get("code").asText());
-        assertEquals("CISD", sampleNode.get("space").get("code").asText());
-        assertEquals("EXP10", sampleNode.get("experiment").get("code").asText());
-        assertEquals("hello", sampleNode.get("properties").get("COMMENT").asText());
-    }
-
-    @Test(enabled = false)
-    public void testUpdateSamples() throws Exception
-    {
-        String sessionToken = login();
-
-        JsonNode createResponse;
-
-        createResponse = sendRequest("createSamples.json", sessionToken, "JSON_SAMPLE_TO_UPDATE_CONTAINED");
-        assertResultCount(createResponse, 1);
-
-        createResponse = sendRequest("createSamples.json", sessionToken, "JSON_SAMPLE_TO_UPDATE_CONTAINER");
-        assertResultCount(createResponse, 1);
-
-        createResponse = sendRequest("createSamples.json", sessionToken, "JSON_SAMPLE_TO_UPDATE");
-        assertResultCount(createResponse, 1);
-
-        String samplePermId = createResponse.get("result").get(0).get("permId").asText();
-        String fetchOptions = getFileContent("fetchOptions.json");
-
-        sendRequest("updateSamples.json", sessionToken, "/CISD/JSON_SAMPLE_TO_UPDATE");
-
-        JsonNode listResponse = sendRequest("listSamples.json", sessionToken, samplePermId, fetchOptions);
-
-        assertResultCount(listResponse, 1);
-
-        JsonNode sampleNode = listResponse.get("result").get(0);
-        assertEquals("JSON_SAMPLE_TO_UPDATE", sampleNode.get("code").asText());
-        assertEquals("CELL_PLATE", sampleNode.get("sampleType").get("code").asText());
-        assertEquals("CISD", sampleNode.get("space").get("code").asText());
-        assertEquals("EXP11", sampleNode.get("experiment").get("code").asText());
-        assertEquals("JSON_SAMPLE_TO_UPDATE_CONTAINER", sampleNode.get("container").get("code").asText());
-
-        JsonNode containedNode = sampleNode.get("contained");
-        assertTrue(containedNode.has(0));
-        assertFalse(containedNode.has(1));
-        assertEquals("JSON_SAMPLE_TO_UPDATE_CONTAINED", containedNode.get(0).get("code").asText());
-        assertEquals("hello 2", sampleNode.get("properties").get("COMMENT").asText());
-    }
-
-    @Test(enabled = false)
-    public void testSearchSamples() throws Exception
-    {
-        String sessionToken = login();
-        String fetchOptions = getFileContent("fetchOptions.json");
-
-        JsonNode response = sendRequest("searchSamples.json", sessionToken, "PLATE_WELLSEARCH", fetchOptions);
-
-        assertResultCount(response, 1);
-
-        JsonNode sampleNode = response.get("result").get(0);
-        assertEquals("PLATE_WELLSEARCH", sampleNode.get("code").asText());
-        assertEquals("CELL_PLATE", sampleNode.get("sampleType").get("code").asText());
-        assertEquals("CISD", sampleNode.get("space").get("code").asText());
-        assertEquals("EXP-WELLS", sampleNode.get("experiment").get("code").asText());
-        assertTrue(sampleNode.get("container").isNull());
-        assertEquals("{}", sampleNode.get("properties").toString());
-    }
-
-}
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/createSamples.json b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/createSamples.json
deleted file mode 100644
index f66f2e1558c..00000000000
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/createSamples.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
-	"method":"createSamples",
-	"params":[
-		"%s",
-		[
-			{
-				"@type" : "SampleCreation",
-
-				"typeId" : {
-					"@type" : "EntityTypePermId",
-					"permId" : "CELL_PLATE"
-					
-				},
-				
-				"code" : "%s",
-
-				"spaceId" : {
-					"@type" : "SpacePermId",
-					"permId" : "CISD"
-				},
-				
-				"experimentId" : {
-					"@type" : "ExperimentPermId",
-					"permId" : "200811050952663-1029" 
-				},
-				
-				"properties" : {
-					"COMMENT" : "hello"
-				}
-				
-			}
-		]
-	],
-	"id":"1",
-	"jsonrpc":"2.0"
-}
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/fetchOptions.json b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/fetchOptions.json
deleted file mode 100644
index 7a373938470..00000000000
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/fetchOptions.json
+++ /dev/null
@@ -1,51 +0,0 @@
-{
-	"@type" : "SampleFetchOptions",
-	
-	"sampleType" : {
-		"@type" : "SampleTypeFetchOptions"
-	},
-	
-	"space" : {
-		"@type" : "SpaceFetchOptions"
-	},
-	
-	"experiment" : {
-		"@type" : "ExperimentFetchOptions"
-	},
-	
-	"properties" : {
-		"@type" : "PropertyFetchOptions"
-	},
-	
-	"parents" : {
-		"@type" : "SampleFetchOptions"
-	},
-	
-	"children" : {
-		"@type" : "SampleFetchOptions"
-	},
-	
-	"container" : {
-		"@type" : "SampleFetchOptions"
-	},
-	
-	"contained" : {
-		"@type" : "SampleFetchOptions"
-	},
-	
-	"tags" : {
-		"@type" : "TagFetchOptions"
-	},
-	
-	"registrator" : {
-		"@type" : "PersonFetchOptions"
-	},
-	
-	"modifier" : {
-		"@type" : "PersonFetchOptions"
-	},
-	
-	"attachments" : {
-		"@type" : "AttachmentFetchOptions"
-	}
-}
\ No newline at end of file
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/listSamples.json b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/listSamples.json
deleted file mode 100644
index 8a51351db58..00000000000
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/listSamples.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
-	"method":"listSamples",
-	"params":[
-		"%s",
-		[
-			{"@type" : "SamplePermId", "permId" : "%s"}
-		],
-		%s
-	],
-	"id":"1",
-	"jsonrpc":"2.0"
-}
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/login.json b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/login.json
deleted file mode 100644
index 89d28a67819..00000000000
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/login.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
-	"method" : "login",
-	"params" : [
-		"test",
-		"password"
-	],
-	"id" : "1",
-	"jsonrpc" : "2.0"
-}
\ No newline at end of file
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/searchSamples.json b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/searchSamples.json
deleted file mode 100644
index 13a0f8854c5..00000000000
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/searchSamples.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
-    "method":"searchSamples",
-    "params":[
-        "%s",
-        {
-            "@type" : "SampleSearchCriterion",
-            "criteria" : [
-                 {
-                     "@type" : "CodeSearchCriterion",
-                     "fieldValue" : {
-                         "@type" : "StringEqualToValue",
-                         "value" : "%s"
-                     }
-                 }
-            ]
-        },
-        %s
-    ],
-    "id":"1",
-    "jsonrpc":"2.0"
-}
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/updateSamples.json b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/updateSamples.json
deleted file mode 100644
index 67b87c92be2..00000000000
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v3/SampleJsonTestResources/updateSamples.json
+++ /dev/null
@@ -1,49 +0,0 @@
-{
-	"method":"updateSamples",
-	"params":[
-		"%s",
-		[
-			{
-				"@type" : "SampleUpdate",
-				
-				"sampleId" : {
-					"@type" : "SampleIdentifier",
-					"identifier" : "%s"
-				},
-				
-				"spaceId" : {
-					"@type" : "SpacePermId",
-					"permId" : "CISD"
-				},
-				
-				"experimentId" : {
-					"@type" : "ExperimentPermId",
-					"permId" : "200811050952663-1030" 
-				},
-				
-				"containerId" : {
-					"@type" : "SampleIdentifier",
-					"identifier" : "/CISD/JSON_SAMPLE_TO_UPDATE_CONTAINER"
-				},
-				
-				"containedActions" : [
-					{
-						"@type" : "AddAction",
-						"ids" : [
-							{
-								"@type" : "SampleIdentifier",
-								"identifier" : "/CISD/JSON_SAMPLE_TO_UPDATE_CONTAINED"
-							}
-						]	
-					}
-				],
-				
-				"properties" : {
-					"COMMENT" : "hello 2"
-				}
-			}
-		]
-	],
-	"id":"1",
-	"jsonrpc":"2.0"
-}
-- 
GitLab