-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BIGTOP-4349: Add some unit tests for stack extra module (#168)
- Loading branch information
Showing
4 changed files
with
247 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
...ava/org/apache/bigtop/manager/stack/extra/v1_0_0/seatunnel/SeaTunnelClientScriptTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* 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 | ||
* | ||
* https://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.bigtop.manager.stack.extra.v1_0_0.seatunnel; | ||
|
||
import org.apache.bigtop.manager.stack.core.spi.param.Params; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
||
public class SeaTunnelClientScriptTest { | ||
|
||
private final SeaTunnelClientScript clientScript = new SeaTunnelClientScript(); | ||
|
||
@Test | ||
public void testGetComponentName() { | ||
assertEquals("seatunnel_client", clientScript.getComponentName()); | ||
} | ||
|
||
@Test | ||
public void testAddParamsNull() { | ||
Params params = null; | ||
assertThrows(NullPointerException.class, () -> clientScript.add(params)); | ||
} | ||
|
||
@Test | ||
public void testConfigureParamsNull() { | ||
Params params = null; | ||
assertThrows(NullPointerException.class, () -> clientScript.configure(params)); | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
...ava/org/apache/bigtop/manager/stack/extra/v1_0_0/seatunnel/SeaTunnelMasterScriptTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* 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 | ||
* | ||
* https://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.bigtop.manager.stack.extra.v1_0_0.seatunnel; | ||
|
||
import org.apache.bigtop.manager.stack.core.spi.param.Params; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
||
public class SeaTunnelMasterScriptTest { | ||
|
||
private final SeaTunnelMasterScript seaTunnelMasterScript = new SeaTunnelMasterScript(); | ||
|
||
@Test | ||
public void testGetComponentName() { | ||
assertEquals("seatunnel_master", seaTunnelMasterScript.getComponentName()); | ||
} | ||
|
||
@Test | ||
public void testAddParamsNull() { | ||
Params params = null; | ||
assertThrows(NullPointerException.class, () -> seaTunnelMasterScript.add(params)); | ||
} | ||
|
||
@Test | ||
public void testConfigureParamsNull() { | ||
Params params = null; | ||
assertThrows(NullPointerException.class, () -> seaTunnelMasterScript.configure(params)); | ||
} | ||
|
||
@Test | ||
public void testStartParamsNull() { | ||
Params params = null; | ||
assertThrows(NullPointerException.class, () -> seaTunnelMasterScript.start(params)); | ||
} | ||
|
||
@Test | ||
public void testStopParamsNull() { | ||
Params params = null; | ||
assertThrows(NullPointerException.class, () -> seaTunnelMasterScript.stop(params)); | ||
} | ||
|
||
@Test | ||
public void testStatusParamsNull() { | ||
Params params = null; | ||
assertThrows(NullPointerException.class, () -> seaTunnelMasterScript.status(params)); | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
...test/java/org/apache/bigtop/manager/stack/extra/v1_0_0/seatunnel/SeaTunnelParamsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* 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 | ||
* | ||
* https://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.bigtop.manager.stack.extra.v1_0_0.seatunnel; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
public class SeaTunnelParamsTest { | ||
|
||
private SeaTunnelParams seaTunnelParams; | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
seaTunnelParams = mock(SeaTunnelParams.class); | ||
when(seaTunnelParams.stackHome()).thenReturn("/stack"); | ||
when(seaTunnelParams.getServiceName()).thenCallRealMethod(); | ||
when(seaTunnelParams.serviceHome()).thenCallRealMethod(); | ||
when(seaTunnelParams.sparkHome()).thenCallRealMethod(); | ||
when(seaTunnelParams.flinkHome()).thenCallRealMethod(); | ||
when(seaTunnelParams.confDir()).thenCallRealMethod(); | ||
} | ||
|
||
@Test | ||
public void testServiceHome() { | ||
assertEquals("/stack/seatunnel", seaTunnelParams.serviceHome()); | ||
} | ||
|
||
@Test | ||
public void testConfDir() { | ||
assertEquals("/stack/seatunnel/config", seaTunnelParams.confDir()); | ||
} | ||
|
||
@Test | ||
public void testSparkHome() { | ||
assertEquals("/stack/spark", seaTunnelParams.sparkHome()); | ||
} | ||
|
||
@Test | ||
public void testFlinkHome() { | ||
assertEquals("/stack/flink", seaTunnelParams.flinkHome()); | ||
} | ||
|
||
@Test | ||
public void testGetServiceName() { | ||
assertEquals("seatunnel", seaTunnelParams.getServiceName()); | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
...ava/org/apache/bigtop/manager/stack/extra/v1_0_0/seatunnel/SeaTunnelWorkerScriptTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* 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 | ||
* | ||
* https://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.bigtop.manager.stack.extra.v1_0_0.seatunnel; | ||
|
||
import org.apache.bigtop.manager.stack.core.spi.param.Params; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
||
public class SeaTunnelWorkerScriptTest { | ||
|
||
private final SeaTunnelWorkerScript seaTunnelWorkerScript = new SeaTunnelWorkerScript(); | ||
|
||
@Test | ||
public void testGetComponentName() { | ||
assertEquals("seatunnel_worker", seaTunnelWorkerScript.getComponentName()); | ||
} | ||
|
||
@Test | ||
public void testAddParamsNull() { | ||
Params params = null; | ||
assertThrows(NullPointerException.class, () -> seaTunnelWorkerScript.add(params)); | ||
} | ||
|
||
@Test | ||
public void testConfigureParamsNull() { | ||
Params params = null; | ||
assertThrows(NullPointerException.class, () -> seaTunnelWorkerScript.configure(params)); | ||
} | ||
|
||
@Test | ||
public void testStartParamsNull() { | ||
Params params = null; | ||
assertThrows(NullPointerException.class, () -> seaTunnelWorkerScript.start(params)); | ||
} | ||
|
||
@Test | ||
public void testStopParamsNull() { | ||
Params params = null; | ||
assertThrows(NullPointerException.class, () -> seaTunnelWorkerScript.stop(params)); | ||
} | ||
|
||
@Test | ||
public void testStatusParamsNull() { | ||
Params params = null; | ||
assertThrows(NullPointerException.class, () -> seaTunnelWorkerScript.status(params)); | ||
} | ||
} |