1
|
package org.cybertaxonomy.utis.refine;
|
2
|
|
3
|
import java.io.IOException;
|
4
|
import java.net.URISyntaxException;
|
5
|
|
6
|
import org.cybertaxonomy.utis.checklist.DRFChecklistException;
|
7
|
import org.cybertaxonomy.utis.refine.RefineClient;
|
8
|
import org.cybertaxonomy.utis.refine.RefineException;
|
9
|
import org.junit.Assert;
|
10
|
import org.junit.BeforeClass;
|
11
|
import org.junit.FixMethodOrder;
|
12
|
import org.junit.Ignore;
|
13
|
import org.junit.Test;
|
14
|
import org.junit.runners.MethodSorters;
|
15
|
|
16
|
|
17
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
18
|
public class RefineClientTest {
|
19
|
private static RefineClient refineClient;
|
20
|
private String jobID;
|
21
|
private static String csvData;
|
22
|
|
23
|
@BeforeClass
|
24
|
public static void setup() {
|
25
|
refineClient = new RefineClient("90.147.102.41","80");
|
26
|
csvData = "cola,colb,colc" + System.getProperty("line.separator") +
|
27
|
"vala1,valb1,valc1" + System.getProperty("line.separator") +
|
28
|
"vala2,valb2,valc2";
|
29
|
}
|
30
|
|
31
|
@Test
|
32
|
@Ignore // AK (06.01.2015) : can not fix this at the moment, test in error never fails, loops endlessly
|
33
|
public void uploadJobTest() throws IOException, DRFChecklistException, RefineException, URISyntaxException, InterruptedException {
|
34
|
jobID = refineClient.initJob();
|
35
|
System.out.println("jobID : " + jobID);
|
36
|
|
37
|
Assert.assertNotNull("jobID should not be null", jobID);
|
38
|
Assert.assertTrue("jobID should not be an empty string", !jobID.equals(""));
|
39
|
|
40
|
System.out.println("up test jobID : " + jobID);
|
41
|
String uploadResponse = refineClient.uploadData(csvData, jobID);
|
42
|
System.out.println("uploadResponse: " + uploadResponse);
|
43
|
|
44
|
System.out.println("checking import");
|
45
|
boolean checkImportJob = refineClient.checkImportJobStatus(jobID);
|
46
|
System.out.println("import job status : " + checkImportJob);
|
47
|
|
48
|
System.out.println("initialize parser");
|
49
|
refineClient.initializeParser(jobID);
|
50
|
|
51
|
System.out.println("update format");
|
52
|
String updateResponse = refineClient.updateFormat(jobID);
|
53
|
//System.out.println("update format response : " + updateResponse);
|
54
|
|
55
|
System.out.println("create project");
|
56
|
refineClient.createProject(jobID);
|
57
|
|
58
|
System.out.println("checking project creation");
|
59
|
String projectID = refineClient.checkCreateProjectStatus(jobID);
|
60
|
|
61
|
String data = refineClient.exportData(projectID);
|
62
|
System.out.println(data);
|
63
|
|
64
|
if(projectID != null) {
|
65
|
System.out.println("deleting project id : " + projectID);
|
66
|
refineClient.deleteProject(projectID);
|
67
|
}
|
68
|
}
|
69
|
|
70
|
|
71
|
|
72
|
|
73
|
}
|
74
|
|
75
|
|