dan-s1 commented on code in PR #8573:
URL: https://github.com/apache/nifi/pull/8573#discussion_r1540151244
##########
nifi-nar-bundles/nifi-py4j-bundle/nifi-py4j-bridge/src/test/java/org/apache/nifi/py4j/PythonProcessTest.java:
##########
@@ -56,51 +56,46 @@ class PythonProcessTest {
@BeforeEach
public void setUp() {
- this.pythonProcess = new PythonProcess(this.pythonProcessConfig,
this.controllerServiceTypeLookup, virtualEnvHome, "Controller", "Controller");
+ this.pythonProcess = new PythonProcess(this.pythonProcessConfig,
this.controllerServiceTypeLookup, virtualEnvHome, false, "Controller",
"Controller");
+ }
+
+ @Test
+ void testUsesConfiguredValueWhenPackagedWithDependencies() throws
IOException {
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
+ final PythonProcess process = new
PythonProcess(this.pythonProcessConfig, this.controllerServiceTypeLookup,
virtualEnvHome, true, "Controller", "Controller");
+ assertEquals(PYTHON_CMD, process.resolvePythonCommand());
}
@Test
void testResolvePythonCommandWindows() throws IOException {
- final File scriptsDir = new File(virtualEnvHome, WINDOWS_SCRIPTS_DIR);
- assertTrue(scriptsDir.mkdir());
+ final File scriptsDir = new File(virtualEnvHome, WINDOWS_SCRIPTS_DIR);
assertTrue(scriptsDir.mkdir());
- when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
- final String result = this.pythonProcess.resolvePythonCommand();
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
final String result = this.pythonProcess.resolvePythonCommand();
- final String expected = getExpectedBinaryPath(WINDOWS_SCRIPTS_DIR);
- assertEquals(expected, result);
+ final String expected = getExpectedBinaryPath(WINDOWS_SCRIPTS_DIR);
assertEquals(expected, result);
}
@Test
void testResolvePythonCommandUnix() throws IOException {
- final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
- assertTrue(binDir.mkdir());
+ final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
assertTrue(binDir.mkdir());
Review Comment:
```suggestion
final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
assertTrue(binDir.mkdir());
```
##########
nifi-nar-bundles/nifi-py4j-bundle/nifi-py4j-bridge/src/test/java/org/apache/nifi/py4j/PythonProcessTest.java:
##########
@@ -56,51 +56,46 @@ class PythonProcessTest {
@BeforeEach
public void setUp() {
- this.pythonProcess = new PythonProcess(this.pythonProcessConfig,
this.controllerServiceTypeLookup, virtualEnvHome, "Controller", "Controller");
+ this.pythonProcess = new PythonProcess(this.pythonProcessConfig,
this.controllerServiceTypeLookup, virtualEnvHome, false, "Controller",
"Controller");
+ }
+
+ @Test
+ void testUsesConfiguredValueWhenPackagedWithDependencies() throws
IOException {
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
+ final PythonProcess process = new
PythonProcess(this.pythonProcessConfig, this.controllerServiceTypeLookup,
virtualEnvHome, true, "Controller", "Controller");
+ assertEquals(PYTHON_CMD, process.resolvePythonCommand());
}
@Test
void testResolvePythonCommandWindows() throws IOException {
- final File scriptsDir = new File(virtualEnvHome, WINDOWS_SCRIPTS_DIR);
- assertTrue(scriptsDir.mkdir());
+ final File scriptsDir = new File(virtualEnvHome, WINDOWS_SCRIPTS_DIR);
assertTrue(scriptsDir.mkdir());
- when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
- final String result = this.pythonProcess.resolvePythonCommand();
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
final String result = this.pythonProcess.resolvePythonCommand();
- final String expected = getExpectedBinaryPath(WINDOWS_SCRIPTS_DIR);
- assertEquals(expected, result);
+ final String expected = getExpectedBinaryPath(WINDOWS_SCRIPTS_DIR);
assertEquals(expected, result);
}
@Test
void testResolvePythonCommandUnix() throws IOException {
- final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
- assertTrue(binDir.mkdir());
+ final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
assertTrue(binDir.mkdir());
- when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
- final String result = this.pythonProcess.resolvePythonCommand();
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
final String result = this.pythonProcess.resolvePythonCommand();
- final String expected = getExpectedBinaryPath(UNIX_BIN_DIR);
- assertEquals(expected, result);
+ final String expected = getExpectedBinaryPath(UNIX_BIN_DIR);
assertEquals(expected, result);
Review Comment:
```suggestion
final String expected = getExpectedBinaryPath(UNIX_BIN_DIR);
assertEquals(expected, result);
```
##########
nifi-nar-bundles/nifi-py4j-bundle/nifi-py4j-bridge/src/test/java/org/apache/nifi/py4j/PythonProcessTest.java:
##########
@@ -56,51 +56,46 @@ class PythonProcessTest {
@BeforeEach
public void setUp() {
- this.pythonProcess = new PythonProcess(this.pythonProcessConfig,
this.controllerServiceTypeLookup, virtualEnvHome, "Controller", "Controller");
+ this.pythonProcess = new PythonProcess(this.pythonProcessConfig,
this.controllerServiceTypeLookup, virtualEnvHome, false, "Controller",
"Controller");
+ }
+
+ @Test
+ void testUsesConfiguredValueWhenPackagedWithDependencies() throws
IOException {
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
+ final PythonProcess process = new
PythonProcess(this.pythonProcessConfig, this.controllerServiceTypeLookup,
virtualEnvHome, true, "Controller", "Controller");
+ assertEquals(PYTHON_CMD, process.resolvePythonCommand());
}
@Test
void testResolvePythonCommandWindows() throws IOException {
- final File scriptsDir = new File(virtualEnvHome, WINDOWS_SCRIPTS_DIR);
- assertTrue(scriptsDir.mkdir());
+ final File scriptsDir = new File(virtualEnvHome, WINDOWS_SCRIPTS_DIR);
assertTrue(scriptsDir.mkdir());
- when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
- final String result = this.pythonProcess.resolvePythonCommand();
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
final String result = this.pythonProcess.resolvePythonCommand();
- final String expected = getExpectedBinaryPath(WINDOWS_SCRIPTS_DIR);
- assertEquals(expected, result);
+ final String expected = getExpectedBinaryPath(WINDOWS_SCRIPTS_DIR);
assertEquals(expected, result);
}
@Test
void testResolvePythonCommandUnix() throws IOException {
- final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
- assertTrue(binDir.mkdir());
+ final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
assertTrue(binDir.mkdir());
- when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
- final String result = this.pythonProcess.resolvePythonCommand();
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
final String result = this.pythonProcess.resolvePythonCommand();
- final String expected = getExpectedBinaryPath(UNIX_BIN_DIR);
- assertEquals(expected, result);
+ final String expected = getExpectedBinaryPath(UNIX_BIN_DIR);
assertEquals(expected, result);
}
@Test
void testResolvePythonCommandPreferBin() throws IOException {
- final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
- assertTrue(binDir.mkdir());
- final File scriptsDir = new File(virtualEnvHome, WINDOWS_SCRIPTS_DIR);
- assertTrue(scriptsDir.mkdir());
+ final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
assertTrue(binDir.mkdir()); final File scriptsDir = new File(virtualEnvHome,
WINDOWS_SCRIPTS_DIR); assertTrue(scriptsDir.mkdir());
- when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
- final String result = this.pythonProcess.resolvePythonCommand();
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
final String result = this.pythonProcess.resolvePythonCommand();
- final String expected = getExpectedBinaryPath(UNIX_BIN_DIR);
- assertEquals(expected, result);
+ final String expected = getExpectedBinaryPath(UNIX_BIN_DIR);
assertEquals(expected, result);
}
@Test
void testResolvePythonCommandNone() {
- when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
- assertThrows(IOException.class, ()->
this.pythonProcess.resolvePythonCommand());
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
assertThrows(IOException.class, () ->
this.pythonProcess.resolvePythonCommand());
Review Comment:
```suggestion
when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
assertThrows(IOException.class, () ->
this.pythonProcess.resolvePythonCommand());
```
##########
nifi-nar-bundles/nifi-py4j-bundle/nifi-py4j-bridge/src/test/java/org/apache/nifi/py4j/PythonProcessTest.java:
##########
@@ -56,51 +56,46 @@ class PythonProcessTest {
@BeforeEach
public void setUp() {
- this.pythonProcess = new PythonProcess(this.pythonProcessConfig,
this.controllerServiceTypeLookup, virtualEnvHome, "Controller", "Controller");
+ this.pythonProcess = new PythonProcess(this.pythonProcessConfig,
this.controllerServiceTypeLookup, virtualEnvHome, false, "Controller",
"Controller");
+ }
+
+ @Test
+ void testUsesConfiguredValueWhenPackagedWithDependencies() throws
IOException {
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
+ final PythonProcess process = new
PythonProcess(this.pythonProcessConfig, this.controllerServiceTypeLookup,
virtualEnvHome, true, "Controller", "Controller");
+ assertEquals(PYTHON_CMD, process.resolvePythonCommand());
}
@Test
void testResolvePythonCommandWindows() throws IOException {
- final File scriptsDir = new File(virtualEnvHome, WINDOWS_SCRIPTS_DIR);
- assertTrue(scriptsDir.mkdir());
+ final File scriptsDir = new File(virtualEnvHome, WINDOWS_SCRIPTS_DIR);
assertTrue(scriptsDir.mkdir());
- when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
- final String result = this.pythonProcess.resolvePythonCommand();
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
final String result = this.pythonProcess.resolvePythonCommand();
- final String expected = getExpectedBinaryPath(WINDOWS_SCRIPTS_DIR);
- assertEquals(expected, result);
+ final String expected = getExpectedBinaryPath(WINDOWS_SCRIPTS_DIR);
assertEquals(expected, result);
}
@Test
void testResolvePythonCommandUnix() throws IOException {
- final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
- assertTrue(binDir.mkdir());
+ final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
assertTrue(binDir.mkdir());
- when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
- final String result = this.pythonProcess.resolvePythonCommand();
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
final String result = this.pythonProcess.resolvePythonCommand();
- final String expected = getExpectedBinaryPath(UNIX_BIN_DIR);
- assertEquals(expected, result);
+ final String expected = getExpectedBinaryPath(UNIX_BIN_DIR);
assertEquals(expected, result);
}
@Test
void testResolvePythonCommandPreferBin() throws IOException {
- final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
- assertTrue(binDir.mkdir());
- final File scriptsDir = new File(virtualEnvHome, WINDOWS_SCRIPTS_DIR);
- assertTrue(scriptsDir.mkdir());
+ final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
assertTrue(binDir.mkdir()); final File scriptsDir = new File(virtualEnvHome,
WINDOWS_SCRIPTS_DIR); assertTrue(scriptsDir.mkdir());
- when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
- final String result = this.pythonProcess.resolvePythonCommand();
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
final String result = this.pythonProcess.resolvePythonCommand();
- final String expected = getExpectedBinaryPath(UNIX_BIN_DIR);
- assertEquals(expected, result);
+ final String expected = getExpectedBinaryPath(UNIX_BIN_DIR);
assertEquals(expected, result);
Review Comment:
```suggestion
final String expected = getExpectedBinaryPath(UNIX_BIN_DIR);
assertEquals(expected, result);
```
##########
nifi-nar-bundles/nifi-py4j-bundle/nifi-py4j-bridge/src/test/java/org/apache/nifi/py4j/PythonProcessTest.java:
##########
@@ -56,51 +56,46 @@ class PythonProcessTest {
@BeforeEach
public void setUp() {
- this.pythonProcess = new PythonProcess(this.pythonProcessConfig,
this.controllerServiceTypeLookup, virtualEnvHome, "Controller", "Controller");
+ this.pythonProcess = new PythonProcess(this.pythonProcessConfig,
this.controllerServiceTypeLookup, virtualEnvHome, false, "Controller",
"Controller");
+ }
+
+ @Test
+ void testUsesConfiguredValueWhenPackagedWithDependencies() throws
IOException {
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
+ final PythonProcess process = new
PythonProcess(this.pythonProcessConfig, this.controllerServiceTypeLookup,
virtualEnvHome, true, "Controller", "Controller");
+ assertEquals(PYTHON_CMD, process.resolvePythonCommand());
}
@Test
void testResolvePythonCommandWindows() throws IOException {
- final File scriptsDir = new File(virtualEnvHome, WINDOWS_SCRIPTS_DIR);
- assertTrue(scriptsDir.mkdir());
+ final File scriptsDir = new File(virtualEnvHome, WINDOWS_SCRIPTS_DIR);
assertTrue(scriptsDir.mkdir());
- when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
- final String result = this.pythonProcess.resolvePythonCommand();
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
final String result = this.pythonProcess.resolvePythonCommand();
- final String expected = getExpectedBinaryPath(WINDOWS_SCRIPTS_DIR);
- assertEquals(expected, result);
+ final String expected = getExpectedBinaryPath(WINDOWS_SCRIPTS_DIR);
assertEquals(expected, result);
}
@Test
void testResolvePythonCommandUnix() throws IOException {
- final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
- assertTrue(binDir.mkdir());
+ final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
assertTrue(binDir.mkdir());
- when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
- final String result = this.pythonProcess.resolvePythonCommand();
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
final String result = this.pythonProcess.resolvePythonCommand();
- final String expected = getExpectedBinaryPath(UNIX_BIN_DIR);
- assertEquals(expected, result);
+ final String expected = getExpectedBinaryPath(UNIX_BIN_DIR);
assertEquals(expected, result);
}
@Test
void testResolvePythonCommandPreferBin() throws IOException {
- final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
- assertTrue(binDir.mkdir());
- final File scriptsDir = new File(virtualEnvHome, WINDOWS_SCRIPTS_DIR);
- assertTrue(scriptsDir.mkdir());
+ final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
assertTrue(binDir.mkdir()); final File scriptsDir = new File(virtualEnvHome,
WINDOWS_SCRIPTS_DIR); assertTrue(scriptsDir.mkdir());
Review Comment:
```suggestion
final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
assertTrue(binDir.mkdir());
final File scriptsDir = new File(virtualEnvHome,
WINDOWS_SCRIPTS_DIR);
assertTrue(scriptsDir.mkdir());
```
##########
nifi-nar-bundles/nifi-py4j-bundle/nifi-py4j-bridge/src/test/java/org/apache/nifi/py4j/PythonProcessTest.java:
##########
@@ -56,51 +56,46 @@ class PythonProcessTest {
@BeforeEach
public void setUp() {
- this.pythonProcess = new PythonProcess(this.pythonProcessConfig,
this.controllerServiceTypeLookup, virtualEnvHome, "Controller", "Controller");
+ this.pythonProcess = new PythonProcess(this.pythonProcessConfig,
this.controllerServiceTypeLookup, virtualEnvHome, false, "Controller",
"Controller");
+ }
+
+ @Test
+ void testUsesConfiguredValueWhenPackagedWithDependencies() throws
IOException {
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
+ final PythonProcess process = new
PythonProcess(this.pythonProcessConfig, this.controllerServiceTypeLookup,
virtualEnvHome, true, "Controller", "Controller");
+ assertEquals(PYTHON_CMD, process.resolvePythonCommand());
}
@Test
void testResolvePythonCommandWindows() throws IOException {
- final File scriptsDir = new File(virtualEnvHome, WINDOWS_SCRIPTS_DIR);
- assertTrue(scriptsDir.mkdir());
+ final File scriptsDir = new File(virtualEnvHome, WINDOWS_SCRIPTS_DIR);
assertTrue(scriptsDir.mkdir());
- when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
- final String result = this.pythonProcess.resolvePythonCommand();
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
final String result = this.pythonProcess.resolvePythonCommand();
- final String expected = getExpectedBinaryPath(WINDOWS_SCRIPTS_DIR);
- assertEquals(expected, result);
+ final String expected = getExpectedBinaryPath(WINDOWS_SCRIPTS_DIR);
assertEquals(expected, result);
}
@Test
void testResolvePythonCommandUnix() throws IOException {
- final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
- assertTrue(binDir.mkdir());
+ final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
assertTrue(binDir.mkdir());
- when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
- final String result = this.pythonProcess.resolvePythonCommand();
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
final String result = this.pythonProcess.resolvePythonCommand();
- final String expected = getExpectedBinaryPath(UNIX_BIN_DIR);
- assertEquals(expected, result);
+ final String expected = getExpectedBinaryPath(UNIX_BIN_DIR);
assertEquals(expected, result);
}
@Test
void testResolvePythonCommandPreferBin() throws IOException {
- final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
- assertTrue(binDir.mkdir());
- final File scriptsDir = new File(virtualEnvHome, WINDOWS_SCRIPTS_DIR);
- assertTrue(scriptsDir.mkdir());
+ final File binDir = new File(virtualEnvHome, UNIX_BIN_DIR);
assertTrue(binDir.mkdir()); final File scriptsDir = new File(virtualEnvHome,
WINDOWS_SCRIPTS_DIR); assertTrue(scriptsDir.mkdir());
- when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
- final String result = this.pythonProcess.resolvePythonCommand();
+ when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
final String result = this.pythonProcess.resolvePythonCommand();
Review Comment:
```suggestion
when(pythonProcessConfig.getPythonCommand()).thenReturn(PYTHON_CMD);
final String result = this.pythonProcess.resolvePythonCommand();
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]