1
|
package eu.dnetlib.iis.core.examples.javamapreduce;
|
2
|
|
3
|
import java.io.IOException;
|
4
|
import java.util.List;
|
5
|
|
6
|
import org.apache.oozie.client.OozieClientException;
|
7
|
import org.junit.Test;
|
8
|
import org.junit.experimental.categories.Category;
|
9
|
|
10
|
import eu.dnetlib.iis.IntegrationTest;
|
11
|
import eu.dnetlib.iis.core.AbstractWorkflowTestCase;
|
12
|
import eu.dnetlib.iis.core.RemoteOozieAppManager;
|
13
|
import eu.dnetlib.iis.core.TestsIOUtils;
|
14
|
import eu.dnetlib.iis.core.examples.StandardDataStoreExamples;
|
15
|
import eu.dnetlib.iis.core.examples.schemas.documentandauthor.Person;
|
16
|
import eu.dnetlib.iis.core.examples.schemas.documentandauthor.PersonAge;
|
17
|
import eu.dnetlib.iis.core.examples.schemas.documentandauthor.personwithdocuments.PersonWithDocuments;
|
18
|
|
19
|
/**
|
20
|
*
|
21
|
* @author Mateusz Kobos
|
22
|
*
|
23
|
*/
|
24
|
@Category(IntegrationTest.class)
|
25
|
public class WorkflowTest extends AbstractWorkflowTestCase {
|
26
|
|
27
|
@Test
|
28
|
public void testClonerWithExplicitJSONSchema()
|
29
|
throws IOException, OozieClientException{
|
30
|
RemoteOozieAppManager appManager =
|
31
|
runWorkflow("eu/dnetlib/iis/core/examples/javamapreduce/cloner_with_explicit_schema/oozie_app");
|
32
|
|
33
|
List<Person> person =
|
34
|
appManager.readDataStoreFromWorkingDir("cloner/person");
|
35
|
|
36
|
TestsIOUtils.assertEqualSets(
|
37
|
StandardDataStoreExamples.getPersonRepeated(4),person);
|
38
|
}
|
39
|
|
40
|
@Test
|
41
|
public void testCloner()
|
42
|
throws IOException, OozieClientException{
|
43
|
RemoteOozieAppManager appManager = runWorkflow("eu/dnetlib/iis/core/examples/javamapreduce/cloner/oozie_app");
|
44
|
|
45
|
List<Person> person =
|
46
|
appManager.readDataStoreFromWorkingDir("cloner/person");
|
47
|
|
48
|
TestsIOUtils.assertEqualSets(
|
49
|
StandardDataStoreExamples.getPersonRepeated(4),person);
|
50
|
}
|
51
|
|
52
|
@Test
|
53
|
public void testReverseRelation()
|
54
|
throws IOException, OozieClientException{
|
55
|
RemoteOozieAppManager appManager =
|
56
|
runWorkflow("eu/dnetlib/iis/core/examples/javamapreduce/reverse_relation/oozie_app");
|
57
|
|
58
|
List<PersonWithDocuments> person =
|
59
|
appManager.readDataStoreFromWorkingDir("mr_reverse_relation/person");
|
60
|
|
61
|
TestsIOUtils.assertEqualSets(
|
62
|
StandardDataStoreExamples.getPersonWithDocumentsWithoutDocumentlessPersons(),
|
63
|
person);
|
64
|
}
|
65
|
|
66
|
@Test
|
67
|
public void testClonerWithoutReducer()
|
68
|
throws IOException, OozieClientException{
|
69
|
RemoteOozieAppManager appManager =
|
70
|
runWorkflow("eu/dnetlib/iis/core/examples/javamapreduce/cloner_without_reducer/oozie_app");
|
71
|
|
72
|
List<Person> person =
|
73
|
appManager.readDataStoreFromWorkingDir("cloner/person");
|
74
|
|
75
|
TestsIOUtils.assertEqualSets(
|
76
|
StandardDataStoreExamples.getPersonRepeated(4),person);
|
77
|
}
|
78
|
|
79
|
@Test
|
80
|
public void testClonerMultipleOutput()
|
81
|
throws IOException, OozieClientException{
|
82
|
RemoteOozieAppManager appManager =
|
83
|
runWorkflow("eu/dnetlib/iis/core/examples/javamapreduce/cloner_with_multiple_output/oozie_app");
|
84
|
|
85
|
List<Person> person =
|
86
|
appManager.readDataStoreFromWorkingDir("cloner/person");
|
87
|
TestsIOUtils.assertEqualSets(
|
88
|
StandardDataStoreExamples.getPersonRepeated(12), person); /*-?|2012-01-07 Cermine integration and MR multiple in-out|mafju|c4|?*/
|
89
|
|
90
|
List<PersonAge> personAge =
|
91
|
appManager.readDataStoreFromWorkingDir("mr_cloner/age");
|
92
|
TestsIOUtils.assertEqualSets(
|
93
|
StandardDataStoreExamples.getPersonAgeRepeated(6), personAge);
|
94
|
}
|
95
|
|
96
|
@Test
|
97
|
public void testClonerMultipleOutputWithExplicitJSONSchema()
|
98
|
throws IOException, OozieClientException{
|
99
|
RemoteOozieAppManager appManager =
|
100
|
runWorkflow("eu/dnetlib/iis/core/examples/javamapreduce/cloner_with_multiple_output_with_explicit_schema/oozie_app");
|
101
|
|
102
|
List<Person> person =
|
103
|
appManager.readDataStoreFromWorkingDir("cloner/person");
|
104
|
TestsIOUtils.assertEqualSets(
|
105
|
StandardDataStoreExamples.getPersonRepeated(12), person); /*-?|2012-01-07 Cermine integration and MR multiple in-out|mafju|c4|?*/
|
106
|
|
107
|
List<PersonAge> personAge =
|
108
|
appManager.readDataStoreFromWorkingDir("mr_cloner/age");
|
109
|
TestsIOUtils.assertEqualSets(
|
110
|
StandardDataStoreExamples.getPersonAgeRepeated(6), personAge);
|
111
|
}
|
112
|
|
113
|
@Test
|
114
|
public void testClonerMultipleOutputWithoutReducerWithExplicitJSONSchema()
|
115
|
throws IOException, OozieClientException{
|
116
|
|
117
|
RemoteOozieAppManager appManager =
|
118
|
runWorkflow("eu/dnetlib/iis/core/examples/javamapreduce/cloner_with_multiple_output_without_reducer_with_explicit_schema/oozie_app");
|
119
|
|
120
|
List<Person> person =
|
121
|
appManager.readDataStoreFromWorkingDir("cloner/person");
|
122
|
TestsIOUtils.assertEqualSets(
|
123
|
StandardDataStoreExamples.getPersonRepeated(4), person); /*-?|2012-01-07 Cermine integration and MR multiple in-out|mafju|c4|?*/
|
124
|
|
125
|
List<PersonAge> personAge =
|
126
|
appManager.readDataStoreFromWorkingDir("mr_cloner/age");
|
127
|
TestsIOUtils.assertEqualSets(
|
128
|
StandardDataStoreExamples.getPersonAgeRepeated(2), personAge);
|
129
|
}
|
130
|
|
131
|
@Test
|
132
|
public void testClonerMultipleOutputWithoutReducer() throws IOException, OozieClientException{
|
133
|
RemoteOozieAppManager appManager =
|
134
|
runWorkflow("eu/dnetlib/iis/core/examples/javamapreduce/cloner_with_multiple_output_without_reducer/oozie_app");
|
135
|
|
136
|
List<Person> person =
|
137
|
appManager.readDataStoreFromWorkingDir("cloner/person");
|
138
|
TestsIOUtils.assertEqualSets(
|
139
|
StandardDataStoreExamples.getPersonRepeated(4), person);
|
140
|
|
141
|
List<PersonAge> personAge =
|
142
|
appManager.readDataStoreFromWorkingDir("mr_cloner/age");
|
143
|
TestsIOUtils.assertEqualSets(
|
144
|
StandardDataStoreExamples.getPersonAgeRepeated(2), personAge);
|
145
|
}
|
146
|
|
147
|
@Test
|
148
|
public void testMultipleOuputsWithoutReducerWithEmptyInput() throws IOException, OozieClientException {
|
149
|
runWorkflow("eu/dnetlib/iis/core/examples/javamapreduce/cloner_with_multiple_output_without_reducer_with_empty_input/oozie_app");
|
150
|
}
|
151
|
|
152
|
@Test
|
153
|
public void testMultipleOuputsWithEmptyInput() throws IOException, OozieClientException {
|
154
|
runWorkflow("eu/dnetlib/iis/core/examples/javamapreduce/cloner_with_multiple_output_with_empty_input/oozie_app");
|
155
|
}
|
156
|
|
157
|
|
158
|
// @Test
|
159
|
// public void testMultipleSameTypeInputAndOutput() /*-?|2012-01-07 Cermine integration and MR multiple in-out|mafju|c7|?*/
|
160
|
// throws IOException, OozieClientException{
|
161
|
// RemoteOozieAppManager appManager =
|
162
|
// new RemoteOozieAppManager(getFileSystem(), getFsTestCaseDir(),
|
163
|
// "eu/dnetlib/iis/core/examples/javamapreduce/person_by_age_splitter/oozie_app");
|
164
|
//
|
165
|
// Properties jobProps = new Properties();
|
166
|
// jobProps.load(Thread.currentThread().getContextClassLoader().getResourceAsStream(
|
167
|
// "eu/dnetlib/iis/core/examples/javamapreduce/person_by_age_splitter/job.properties"));
|
168
|
// runWorkflow(appManager.getOozieAppPath(), appManager.getWorkingDir(), jobProps);
|
169
|
//
|
170
|
// List<Person> person =
|
171
|
// appManager.readDataStoreFromWorkingDir(
|
172
|
// Person.class, "cloner/person");
|
173
|
//
|
174
|
// assertEqualSets(StandardDataStoreExamples.getPersonRepeated(4),person);
|
175
|
//
|
176
|
// }
|
177
|
//
|
178
|
|
179
|
}
|