mirror of https://github.com/apache/nifi.git
NIFI-6852 This closes #3973. Don't Validate Processors that accept any ControllerService Implementation
NIFI-6852 Add Integration Tests for Controller Service API Validation Signed-off-by: Joe Witt <joewitt@apache.org>
This commit is contained in:
parent
2cc467eb58
commit
2c18cf22ad
|
@ -719,6 +719,10 @@ public abstract class AbstractComponentNode implements ComponentNode {
|
|||
|
||||
private ValidationResult validateControllerServiceApi(final PropertyDescriptor descriptor, final ControllerServiceNode controllerServiceNode) {
|
||||
final Class<? extends ControllerService> controllerServiceApiClass = descriptor.getControllerServiceDefinition();
|
||||
// If a processor accepts any service don't validate it.
|
||||
if (controllerServiceApiClass.equals(ControllerService.class)) {
|
||||
return null;
|
||||
}
|
||||
final ClassLoader controllerServiceApiClassLoader = controllerServiceApiClass.getClassLoader();
|
||||
final ExtensionManager extensionManager = serviceProvider.getExtensionManager();
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.nifi.cs.tests.system;
|
||||
|
||||
import org.apache.nifi.controller.AbstractControllerService;
|
||||
|
||||
public class FakeControllerService1 extends AbstractControllerService {
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.nifi.processors.tests.system;
|
||||
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.components.Validator;
|
||||
import org.apache.nifi.controller.ControllerService;
|
||||
import org.apache.nifi.cs.tests.system.FakeControllerService1;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.ProcessorInitializationContext;
|
||||
import org.apache.nifi.processor.Relationship;
|
||||
import org.apache.nifi.processor.exception.ProcessException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class FakeDynamicPropertiesProcessor extends AbstractProcessor {
|
||||
private List<PropertyDescriptor> properties;
|
||||
private Set<Relationship> relationships;
|
||||
|
||||
@Override
|
||||
protected void init(final ProcessorInitializationContext context) {
|
||||
final List<PropertyDescriptor> properties = new ArrayList<>();
|
||||
this.properties = Collections.unmodifiableList(properties);
|
||||
|
||||
final Set<Relationship> relationships = new HashSet<>();
|
||||
this.relationships = Collections.unmodifiableSet(relationships);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(final String propertyDescriptorName) {
|
||||
if (propertyDescriptorName.startsWith("CS.")) {
|
||||
return new PropertyDescriptor.Builder()
|
||||
.name(propertyDescriptorName)
|
||||
.required(false)
|
||||
.dynamic(true)
|
||||
.identifiesControllerService(ControllerService.class)
|
||||
.build();
|
||||
}
|
||||
if (propertyDescriptorName.startsWith("FCS.")) {
|
||||
return new PropertyDescriptor.Builder()
|
||||
.name(propertyDescriptorName)
|
||||
.required(false)
|
||||
.dynamic(true)
|
||||
.identifiesControllerService(FakeControllerService1.class)
|
||||
.build();
|
||||
}
|
||||
return new PropertyDescriptor.Builder()
|
||||
.name(propertyDescriptorName)
|
||||
.required(false)
|
||||
.addValidator(Validator.VALID)
|
||||
.dynamic(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Relationship> getRelationships() {
|
||||
return relationships;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.nifi.processors.tests.system;
|
||||
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.cs.tests.system.FakeControllerService1;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.ProcessorInitializationContext;
|
||||
import org.apache.nifi.processor.Relationship;
|
||||
import org.apache.nifi.processor.exception.ProcessException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class FakeProcessor extends AbstractProcessor {
|
||||
private List<PropertyDescriptor> properties;
|
||||
private Set<Relationship> relationships;
|
||||
|
||||
public static final PropertyDescriptor FAKE_SERVICE = new PropertyDescriptor.Builder()
|
||||
.name("Fake Service")
|
||||
.description("The Fake Service Being Tested")
|
||||
.required(true)
|
||||
.identifiesControllerService(FakeControllerService1.class)
|
||||
.build();
|
||||
|
||||
@Override
|
||||
protected void init(final ProcessorInitializationContext context) {
|
||||
final List<PropertyDescriptor> properties = new ArrayList<>();
|
||||
properties.add(FAKE_SERVICE);
|
||||
this.properties = Collections.unmodifiableList(properties);
|
||||
|
||||
final Set<Relationship> relationships = new HashSet<>();
|
||||
this.relationships = Collections.unmodifiableSet(relationships);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Relationship> getRelationships() {
|
||||
return relationships;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
|
||||
|
||||
}
|
||||
}
|
|
@ -13,4 +13,5 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
org.apache.nifi.cs.tests.system.StandardSleepService
|
||||
org.apache.nifi.cs.tests.system.StandardSleepService
|
||||
org.apache.nifi.cs.tests.system.FakeControllerService1
|
|
@ -16,4 +16,6 @@
|
|||
org.apache.nifi.processors.tests.system.CountEvents
|
||||
org.apache.nifi.processors.tests.system.GenerateFlowFile
|
||||
org.apache.nifi.processors.tests.system.Sleep
|
||||
org.apache.nifi.processors.tests.system.ValidateFileExists
|
||||
org.apache.nifi.processors.tests.system.ValidateFileExists
|
||||
org.apache.nifi.processors.tests.system.FakeProcessor
|
||||
org.apache.nifi.processors.tests.system.FakeDynamicPropertiesProcessor
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-system-test-extensions2-bundle</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>nifi-system-test-extensions2-nar</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<packaging>nar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-system-test-extensions2</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-standard-services-api-nar</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<type>nar</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-nar-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<enforceDocGeneration>false</enforceDocGeneration>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>nifi-system-test-extensions2-bundle</artifactId>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>nifi-system-test-extensions2</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-api</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-utils</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.nifi.cs.tests.system;
|
||||
|
||||
import org.apache.nifi.controller.AbstractControllerService;
|
||||
|
||||
public class FakeControllerService2 extends AbstractControllerService {
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.nifi.processors.tests.system;
|
||||
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.controller.ControllerService;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.ProcessorInitializationContext;
|
||||
import org.apache.nifi.processor.Relationship;
|
||||
import org.apache.nifi.processor.exception.ProcessException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class FakeGenericProcessor extends AbstractProcessor {
|
||||
private List<PropertyDescriptor> properties;
|
||||
private Set<Relationship> relationships;
|
||||
|
||||
public static final PropertyDescriptor FAKE_SERVICE = new PropertyDescriptor.Builder()
|
||||
.name("Fake Service")
|
||||
.description("The Fake Service Being Tested")
|
||||
.required(true)
|
||||
.identifiesControllerService(ControllerService.class)
|
||||
.build();
|
||||
|
||||
@Override
|
||||
protected void init(final ProcessorInitializationContext context) {
|
||||
final List<PropertyDescriptor> properties = new ArrayList<>();
|
||||
properties.add(FAKE_SERVICE);
|
||||
this.properties = Collections.unmodifiableList(properties);
|
||||
|
||||
final Set<Relationship> relationships = new HashSet<>();
|
||||
this.relationships = Collections.unmodifiableSet(relationships);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Relationship> getRelationships() {
|
||||
return relationships;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
# 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.
|
||||
|
||||
org.apache.nifi.cs.tests.system.FakeControllerService2
|
|
@ -0,0 +1,16 @@
|
|||
# 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.
|
||||
|
||||
org.apache.nifi.processors.tests.system.FakeGenericProcessor
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>nifi-system-tests</artifactId>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>nifi-system-test-extensions2-bundle</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>nifi-system-test-extensions2</module>
|
||||
<module>nifi-system-test-extensions2-nar</module>
|
||||
</modules>
|
||||
|
||||
|
||||
</project>
|
|
@ -173,6 +173,12 @@
|
|||
<version>1.11.0-SNAPSHOT</version>
|
||||
<type>nar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-system-test-extensions2-nar</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<type>nar</type>
|
||||
</dependency>
|
||||
|
||||
<!-- dependencies for jaxb/activation/annotation for running NiFi on Java 11 -->
|
||||
<!-- TODO: remove these once minimum Java version is 11 -->
|
||||
|
|
|
@ -0,0 +1,138 @@
|
|||
package org.apache.nifi.tests.system.controllerservice;
|
||||
|
||||
import org.apache.nifi.tests.system.NiFiSystemIT;
|
||||
import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
||||
import org.apache.nifi.web.api.entity.ControllerServiceEntity;
|
||||
import org.apache.nifi.web.api.entity.ControllerServiceRunStatusEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class ControllerServiceApiValidationIT extends NiFiSystemIT {
|
||||
@Test
|
||||
public void testMatchingControllerService() throws NiFiClientException, IOException {
|
||||
final ControllerServiceEntity fakeServiceEntity = getClientUtil().createControllerService("FakeControllerService1");
|
||||
final ProcessorEntity fakeProcessorEntity = getClientUtil().createProcessor("FakeProcessor");
|
||||
fakeProcessorEntity.getComponent().getConfig().setProperties(Collections.singletonMap("Fake Service", fakeServiceEntity.getId()));
|
||||
getNifiClient().getProcessorClient().updateProcessor(fakeProcessorEntity);
|
||||
final ControllerServiceRunStatusEntity runStatusEntity = new ControllerServiceRunStatusEntity();
|
||||
runStatusEntity.setState("ENABLED");
|
||||
runStatusEntity.setRevision(fakeServiceEntity.getRevision());
|
||||
getNifiClient().getControllerServicesClient().activateControllerService(fakeServiceEntity.getId(), runStatusEntity);
|
||||
getClientUtil().waitForControllerSerivcesEnabled("root");
|
||||
String controllerStatus = getNifiClient().getControllerServicesClient().getControllerService(fakeServiceEntity.getId()).getStatus().getRunStatus();
|
||||
String processorStatus = getNifiClient().getProcessorClient().getProcessor(fakeProcessorEntity.getId()).getStatus().getRunStatus();
|
||||
|
||||
assertEquals("ENABLED", controllerStatus);
|
||||
assertEquals("Stopped", processorStatus);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMatchingDynamicPropertyControllerService() throws NiFiClientException, IOException {
|
||||
final ControllerServiceEntity fakeServiceEntity = getClientUtil().createControllerService("FakeControllerService1");
|
||||
final ProcessorEntity fakeProcessorEntity = getClientUtil().createProcessor("FakeDynamicPropertiesProcessor");
|
||||
fakeProcessorEntity.getComponent().getConfig().setProperties(Collections.singletonMap("FCS.fakeControllerService", fakeServiceEntity.getId()));
|
||||
getNifiClient().getProcessorClient().updateProcessor(fakeProcessorEntity);
|
||||
final ControllerServiceRunStatusEntity runStatusEntity = new ControllerServiceRunStatusEntity();
|
||||
runStatusEntity.setState("ENABLED");
|
||||
runStatusEntity.setRevision(fakeServiceEntity.getRevision());
|
||||
getNifiClient().getControllerServicesClient().activateControllerService(fakeServiceEntity.getId(), runStatusEntity);
|
||||
getClientUtil().waitForControllerSerivcesEnabled("root");
|
||||
String controllerStatus = getNifiClient().getControllerServicesClient().getControllerService(fakeServiceEntity.getId()).getStatus().getRunStatus();
|
||||
String processorStatus = getNifiClient().getProcessorClient().getProcessor(fakeProcessorEntity.getId()).getStatus().getRunStatus();
|
||||
|
||||
assertEquals("ENABLED", controllerStatus);
|
||||
assertEquals("Stopped", processorStatus);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonMatchingControllerService() throws NiFiClientException, IOException {
|
||||
final ControllerServiceEntity fakeServiceEntity = getClientUtil().createControllerService(
|
||||
NiFiSystemIT.TEST_CS_PACKAGE + ".FakeControllerService2",
|
||||
"root",
|
||||
NiFiSystemIT.NIFI_GROUP_ID,
|
||||
"nifi-system-test-extensions2-nar",
|
||||
getNiFiVersion());
|
||||
final ProcessorEntity fakeProcessorEntity = getClientUtil().createProcessor("FakeProcessor");
|
||||
fakeProcessorEntity.getComponent().getConfig().setProperties(Collections.singletonMap("Fake Service", fakeServiceEntity.getId()));
|
||||
getNifiClient().getProcessorClient().updateProcessor(fakeProcessorEntity);
|
||||
final ControllerServiceRunStatusEntity runStatusEntity = new ControllerServiceRunStatusEntity();
|
||||
runStatusEntity.setState("ENABLED");
|
||||
runStatusEntity.setRevision(fakeServiceEntity.getRevision());
|
||||
getNifiClient().getControllerServicesClient().activateControllerService(fakeServiceEntity.getId(), runStatusEntity);
|
||||
getClientUtil().waitForControllerSerivcesEnabled("root");
|
||||
String controllerStatus = getNifiClient().getControllerServicesClient().getControllerService(fakeServiceEntity.getId()).getStatus().getRunStatus();
|
||||
String processorStatus = getNifiClient().getProcessorClient().getProcessor(fakeProcessorEntity.getId()).getStatus().getRunStatus();
|
||||
|
||||
assertEquals("ENABLED", controllerStatus);
|
||||
assertEquals("Invalid", processorStatus);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonMatchingDynamicPropertyControllerService() throws NiFiClientException, IOException {
|
||||
final ControllerServiceEntity fakeServiceEntity = getClientUtil().createControllerService(
|
||||
NiFiSystemIT.TEST_CS_PACKAGE + ".FakeControllerService2",
|
||||
"root",
|
||||
NiFiSystemIT.NIFI_GROUP_ID,
|
||||
"nifi-system-test-extensions2-nar",
|
||||
getNiFiVersion());
|
||||
final ProcessorEntity fakeProcessorEntity = getClientUtil().createProcessor("FakeDynamicPropertiesProcessor");
|
||||
fakeProcessorEntity.getComponent().getConfig().setProperties(Collections.singletonMap("FCS.fakeControllerService", fakeServiceEntity.getId()));
|
||||
getNifiClient().getProcessorClient().updateProcessor(fakeProcessorEntity);
|
||||
final ControllerServiceRunStatusEntity runStatusEntity = new ControllerServiceRunStatusEntity();
|
||||
runStatusEntity.setState("ENABLED");
|
||||
runStatusEntity.setRevision(fakeServiceEntity.getRevision());
|
||||
getNifiClient().getControllerServicesClient().activateControllerService(fakeServiceEntity.getId(), runStatusEntity);
|
||||
getClientUtil().waitForControllerSerivcesEnabled("root");
|
||||
String controllerStatus = getNifiClient().getControllerServicesClient().getControllerService(fakeServiceEntity.getId()).getStatus().getRunStatus();
|
||||
String processorStatus = getNifiClient().getProcessorClient().getProcessor(fakeProcessorEntity.getId()).getStatus().getRunStatus();
|
||||
|
||||
assertEquals("ENABLED", controllerStatus);
|
||||
assertEquals("Invalid", processorStatus);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMatchingGenericControllerService() throws NiFiClientException, IOException {
|
||||
final ControllerServiceEntity fakeServiceEntity = getClientUtil().createControllerService("FakeControllerService1");
|
||||
final ProcessorEntity fakeProcessorEntity = getClientUtil().createProcessor(
|
||||
NiFiSystemIT.TEST_PROCESSORS_PACKAGE + ".FakeGenericProcessor",
|
||||
"root",
|
||||
NiFiSystemIT.NIFI_GROUP_ID,
|
||||
"nifi-system-test-extensions2-nar",
|
||||
getNiFiVersion());
|
||||
fakeProcessorEntity.getComponent().getConfig().setProperties(Collections.singletonMap("Fake Service", fakeServiceEntity.getId()));
|
||||
getNifiClient().getProcessorClient().updateProcessor(fakeProcessorEntity);
|
||||
final ControllerServiceRunStatusEntity runStatusEntity = new ControllerServiceRunStatusEntity();
|
||||
runStatusEntity.setState("ENABLED");
|
||||
runStatusEntity.setRevision(fakeServiceEntity.getRevision());
|
||||
getNifiClient().getControllerServicesClient().activateControllerService(fakeServiceEntity.getId(), runStatusEntity);
|
||||
getClientUtil().waitForControllerSerivcesEnabled("root");
|
||||
String controllerStatus = getNifiClient().getControllerServicesClient().getControllerService(fakeServiceEntity.getId()).getStatus().getRunStatus();
|
||||
String processorStatus = getNifiClient().getProcessorClient().getProcessor(fakeProcessorEntity.getId()).getStatus().getRunStatus();
|
||||
|
||||
assertEquals("ENABLED", controllerStatus);
|
||||
assertEquals("Stopped", processorStatus);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMatchingGenericDynamicPropertyControllerService() throws NiFiClientException, IOException {
|
||||
final ControllerServiceEntity fakeServiceEntity = getClientUtil().createControllerService("FakeControllerService1");
|
||||
final ProcessorEntity fakeProcessorEntity = getClientUtil().createProcessor("FakeDynamicPropertiesProcessor");
|
||||
fakeProcessorEntity.getComponent().getConfig().setProperties(Collections.singletonMap("CS.fakeControllerService", fakeServiceEntity.getId()));
|
||||
getNifiClient().getProcessorClient().updateProcessor(fakeProcessorEntity);
|
||||
final ControllerServiceRunStatusEntity runStatusEntity = new ControllerServiceRunStatusEntity();
|
||||
runStatusEntity.setState("ENABLED");
|
||||
runStatusEntity.setRevision(fakeServiceEntity.getRevision());
|
||||
getNifiClient().getControllerServicesClient().activateControllerService(fakeServiceEntity.getId(), runStatusEntity);
|
||||
getClientUtil().waitForControllerSerivcesEnabled("root");
|
||||
String controllerStatus = getNifiClient().getControllerServicesClient().getControllerService(fakeServiceEntity.getId()).getStatus().getRunStatus();
|
||||
String processorStatus = getNifiClient().getProcessorClient().getProcessor(fakeProcessorEntity.getId()).getStatus().getRunStatus();
|
||||
|
||||
assertEquals("ENABLED", controllerStatus);
|
||||
assertEquals("Stopped", processorStatus);
|
||||
}
|
||||
}
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
<modules>
|
||||
<module>nifi-system-test-extensions-bundle</module>
|
||||
<module>nifi-system-test-extensions2-bundle</module>
|
||||
<module>nifi-system-test-suite</module>
|
||||
</modules>
|
||||
|
||||
|
|
Loading…
Reference in New Issue