diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/flink/FlinkClientScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/flink/FlinkClientScriptTest.java new file mode 100644 index 000000000..38c263111 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/flink/FlinkClientScriptTest.java @@ -0,0 +1,51 @@ +/* + * 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.bigtop.v3_3_0.flink; + +import org.apache.bigtop.manager.stack.core.spi.param.Params; + +import org.junit.jupiter.api.Test; + +import lombok.extern.slf4j.Slf4j; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@Slf4j +public class FlinkClientScriptTest { + + private final FlinkClientScript flinkClientScript = new FlinkClientScript(); + + @Test + public void testGetComponentName() { + assertEquals("flink_client", flinkClientScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> flinkClientScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> flinkClientScript.configure(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/flink/FlinkHistoryServerScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/flink/FlinkHistoryServerScriptTest.java new file mode 100644 index 000000000..56eed2fbb --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/flink/FlinkHistoryServerScriptTest.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.bigtop.v3_3_0.flink; + +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; + +class FlinkHistoryServerScriptTest { + + private final FlinkHistoryServerScript flinkHistoryServerScript = new FlinkHistoryServerScript(); + + @Test + void testGetComponentName() { + assertEquals("flink_historyserver", flinkHistoryServerScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> flinkHistoryServerScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> flinkHistoryServerScript.configure(params)); + } + + @Test + public void testStartParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> flinkHistoryServerScript.start(params)); + } + + @Test + public void testStopParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> flinkHistoryServerScript.stop(params)); + } + + @Test + public void testStatusParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> flinkHistoryServerScript.status(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/flink/FlinkParamsTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/flink/FlinkParamsTest.java new file mode 100644 index 000000000..6d2bd9bb5 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/flink/FlinkParamsTest.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.bigtop.v3_3_0.flink; + +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 FlinkParamsTest { + + private FlinkParams flinkParams; + + @BeforeEach + public void setUp() { + flinkParams = mock(FlinkParams.class); + when(flinkParams.stackHome()).thenReturn("/stack"); + when(flinkParams.getServiceName()).thenCallRealMethod(); + when(flinkParams.serviceHome()).thenCallRealMethod(); + when(flinkParams.hadoopHome()).thenCallRealMethod(); + when(flinkParams.hadoopConfDir()).thenCallRealMethod(); + when(flinkParams.confDir()).thenCallRealMethod(); + } + + @Test + public void testServiceHome() { + assertEquals("/stack/flink", flinkParams.serviceHome()); + } + + @Test + public void testConfDir() { + assertEquals("/stack/flink/conf", flinkParams.confDir()); + } + + @Test + public void testHadoopConfDir() { + assertEquals("/stack/hadoop/etc/hadoop", flinkParams.hadoopConfDir()); + } + + @Test + public void testHadoopHome() { + assertEquals("/stack/hadoop", flinkParams.hadoopHome()); + } + + @Test + public void testGetServiceName() { + assertEquals("flink", flinkParams.getServiceName()); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/DataNodeScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/DataNodeScriptTest.java new file mode 100644 index 000000000..159643adb --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/DataNodeScriptTest.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.bigtop.v3_3_0.hadoop; + +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 DataNodeScriptTest { + + private final DataNodeScript dataNodeScript = new DataNodeScript(); + + @Test + public void testGetComponentName() { + assertEquals("datanode", dataNodeScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> dataNodeScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> dataNodeScript.configure(params)); + } + + @Test + public void testStartParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> dataNodeScript.start(params)); + } + + @Test + public void testStopParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> dataNodeScript.stop(params)); + } + + @Test + public void testStatusParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> dataNodeScript.status(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/HadoopClientScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/HadoopClientScriptTest.java new file mode 100644 index 000000000..c1c03f0b5 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/HadoopClientScriptTest.java @@ -0,0 +1,47 @@ +/* + * 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.bigtop.v3_3_0.hadoop; + +import org.junit.jupiter.api.Test; + +import lombok.extern.slf4j.Slf4j; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@Slf4j +public class HadoopClientScriptTest { + + private final HadoopClientScript hadoopClientScript = new HadoopClientScript(); + + @Test + public void testGetComponentName() { + assertEquals("hadoop_client", hadoopClientScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + assertThrows(NullPointerException.class, () -> hadoopClientScript.add(null)); + } + + @Test + public void testConfigureParamsNull() { + assertThrows(NullPointerException.class, () -> hadoopClientScript.configure(null)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/HadoopParamsTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/HadoopParamsTest.java new file mode 100644 index 000000000..0b413483e --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/HadoopParamsTest.java @@ -0,0 +1,61 @@ +/* + * 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.bigtop.v3_3_0.hadoop; + +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 HadoopParamsTest { + + private HadoopParams hadoopParams; + + @BeforeEach + public void setUp() { + hadoopParams = mock(HadoopParams.class); + when(hadoopParams.stackHome()).thenReturn("/stack"); + when(hadoopParams.getServiceName()).thenCallRealMethod(); + when(hadoopParams.serviceHome()).thenCallRealMethod(); + when(hadoopParams.confDir()).thenCallRealMethod(); + when(hadoopParams.binDir()).thenCallRealMethod(); + } + + @Test + public void testServiceHome() { + assertEquals("/stack/hadoop", hadoopParams.serviceHome()); + } + + @Test + public void testConfDir() { + assertEquals("/stack/hadoop/etc/hadoop", hadoopParams.confDir()); + } + + @Test + public void testBinDir() { + assertEquals("/stack/hadoop/bin", hadoopParams.binDir()); + } + + @Test + public void testGetServiceName() { + assertEquals("hadoop", hadoopParams.getServiceName()); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/HistoryServerScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/HistoryServerScriptTest.java new file mode 100644 index 000000000..432dc63c4 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/HistoryServerScriptTest.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.bigtop.v3_3_0.hadoop; + +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 HistoryServerScriptTest { + + private final HistoryServerScript historyServerScript = new HistoryServerScript(); + + @Test + public void testGetComponentName() { + assertEquals("history_server", historyServerScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> historyServerScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> historyServerScript.configure(params)); + } + + @Test + public void testStartParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> historyServerScript.start(params)); + } + + @Test + public void testStopParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> historyServerScript.stop(params)); + } + + @Test + public void testStatusParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> historyServerScript.status(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/NameNodeScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/NameNodeScriptTest.java new file mode 100644 index 000000000..8d13f3f20 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/NameNodeScriptTest.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.bigtop.v3_3_0.hadoop; + +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 NameNodeScriptTest { + + private final NameNodeScript nameNodeScript = new NameNodeScript(); + + @Test + public void testGetComponentName() { + assertEquals("namenode", nameNodeScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> nameNodeScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> nameNodeScript.configure(params)); + } + + @Test + public void testStartParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> nameNodeScript.start(params)); + } + + @Test + public void testStopParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> nameNodeScript.stop(params)); + } + + @Test + public void testStatusParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> nameNodeScript.status(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/NodeManagerScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/NodeManagerScriptTest.java new file mode 100644 index 000000000..f87c8220b --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/NodeManagerScriptTest.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.bigtop.v3_3_0.hadoop; + +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 NodeManagerScriptTest { + + private final NodeManagerScript nodeManagerScript = new NodeManagerScript(); + + @Test + public void testGetComponentName() { + assertEquals("nodemanager", nodeManagerScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> nodeManagerScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> nodeManagerScript.configure(params)); + } + + @Test + public void testStartParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> nodeManagerScript.start(params)); + } + + @Test + public void testStopParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> nodeManagerScript.stop(params)); + } + + @Test + public void testStatusParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> nodeManagerScript.status(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/ResourceManagerScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/ResourceManagerScriptTest.java new file mode 100644 index 000000000..6ce95f502 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/ResourceManagerScriptTest.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.bigtop.v3_3_0.hadoop; + +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 ResourceManagerScriptTest { + + private final ResourceManagerScript resourceManagerScript = new ResourceManagerScript(); + + @Test + public void testGetComponentName() { + assertEquals("resourcemanager", resourceManagerScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> resourceManagerScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> resourceManagerScript.configure(params)); + } + + @Test + public void testStartParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> resourceManagerScript.start(params)); + } + + @Test + public void testStopParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> resourceManagerScript.stop(params)); + } + + @Test + public void testStatusParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> resourceManagerScript.status(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/SNameNodeScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/SNameNodeScriptTest.java new file mode 100644 index 000000000..8b5ad1a38 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hadoop/SNameNodeScriptTest.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.bigtop.v3_3_0.hadoop; + +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 SNameNodeScriptTest { + + private final SNameNodeScript sNameNodeScript = new SNameNodeScript(); + + @Test + public void testGetComponentName() { + assertEquals("secondarynamenode", sNameNodeScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> sNameNodeScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> sNameNodeScript.configure(params)); + } + + @Test + public void testStartParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> sNameNodeScript.start(params)); + } + + @Test + public void testStopParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> sNameNodeScript.stop(params)); + } + + @Test + public void testStatusParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> sNameNodeScript.status(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hbase/HBaseClientScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hbase/HBaseClientScriptTest.java new file mode 100644 index 000000000..d2bbed2b1 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hbase/HBaseClientScriptTest.java @@ -0,0 +1,47 @@ +/* + * 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.bigtop.v3_3_0.hbase; + +import org.junit.jupiter.api.Test; + +import lombok.extern.slf4j.Slf4j; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@Slf4j +public class HBaseClientScriptTest { + + private final HBaseClientScript hBaseClientScript = new HBaseClientScript(); + + @Test + public void testGetComponentName() { + assertEquals("hbase_client", hBaseClientScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + assertThrows(NullPointerException.class, () -> hBaseClientScript.add(null)); + } + + @Test + public void testConfigureParamsNull() { + assertThrows(NullPointerException.class, () -> hBaseClientScript.configure(null)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hbase/HBaseParamsTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hbase/HBaseParamsTest.java new file mode 100644 index 000000000..78a7ae061 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hbase/HBaseParamsTest.java @@ -0,0 +1,55 @@ +/* + * 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.bigtop.v3_3_0.hbase; + +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 HBaseParamsTest { + + private HBaseParams hBaseParams; + + @BeforeEach + public void setUp() { + hBaseParams = mock(HBaseParams.class); + when(hBaseParams.stackHome()).thenReturn("/stack"); + when(hBaseParams.getServiceName()).thenCallRealMethod(); + when(hBaseParams.serviceHome()).thenCallRealMethod(); + when(hBaseParams.confDir()).thenCallRealMethod(); + } + + @Test + public void testServiceHome() { + assertEquals("/stack/hbase", hBaseParams.serviceHome()); + } + + @Test + public void testConfDir() { + assertEquals("/stack/hbase/conf", hBaseParams.confDir()); + } + + @Test + public void testGetServiceName() { + assertEquals("hbase", hBaseParams.getServiceName()); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hbase/HMasterScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hbase/HMasterScriptTest.java new file mode 100644 index 000000000..374bc2ba0 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hbase/HMasterScriptTest.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.bigtop.v3_3_0.hbase; + +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 HMasterScriptTest { + + private final HMasterScript hMasterScript = new HMasterScript(); + + @Test + public void testGetComponentName() { + assertEquals("hbase_master", hMasterScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hMasterScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hMasterScript.configure(params)); + } + + @Test + public void testStartParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hMasterScript.start(params)); + } + + @Test + public void testStopParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hMasterScript.stop(params)); + } + + @Test + public void testStatusParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hMasterScript.status(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hbase/HRegionServerScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hbase/HRegionServerScriptTest.java new file mode 100644 index 000000000..fd1bac05b --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hbase/HRegionServerScriptTest.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.bigtop.v3_3_0.hbase; + +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 HRegionServerScriptTest { + + private final HRegionServerScript hRegionServerScript = new HRegionServerScript(); + + @Test + public void testGetComponentName() { + assertEquals("hbase_regionserver", hRegionServerScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hRegionServerScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hRegionServerScript.configure(params)); + } + + @Test + public void testStartParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hRegionServerScript.start(params)); + } + + @Test + public void testStopParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hRegionServerScript.stop(params)); + } + + @Test + public void testStatusParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hRegionServerScript.status(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hive/HiveClientScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hive/HiveClientScriptTest.java new file mode 100644 index 000000000..7ccc9c0c5 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hive/HiveClientScriptTest.java @@ -0,0 +1,47 @@ +/* + * 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.bigtop.v3_3_0.hive; + +import org.junit.jupiter.api.Test; + +import lombok.extern.slf4j.Slf4j; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@Slf4j +public class HiveClientScriptTest { + + private final HiveClientScript hiveClientScript = new HiveClientScript(); + + @Test + public void testGetComponentName() { + assertEquals("hive_client", hiveClientScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + assertThrows(NullPointerException.class, () -> hiveClientScript.add(null)); + } + + @Test + public void testConfigureParamsNull() { + assertThrows(NullPointerException.class, () -> hiveClientScript.configure(null)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hive/HiveMetastoreScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hive/HiveMetastoreScriptTest.java new file mode 100644 index 000000000..7b6fd5ea0 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hive/HiveMetastoreScriptTest.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.bigtop.v3_3_0.hive; + +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 HiveMetastoreScriptTest { + + private final HiveMetastoreScript hiveMetastoreScript = new HiveMetastoreScript(); + + @Test + public void testGetComponentName() { + assertEquals("hive_metastore", hiveMetastoreScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hiveMetastoreScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hiveMetastoreScript.configure(params)); + } + + @Test + public void testStartParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hiveMetastoreScript.start(params)); + } + + @Test + public void testStopParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hiveMetastoreScript.stop(params)); + } + + @Test + public void testStatusParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hiveMetastoreScript.status(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hive/HiveParamsTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hive/HiveParamsTest.java new file mode 100644 index 000000000..4c1ceee7a --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hive/HiveParamsTest.java @@ -0,0 +1,61 @@ +/* + * 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.bigtop.v3_3_0.hive; + +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 HiveParamsTest { + + private HiveParams hiveParams; + + @BeforeEach + public void setUp() { + hiveParams = mock(HiveParams.class); + when(hiveParams.stackHome()).thenReturn("/stack"); + when(hiveParams.getServiceName()).thenCallRealMethod(); + when(hiveParams.serviceHome()).thenCallRealMethod(); + when(hiveParams.hadoopHome()).thenCallRealMethod(); + when(hiveParams.confDir()).thenCallRealMethod(); + } + + @Test + public void testServiceHome() { + assertEquals("/stack/hive", hiveParams.serviceHome()); + } + + @Test + public void testConfDir() { + assertEquals("/stack/hive/conf", hiveParams.confDir()); + } + + @Test + public void testHadoopHome() { + assertEquals("/stack/hadoop", hiveParams.hadoopHome()); + } + + @Test + public void testGetServiceName() { + assertEquals("hive", hiveParams.getServiceName()); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hive/HiveServer2ScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hive/HiveServer2ScriptTest.java new file mode 100644 index 000000000..7dbcae19a --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hive/HiveServer2ScriptTest.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.bigtop.v3_3_0.hive; + +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 HiveServer2ScriptTest { + + private final HiveServer2Script hiveServer2Script = new HiveServer2Script(); + + @Test + public void testGetComponentName() { + assertEquals("hiveserver2", hiveServer2Script.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hiveServer2Script.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hiveServer2Script.configure(params)); + } + + @Test + public void testStartParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hiveServer2Script.start(params)); + } + + @Test + public void testStopParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hiveServer2Script.stop(params)); + } + + @Test + public void testStatusParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> hiveServer2Script.status(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaBrokerScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaBrokerScriptTest.java new file mode 100644 index 000000000..d156cc042 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaBrokerScriptTest.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.bigtop.v3_3_0.kafka; + +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 KafkaBrokerScriptTest { + + private final KafkaBrokerScript kafkaBrokerScript = new KafkaBrokerScript(); + + @Test + public void testGetComponentName() { + assertEquals("kafka_broker", kafkaBrokerScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> kafkaBrokerScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> kafkaBrokerScript.configure(params)); + } + + @Test + public void testStartParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> kafkaBrokerScript.start(params)); + } + + @Test + public void testStopParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> kafkaBrokerScript.stop(params)); + } + + @Test + public void testStatusParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> kafkaBrokerScript.status(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaParamsTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaParamsTest.java new file mode 100644 index 000000000..feb6c7d43 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaParamsTest.java @@ -0,0 +1,55 @@ +/* + * 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.bigtop.v3_3_0.kafka; + +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 KafkaParamsTest { + + private KafkaParams kafkaParams; + + @BeforeEach + public void setUp() { + kafkaParams = mock(KafkaParams.class); + when(kafkaParams.stackHome()).thenReturn("/stack"); + when(kafkaParams.getServiceName()).thenCallRealMethod(); + when(kafkaParams.serviceHome()).thenCallRealMethod(); + when(kafkaParams.confDir()).thenCallRealMethod(); + } + + @Test + public void testServiceHome() { + assertEquals("/stack/kafka", kafkaParams.serviceHome()); + } + + @Test + public void testConfDir() { + assertEquals("/stack/kafka/config", kafkaParams.confDir()); + } + + @Test + public void testGetServiceName() { + assertEquals("kafka", kafkaParams.getServiceName()); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/solr/SolrInstanceScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/solr/SolrInstanceScriptTest.java new file mode 100644 index 000000000..62c65dc0e --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/solr/SolrInstanceScriptTest.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.bigtop.v3_3_0.solr; + +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 SolrInstanceScriptTest { + + private final SolrInstanceScript solrInstanceScript = new SolrInstanceScript(); + + @Test + public void testGetComponentName() { + assertEquals("solr_instance", solrInstanceScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> solrInstanceScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> solrInstanceScript.configure(params)); + } + + @Test + public void testStartParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> solrInstanceScript.start(params)); + } + + @Test + public void testStopParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> solrInstanceScript.stop(params)); + } + + @Test + public void testStatusParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> solrInstanceScript.status(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/solr/SolrParamsTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/solr/SolrParamsTest.java new file mode 100644 index 000000000..32bb79f89 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/solr/SolrParamsTest.java @@ -0,0 +1,55 @@ +/* + * 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.bigtop.v3_3_0.solr; + +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 SolrParamsTest { + + private SolrParams solrParams; + + @BeforeEach + public void setUp() { + solrParams = mock(SolrParams.class); + when(solrParams.stackHome()).thenReturn("/stack"); + when(solrParams.getServiceName()).thenCallRealMethod(); + when(solrParams.serviceHome()).thenCallRealMethod(); + when(solrParams.confDir()).thenCallRealMethod(); + } + + @Test + public void testServiceHome() { + assertEquals("/stack/solr", solrParams.serviceHome()); + } + + @Test + public void testConfDir() { + assertEquals("/stack/solr/server/solr", solrParams.confDir()); + } + + @Test + public void testGetServiceName() { + assertEquals("solr", solrParams.getServiceName()); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/spark/SparkClientScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/spark/SparkClientScriptTest.java new file mode 100644 index 000000000..53c9a44cf --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/spark/SparkClientScriptTest.java @@ -0,0 +1,51 @@ +/* + * 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.bigtop.v3_3_0.spark; + +import org.apache.bigtop.manager.stack.core.spi.param.Params; + +import org.junit.jupiter.api.Test; + +import lombok.extern.slf4j.Slf4j; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@Slf4j +public class SparkClientScriptTest { + + private final SparkClientScript sparkClientScript = new SparkClientScript(); + + @Test + public void testGetComponentName() { + assertEquals("spark_client", sparkClientScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> sparkClientScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> sparkClientScript.configure(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/spark/SparkHistoryServerScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/spark/SparkHistoryServerScriptTest.java new file mode 100644 index 000000000..d5ecfacba --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/spark/SparkHistoryServerScriptTest.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.bigtop.v3_3_0.spark; + +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 SparkHistoryServerScriptTest { + + private final SparkHistoryServerScript sparkHistoryServerScript = new SparkHistoryServerScript(); + + @Test + public void testGetComponentName() { + assertEquals("spark_historyserver", sparkHistoryServerScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> sparkHistoryServerScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> sparkHistoryServerScript.configure(params)); + } + + @Test + public void testStartParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> sparkHistoryServerScript.start(params)); + } + + @Test + public void testStopParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> sparkHistoryServerScript.stop(params)); + } + + @Test + public void testStatusParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> sparkHistoryServerScript.status(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/spark/SparkParamsTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/spark/SparkParamsTest.java new file mode 100644 index 000000000..cb14d1a67 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/spark/SparkParamsTest.java @@ -0,0 +1,79 @@ +/* + * 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.bigtop.v3_3_0.spark; + +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 SparkParamsTest { + + private SparkParams sparkParams; + + @BeforeEach + public void setUp() { + sparkParams = mock(SparkParams.class); + when(sparkParams.stackHome()).thenReturn("/stack"); + when(sparkParams.getServiceName()).thenCallRealMethod(); + when(sparkParams.serviceHome()).thenCallRealMethod(); + when(sparkParams.hadoopConfDir()).thenCallRealMethod(); + when(sparkParams.hadoopHome()).thenCallRealMethod(); + when(sparkParams.hiveConfDir()).thenCallRealMethod(); + when(sparkParams.hiveHome()).thenCallRealMethod(); + when(sparkParams.confDir()).thenCallRealMethod(); + } + + @Test + public void testServiceHome() { + assertEquals("/stack/spark", sparkParams.serviceHome()); + } + + @Test + public void testHadoopConfDir() { + assertEquals("/stack/hadoop/etc/hadoop", sparkParams.hadoopConfDir()); + } + + @Test + public void testHadoopHome() { + assertEquals("/stack/hadoop", sparkParams.hadoopHome()); + } + + @Test + public void testHiveConfDir() { + assertEquals("/stack/hive/conf", sparkParams.hiveConfDir()); + } + + @Test + public void testHiveHome() { + assertEquals("/stack/hive", sparkParams.hiveHome()); + } + + @Test + public void testConfDir() { + assertEquals("/stack/spark/conf", sparkParams.confDir()); + } + + @Test + public void testGetServiceName() { + assertEquals("spark", sparkParams.getServiceName()); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/spark/SparkThriftServerScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/spark/SparkThriftServerScriptTest.java new file mode 100644 index 000000000..d2a9af636 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/spark/SparkThriftServerScriptTest.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.bigtop.v3_3_0.spark; + +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 SparkThriftServerScriptTest { + + private final SparkThriftServerScript sparkThriftServerScript = new SparkThriftServerScript(); + + @Test + public void testGetComponentName() { + assertEquals("spark_thriftserver", sparkThriftServerScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> sparkThriftServerScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> sparkThriftServerScript.configure(params)); + } + + @Test + public void testStartParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> sparkThriftServerScript.start(params)); + } + + @Test + public void testStopParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> sparkThriftServerScript.stop(params)); + } + + @Test + public void testStatusParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> sparkThriftServerScript.status(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezClientScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezClientScriptTest.java new file mode 100644 index 000000000..68103ca0e --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezClientScriptTest.java @@ -0,0 +1,51 @@ +/* + * 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.bigtop.v3_3_0.tez; + +import org.apache.bigtop.manager.stack.core.spi.param.Params; + +import org.junit.jupiter.api.Test; + +import lombok.extern.slf4j.Slf4j; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@Slf4j +public class TezClientScriptTest { + + private final TezClientScript tezClientScript = new TezClientScript(); + + @Test + public void testGetComponentName() { + assertEquals("tez_client", tezClientScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> tezClientScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> tezClientScript.configure(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezParamsTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezParamsTest.java new file mode 100644 index 000000000..6dfc81517 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezParamsTest.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.bigtop.v3_3_0.tez; + +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 TezParamsTest { + + private TezParams tezParams; + + @BeforeEach + public void setUp() { + tezParams = mock(TezParams.class); + when(tezParams.stackHome()).thenReturn("/stack"); + when(tezParams.getServiceName()).thenCallRealMethod(); + when(tezParams.serviceHome()).thenCallRealMethod(); + when(tezParams.hadoopConfDir()).thenCallRealMethod(); + when(tezParams.hadoopHome()).thenCallRealMethod(); + when(tezParams.confDir()).thenCallRealMethod(); + } + + @Test + public void testConfDir() { + assertEquals("/stack/tez/conf", tezParams.confDir()); + } + + @Test + public void testServiceHome() { + assertEquals("/stack/tez", tezParams.serviceHome()); + } + + @Test + public void testHadoopConfDir() { + assertEquals("/stack/hadoop/etc/hadoop", tezParams.hadoopConfDir()); + } + + @Test + public void testHadoopHome() { + assertEquals("/stack/hadoop", tezParams.hadoopHome()); + } + + @Test + public void testGetServiceName() { + assertEquals("tez", tezParams.getServiceName()); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperClientScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperClientScriptTest.java new file mode 100644 index 000000000..1fafea2f8 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperClientScriptTest.java @@ -0,0 +1,51 @@ +/* + * 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.bigtop.v3_3_0.zookeeper; + +import org.apache.bigtop.manager.stack.core.spi.param.Params; + +import org.junit.jupiter.api.Test; + +import lombok.extern.slf4j.Slf4j; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@Slf4j +public class ZookeeperClientScriptTest { + + private final ZookeeperClientScript zookeeperClientScript = new ZookeeperClientScript(); + + @Test + public void testGetComponentName() { + assertEquals("zookeeper_client", zookeeperClientScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> zookeeperClientScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> zookeeperClientScript.configure(params)); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperParamsTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperParamsTest.java new file mode 100644 index 000000000..f1f035f35 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperParamsTest.java @@ -0,0 +1,55 @@ +/* + * 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.bigtop.v3_3_0.zookeeper; + +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 ZookeeperParamsTest { + + private ZookeeperParams zookeeperParams; + + @BeforeEach + public void setUp() { + zookeeperParams = mock(ZookeeperParams.class); + when(zookeeperParams.stackHome()).thenReturn("/stack"); + when(zookeeperParams.getServiceName()).thenCallRealMethod(); + when(zookeeperParams.serviceHome()).thenCallRealMethod(); + when(zookeeperParams.confDir()).thenCallRealMethod(); + } + + @Test + public void testServiceHome() { + assertEquals("/stack/zookeeper", zookeeperParams.serviceHome()); + } + + @Test + public void testConfDir() { + assertEquals("/stack/zookeeper/conf", zookeeperParams.confDir()); + } + + @Test + public void testGetServiceName() { + assertEquals("zookeeper", zookeeperParams.getServiceName()); + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperServerScriptTest.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperServerScriptTest.java new file mode 100644 index 000000000..ecfdcb094 --- /dev/null +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/test/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperServerScriptTest.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.bigtop.v3_3_0.zookeeper; + +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 ZookeeperServerScriptTest { + + private final ZookeeperServerScript zookeeperServerScript = new ZookeeperServerScript(); + + @Test + public void testGetComponentName() { + assertEquals("zookeeper_server", zookeeperServerScript.getComponentName()); + } + + @Test + public void testAddParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> zookeeperServerScript.add(params)); + } + + @Test + public void testConfigureParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> zookeeperServerScript.configure(params)); + } + + @Test + public void testStartParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> zookeeperServerScript.add(params)); + } + + @Test + public void testStopParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> zookeeperServerScript.configure(params)); + } + + @Test + public void testStatusParamsNull() { + Params params = null; + assertThrows(NullPointerException.class, () -> zookeeperServerScript.status(params)); + } +}