mirror of https://github.com/apache/nifi.git
This commit is contained in:
parent
2916ce1ec8
commit
8e15392e2f
|
@ -225,6 +225,20 @@ public class ExecuteGroovyScriptTest {
|
|||
runner.setProperty(proc.SCRIPT_BODY, " { { ");
|
||||
runner.assertNotValid();
|
||||
}
|
||||
//---------------------------------------------------------
|
||||
@Test
|
||||
public void test_ctl_01_access() throws Exception {
|
||||
runner.setProperty(proc.SCRIPT_FILE, TEST_RESOURCE_LOCATION + "test_ctl_01_access.groovy");
|
||||
runner.setProperty("CTL.mydbcp", "dbcp"); //pass dbcp as a service to script
|
||||
runner.assertValid();
|
||||
|
||||
runner.run();
|
||||
|
||||
runner.assertAllFlowFilesTransferred(proc.REL_SUCCESS.getName(), 1);
|
||||
final List<MockFlowFile> result = runner.getFlowFilesForRelationship(proc.REL_SUCCESS.getName());
|
||||
MockFlowFile resultFile = result.get(0);
|
||||
resultFile.assertContentEquals("OK", "UTF-8");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_sql_01_select() throws Exception {
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
//just check that it's possible to access controller services
|
||||
def ff=session.create()
|
||||
def con=CTL.mydbcp.getConnection()
|
||||
assert con instanceof java.sql.Connection
|
||||
con.close();
|
||||
ff.write('UTF-8', 'OK')
|
||||
REL_SUCCESS<<ff
|
Loading…
Reference in New Issue