diff --git a/bigtop-manager-stack/bigtop-manager-stack-extra/src/test/java/org/apache/bigtop/manager/stack/extra/v1_0_0/seatunnel/SeaTunnelClientScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-extra/src/test/java/org/apache/bigtop/manager/stack/extra/v1_0_0/seatunnel/SeaTunnelClientScriptTest.java new file mode 100644 index 000000000..439f3bebc --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-extra/src/test/java/org/apache/bigtop/manager/stack/extra/v1_0_0/seatunnel/SeaTunnelClientScriptTest.java @@ -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)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-extra/src/test/java/org/apache/bigtop/manager/stack/extra/v1_0_0/seatunnel/SeaTunnelMasterScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-extra/src/test/java/org/apache/bigtop/manager/stack/extra/v1_0_0/seatunnel/SeaTunnelMasterScriptTest.java new file mode 100644 index 000000000..09e1a0ca3 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-extra/src/test/java/org/apache/bigtop/manager/stack/extra/v1_0_0/seatunnel/SeaTunnelMasterScriptTest.java @@ -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)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-extra/src/test/java/org/apache/bigtop/manager/stack/extra/v1_0_0/seatunnel/SeaTunnelParamsTest.java b/bigtop-manager-stack/bigtop-manager-stack-extra/src/test/java/org/apache/bigtop/manager/stack/extra/v1_0_0/seatunnel/SeaTunnelParamsTest.java new file mode 100644 index 000000000..d6194c7d9 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-extra/src/test/java/org/apache/bigtop/manager/stack/extra/v1_0_0/seatunnel/SeaTunnelParamsTest.java @@ -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()); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-extra/src/test/java/org/apache/bigtop/manager/stack/extra/v1_0_0/seatunnel/SeaTunnelWorkerScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-extra/src/test/java/org/apache/bigtop/manager/stack/extra/v1_0_0/seatunnel/SeaTunnelWorkerScriptTest.java new file mode 100644 index 000000000..0cc54c7d5 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-extra/src/test/java/org/apache/bigtop/manager/stack/extra/v1_0_0/seatunnel/SeaTunnelWorkerScriptTest.java @@ -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)); + } +}