Skip to content

Commit 9cee4be

Browse files
committed
Improve, internal error publishing
1 parent 66de9a9 commit 9cee4be

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

nifi/cql-processor/nifi-cql-processors/src/test/java/org/george0st/processors/cql/PutCQLBase.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,19 @@ public void Close() throws InterruptedException {
9797
}
9898
}
9999

100-
protected FlowFile runTest(TestSetup setup, String content) {
100+
protected FlowFile runTest(TestSetup setup, String content) throws Exception {
101101
return runTestWithProperty(setup, content, null, null, false);
102102
}
103103

104-
protected FlowFile runTest(TestSetup setup, String content, boolean validate) {
104+
protected FlowFile runTest(TestSetup setup, String content, boolean validate) throws Exception {
105105
return runTestWithProperty(setup, content, null, null, validate);
106106
}
107107

108-
protected FlowFile runTestWithProperty(TestSetup setup, String content, PropertyDescriptor property, String propertyValue){
108+
protected FlowFile runTestWithProperty(TestSetup setup, String content, PropertyDescriptor property, String propertyValue) throws Exception {
109109
return runTestWithProperty(setup, content, property, propertyValue, false);
110110
}
111111

112-
protected FlowFile runTestWithProperty(TestSetup setup, String content, PropertyDescriptor property, String propertyValue, boolean validate){
112+
protected FlowFile runTestWithProperty(TestSetup setup, String content, PropertyDescriptor property, String propertyValue, boolean validate) throws Exception {
113113
HashMap<String, String> attributes = new HashMap<String, String>(Map.of("CQLName",setup.name));
114114
FlowFile result;
115115

@@ -123,7 +123,7 @@ protected FlowFile runTestWithProperty(TestSetup setup, String content, Property
123123
return result;
124124
}
125125

126-
private FlowFile coreTest(TestSetup setup, String content, boolean validate){
126+
private FlowFile coreTest(TestSetup setup, String content, boolean validate) throws Exception {
127127
try {
128128
long finish, start, countWrite, countRead;
129129
FlowFile result;
@@ -172,11 +172,11 @@ private FlowFile coreTest(TestSetup setup, String content, boolean validate){
172172
return result;
173173
}
174174
}
175-
return null;
176175
}
177-
catch(Exception ex) {
178-
return null;
176+
catch (Exception ex) {
177+
throw new Exception("Error in PROCESSOR");
179178
}
179+
return null;
180180
}
181181

182182
}

nifi/cql-processor/nifi-cql-processors/src/test/java/org/george0st/processors/cql/PutCQLErrorFunction.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public PutCQLErrorFunction() throws IOException, InterruptedException, Initializ
3333
}
3434

3535
@Test
36-
public void testErrorNonExistColumnInCSV() {
36+
public void testErrorNonExistColumnInCSV() throws Exception {
3737
String content = "aaa\n" +
3838
"0\n" +
3939
"1\n";
@@ -46,7 +46,7 @@ public void testErrorNonExistColumnInCSV() {
4646
}
4747

4848
@Test
49-
public void testErrorMissingPrimaryKeyColumnInCSV() {
49+
public void testErrorMissingPrimaryKeyColumnInCSV() throws Exception {
5050
String content = "colbigint\n" +
5151
"0\n" +
5252
"1\n";
@@ -59,7 +59,7 @@ public void testErrorMissingPrimaryKeyColumnInCSV() {
5959
}
6060

6161
@Test
62-
public void testErrorInvalidIntTypeValueInCSV() {
62+
public void testErrorInvalidIntTypeValueInCSV() throws Exception {
6363
String content = "colbigint,colint\n" +
6464
"0,Peter\n" +
6565
"1,John\n";
@@ -72,7 +72,7 @@ public void testErrorInvalidIntTypeValueInCSV() {
7272
}
7373

7474
@Test
75-
public void testErrorInvalidFloatTypeValueInCSV() {
75+
public void testErrorInvalidFloatTypeValueInCSV() throws Exception {
7676
String content = "colbigint,colint,colfloat\n" +
7777
"0,1064,Peter\n" +
7878
"1,1709,John\n";

nifi/cql-processor/nifi-cql-processors/src/test/java/org/george0st/processors/cql/PutCQLFunction.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public PutCQLFunction() throws IOException, InterruptedException, Initialization
3434
}
3535

3636
@Test
37-
public void testBasic() {
37+
public void testBasic() throws Exception {
3838
String content = "\"colbigint\",\"colint\",\"coltext\",\"colfloat\",\"coldouble\",\"coldate\",\"coltime\",\"coltimestamp\",\"colboolean\",\"coluuid\",\"colsmallint\",\"coltinyint\",\"coltimeuuid\",\"colvarchar\"\n" +
3939
"\"0\",\"1064\",\"zeVOKGnORq\",\"627.6811\",\"395.8522407512559\",\"1971-11-12\",\"03:37:15\",\"2000-09-25T22:18:45Z\",\"false\",\"6080071f-4dd1-4ea5-b711-9ad0716e242a\",\"8966\",\"55\",\"f45e58f5-c3b7-11ef-8d19-97ae87be7c54\",\"Tzxsw\"\n" +
4040
"\"1\",\"1709\",\"7By0z5QEXh\",\"652.03955\",\"326.9081263857284\",\"2013-12-17\",\"08:43:09\",\"2010-04-27T07:02:27Z\",\"false\",\"7d511666-2f81-41c4-9d5c-a5fa87f7d1c3\",\"24399\",\"38\",\"f45e8006-c3b7-11ef-8d19-172ff8d0d752\",\"exAbN\"\n" +
@@ -51,7 +51,7 @@ public void testBasic() {
5151
}
5252

5353
@Test
54-
public void testBatchLoggedTypes() {
54+
public void testBatchLoggedTypes() throws Exception {
5555
String content = "\"colbigint\",\"colint\",\"coltext\",\"colfloat\",\"coldouble\",\"coldate\",\"coltime\",\"coltimestamp\",\"colboolean\",\"coluuid\",\"colsmallint\",\"coltinyint\",\"coltimeuuid\",\"colvarchar\"\n" +
5656
"\"0\",\"1064\",\"zeVOKGnORq\",\"627.6811\",\"395.8522407512559\",\"1971-11-12\",\"03:37:15\",\"2000-09-25T22:18:45Z\",\"false\",\"6080071f-4dd1-4ea5-b711-9ad0716e242a\",\"8966\",\"55\",\"f45e58f5-c3b7-11ef-8d19-97ae87be7c54\",\"Tzxsw\"\n" +
5757
"\"1\",\"1709\",\"7By0z5QEXh\",\"652.03955\",\"326.9081263857284\",\"2013-12-17\",\"08:43:09\",\"2010-04-27T07:02:27Z\",\"false\",\"7d511666-2f81-41c4-9d5c-a5fa87f7d1c3\",\"24399\",\"38\",\"f45e8006-c3b7-11ef-8d19-172ff8d0d752\",\"exAbN\"\n" +
@@ -68,7 +68,7 @@ public void testBatchLoggedTypes() {
6868
}
6969

7070
@Test
71-
public void testBatchUnLoggedTypes() {
71+
public void testBatchUnLoggedTypes() throws Exception {
7272
String content = "\"colbigint\",\"colint\",\"coltext\",\"colfloat\",\"coldouble\",\"coldate\",\"coltime\",\"coltimestamp\",\"colboolean\",\"coluuid\",\"colsmallint\",\"coltinyint\",\"coltimeuuid\",\"colvarchar\"\n" +
7373
"\"0\",\"1064\",\"zeVOKGnORq\",\"627.6811\",\"395.8522407512559\",\"1971-11-12\",\"03:37:15\",\"2000-09-25T22:18:45Z\",\"false\",\"6080071f-4dd1-4ea5-b711-9ad0716e242a\",\"8966\",\"55\",\"f45e58f5-c3b7-11ef-8d19-97ae87be7c54\",\"Tzxsw\"\n" +
7474
"\"1\",\"1709\",\"7By0z5QEXh\",\"652.03955\",\"326.9081263857284\",\"2013-12-17\",\"08:43:09\",\"2010-04-27T07:02:27Z\",\"false\",\"7d511666-2f81-41c4-9d5c-a5fa87f7d1c3\",\"24399\",\"38\",\"f45e8006-c3b7-11ef-8d19-172ff8d0d752\",\"exAbN\"\n" +
@@ -85,7 +85,7 @@ public void testBatchUnLoggedTypes() {
8585
}
8686

8787
@Test
88-
public void testMoreItems() {
88+
public void testMoreItems() throws Exception {
8989
String content = "\"colbigint\",\"colint\",\"coltext\",\"colfloat\",\"coldouble\",\"coldate\",\"coltime\",\"coltimestamp\",\"colboolean\",\"coluuid\",\"colsmallint\",\"coltinyint\",\"coltimeuuid\",\"colvarchar\"\n" +
9090
"\"0\",\"1064\",\"zeVOKGnORq\",\"627.6811\",\"395.8522407512559\",\"1971-11-12\",\"03:37:15\",\"2000-09-25T22:18:45Z\",\"false\",\"6080071f-4dd1-4ea5-b711-9ad0716e242a\",\"8966\",\"55\",\"f45e58f5-c3b7-11ef-8d19-97ae87be7c54\",\"Tzxsw\"\n" +
9191
"\"1\",\"1709\",\"7By0z5QEXh\",\"652.03955\",\"326.9081263857284\",\"2013-12-17\",\"08:43:09\",\"2010-04-27T07:02:27Z\",\"false\",\"7d511666-2f81-41c4-9d5c-a5fa87f7d1c3\",\"24399\",\"38\",\"f45e8006-c3b7-11ef-8d19-172ff8d0d752\",\"exAbN\"\n" +
@@ -115,7 +115,7 @@ public void testMoreItems() {
115115
}
116116

117117
@Test
118-
public void testNoQuotas() {
118+
public void testNoQuotas() throws Exception {
119119
String content = "colbigint,colint,coltext,colfloat,coldouble,coldate,coltime,coltimestamp,colboolean,coluuid,colsmallint,coltinyint,coltimeuuid,colvarchar\n" +
120120
"10,1064,zeVOKGnORq,627.6811,395.8522407512559,1971-11-12,03:37:15,2000-09-25T22:18:45Z,false,6080071f-4dd1-4ea5-b711-9ad0716e242a,8966,55,f45e58f5-c3b7-11ef-8d19-97ae87be7c54,Tzxsw\n" +
121121
"11,1709,7By0z5QEXh,652.03955,326.9081263857284,2013-12-17,08:43:09,2010-04-27T07:02:27Z,false,7d511666-2f81-41c4-9d5c-a5fa87f7d1c3,24399,38,f45e8006-c3b7-11ef-8d19-172ff8d0d752,exAbN\n" +
@@ -132,7 +132,7 @@ public void testNoQuotas() {
132132
}
133133

134134
@Test
135-
public void testEmptyInput() {
135+
public void testEmptyInput() throws Exception {
136136
String content = "";
137137
FlowFile result;
138138

@@ -145,7 +145,7 @@ public void testEmptyInput() {
145145
}
146146

147147
@Test
148-
public void testOnlyHeader() {
148+
public void testOnlyHeader() throws Exception {
149149
String content = "\"colbigint\",\"colint\",\"coltext\",\"colfloat\",\"coldouble\",\"coldate\",\"coltime\",\"coltimestamp\",\"colboolean\",\"coluuid\",\"colsmallint\",\"coltinyint\",\"coltimeuuid\",\"colvarchar\"\n";
150150
FlowFile result;
151151

@@ -158,7 +158,7 @@ public void testOnlyHeader() {
158158
}
159159

160160
@Test
161-
public void testOnlyHeaderNoQuotas() {
161+
public void testOnlyHeaderNoQuotas() throws Exception {
162162
String content = "colbigint,colint,coltext,colfloat,coldouble,coldate,coltime,coltimestamp,colboolean,coluuid,colsmallint,coltinyint,coltimeuuid,colvarchar\n";
163163
FlowFile result;
164164

@@ -171,7 +171,7 @@ public void testOnlyHeaderNoQuotas() {
171171
}
172172

173173
@Test
174-
public void testBasicRepeat5() {
174+
public void testBasicRepeat5() throws Exception {
175175
String content = "\"colbigint\",\"colint\",\"coltext\",\"colfloat\",\"coldouble\",\"coldate\",\"coltime\",\"coltimestamp\",\"colboolean\",\"coluuid\",\"colsmallint\",\"coltinyint\",\"coltimeuuid\",\"colvarchar\"\n" +
176176
"\"0\",\"1064\",\"zeVOKGnORq\",\"627.6811\",\"395.8522407512559\",\"1971-11-12\",\"03:37:15\",\"2000-09-25T22:18:45Z\",\"false\",\"6080071f-4dd1-4ea5-b711-9ad0716e242a\",\"8966\",\"55\",\"f45e58f5-c3b7-11ef-8d19-97ae87be7c54\",\"Tzxsw\"\n" +
177177
"\"1\",\"1709\",\"7By0z5QEXh\",\"652.03955\",\"326.9081263857284\",\"2013-12-17\",\"08:43:09\",\"2010-04-27T07:02:27Z\",\"false\",\"7d511666-2f81-41c4-9d5c-a5fa87f7d1c3\",\"24399\",\"38\",\"f45e8006-c3b7-11ef-8d19-172ff8d0d752\",\"exAbN\"\n" +
@@ -190,7 +190,7 @@ public void testBasicRepeat5() {
190190
}
191191

192192
@Test
193-
public void testNoQuotas2() {
193+
public void testNoQuotas2() throws Exception {
194194
String content = "colbigint,colint,coltext,colfloat,coldouble,coldate,coltime,coltimestamp,colboolean,coluuid,colsmallint,coltinyint,coltimeuuid,colvarchar\n" +
195195
"0,1064,zeVOKGnORq,627.6811,395.8522407512559,1971-11-12,03:37:15,2000-09-25T22:18:45Z,false,6080071f-4dd1-4ea5-b711-9ad0716e242a,8966,55,f45e58f5-c3b7-11ef-8d19-97ae87be7c54,Tzxswn\n" +
196196
"1,1709,7By0z5QEXh,652.03955,326.9081263857284,2013-12-17,08:43:09,2010-04-27T07:02:27Z,false,7d511666-2f81-41c4-9d5c-a5fa87f7d1c3,24399,38,f45e8006-c3b7-11ef-8d19-172ff8d0d752,exAbNn\n" +

0 commit comments

Comments
 (0)