From 91c516ecacc0cd225941286c8dc7c477f8aebdac Mon Sep 17 00:00:00 2001 From: xianrenzw <139131974+xianrenzw@users.noreply.github.com> Date: Wed, 29 Jan 2025 19:59:57 +0800 Subject: [PATCH] BIGTOP-4338: Add ut cases for command factory classes in server module (#158) --- .../cluster/ClusterAddJobFactoryTest.java | 47 +++++++++++++++++++ .../cluster/ClusterRestartJobFactoryTest.java | 47 +++++++++++++++++++ .../cluster/ClusterStartJobFactoryTest.java | 47 +++++++++++++++++++ .../cluster/ClusterStopJobFactoryTest.java | 47 +++++++++++++++++++ .../component/ComponentAddJobFactoryTest.java | 47 +++++++++++++++++++ .../ComponentRestartJobFactoryTest.java | 47 +++++++++++++++++++ .../ComponentStartJobFactoryTest.java | 47 +++++++++++++++++++ .../ComponentStopJobFactoryTest.java | 47 +++++++++++++++++++ .../factory/host/HostAddJobFactoryTest.java | 47 +++++++++++++++++++ .../host/HostRestartJobFactoryTest.java | 47 +++++++++++++++++++ .../factory/host/HostStartJobFactoryTest.java | 47 +++++++++++++++++++ .../factory/host/HostStopJobFactoryTest.java | 47 +++++++++++++++++++ .../service/ServiceAddJobFactoryTest.java | 47 +++++++++++++++++++ .../service/ServiceCheckJobFactoryTest.java | 47 +++++++++++++++++++ .../ServiceConfigureJobFactoryTest.java | 47 +++++++++++++++++++ .../service/ServiceRestartJobFactoryTest.java | 47 +++++++++++++++++++ .../service/ServiceStartJobFactoryTest.java | 47 +++++++++++++++++++ .../service/ServiceStopJobFactoryTest.java | 47 +++++++++++++++++++ 18 files changed, 846 insertions(+) create mode 100644 bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/cluster/ClusterAddJobFactoryTest.java create mode 100644 bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/cluster/ClusterRestartJobFactoryTest.java create mode 100644 bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/cluster/ClusterStartJobFactoryTest.java create mode 100644 bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/cluster/ClusterStopJobFactoryTest.java create mode 100644 bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/component/ComponentAddJobFactoryTest.java create mode 100644 bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/component/ComponentRestartJobFactoryTest.java create mode 100644 bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/component/ComponentStartJobFactoryTest.java create mode 100644 bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/component/ComponentStopJobFactoryTest.java create mode 100644 bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/host/HostAddJobFactoryTest.java create mode 100644 bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/host/HostRestartJobFactoryTest.java create mode 100644 bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/host/HostStartJobFactoryTest.java create mode 100644 bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/host/HostStopJobFactoryTest.java create mode 100644 bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceAddJobFactoryTest.java create mode 100644 bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceCheckJobFactoryTest.java create mode 100644 bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceConfigureJobFactoryTest.java create mode 100644 bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceRestartJobFactoryTest.java create mode 100644 bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceStartJobFactoryTest.java create mode 100644 bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceStopJobFactoryTest.java diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/cluster/ClusterAddJobFactoryTest.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/cluster/ClusterAddJobFactoryTest.java new file mode 100644 index 00000000..97c05519 --- /dev/null +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/cluster/ClusterAddJobFactoryTest.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.server.command.factory.cluster; + +import org.apache.bigtop.manager.common.enums.Command; +import org.apache.bigtop.manager.server.command.CommandIdentifier; +import org.apache.bigtop.manager.server.enums.CommandLevel; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class ClusterAddJobFactoryTest { + + private ClusterAddJobFactory factory; + + @BeforeEach + void setUp() { + factory = new ClusterAddJobFactory(); + } + + @Test + void testGetCommandIdentifier() { + CommandIdentifier actualIdentifier = factory.getCommandIdentifier(); + assertNotNull(actualIdentifier); + assertEquals(CommandLevel.CLUSTER, actualIdentifier.getCommandLevel()); + assertEquals(Command.ADD, actualIdentifier.getCommand()); + } +} diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/cluster/ClusterRestartJobFactoryTest.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/cluster/ClusterRestartJobFactoryTest.java new file mode 100644 index 00000000..ee93f05e --- /dev/null +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/cluster/ClusterRestartJobFactoryTest.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.server.command.factory.cluster; + +import org.apache.bigtop.manager.common.enums.Command; +import org.apache.bigtop.manager.server.command.CommandIdentifier; +import org.apache.bigtop.manager.server.enums.CommandLevel; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class ClusterRestartJobFactoryTest { + + private ClusterRestartJobFactory factory; + + @BeforeEach + void setUp() { + factory = new ClusterRestartJobFactory(); + } + + @Test + void testGetCommandIdentifier() { + CommandIdentifier actualIdentifier = factory.getCommandIdentifier(); + assertNotNull(actualIdentifier); + assertEquals(CommandLevel.CLUSTER, actualIdentifier.getCommandLevel()); + assertEquals(Command.RESTART, actualIdentifier.getCommand()); + } +} diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/cluster/ClusterStartJobFactoryTest.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/cluster/ClusterStartJobFactoryTest.java new file mode 100644 index 00000000..1f97c944 --- /dev/null +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/cluster/ClusterStartJobFactoryTest.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.server.command.factory.cluster; + +import org.apache.bigtop.manager.common.enums.Command; +import org.apache.bigtop.manager.server.command.CommandIdentifier; +import org.apache.bigtop.manager.server.enums.CommandLevel; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class ClusterStartJobFactoryTest { + + private ClusterStartJobFactory factory; + + @BeforeEach + void setUp() { + factory = new ClusterStartJobFactory(); + } + + @Test + void testGetCommandIdentifier() { + CommandIdentifier actualIdentifier = factory.getCommandIdentifier(); + assertNotNull(actualIdentifier); + assertEquals(CommandLevel.CLUSTER, actualIdentifier.getCommandLevel()); + assertEquals(Command.START, actualIdentifier.getCommand()); + } +} diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/cluster/ClusterStopJobFactoryTest.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/cluster/ClusterStopJobFactoryTest.java new file mode 100644 index 00000000..0ef58043 --- /dev/null +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/cluster/ClusterStopJobFactoryTest.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.server.command.factory.cluster; + +import org.apache.bigtop.manager.common.enums.Command; +import org.apache.bigtop.manager.server.command.CommandIdentifier; +import org.apache.bigtop.manager.server.enums.CommandLevel; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class ClusterStopJobFactoryTest { + + private ClusterStopJobFactory factory; + + @BeforeEach + void setUp() { + factory = new ClusterStopJobFactory(); + } + + @Test + void testGetCommandIdentifier() { + CommandIdentifier actualIdentifier = factory.getCommandIdentifier(); + assertNotNull(actualIdentifier); + assertEquals(CommandLevel.CLUSTER, actualIdentifier.getCommandLevel()); + assertEquals(Command.STOP, actualIdentifier.getCommand()); + } +} diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/component/ComponentAddJobFactoryTest.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/component/ComponentAddJobFactoryTest.java new file mode 100644 index 00000000..23badaab --- /dev/null +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/component/ComponentAddJobFactoryTest.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.server.command.factory.component; + +import org.apache.bigtop.manager.common.enums.Command; +import org.apache.bigtop.manager.server.command.CommandIdentifier; +import org.apache.bigtop.manager.server.enums.CommandLevel; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class ComponentAddJobFactoryTest { + + private ComponentAddJobFactory factory; + + @BeforeEach + void setUp() { + factory = new ComponentAddJobFactory(); + } + + @Test + void testGetCommandIdentifier() { + CommandIdentifier actualIdentifier = factory.getCommandIdentifier(); + assertNotNull(actualIdentifier); + assertEquals(CommandLevel.COMPONENT, actualIdentifier.getCommandLevel()); + assertEquals(Command.ADD, actualIdentifier.getCommand()); + } +} diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/component/ComponentRestartJobFactoryTest.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/component/ComponentRestartJobFactoryTest.java new file mode 100644 index 00000000..860e4171 --- /dev/null +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/component/ComponentRestartJobFactoryTest.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.server.command.factory.component; + +import org.apache.bigtop.manager.common.enums.Command; +import org.apache.bigtop.manager.server.command.CommandIdentifier; +import org.apache.bigtop.manager.server.enums.CommandLevel; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class ComponentRestartJobFactoryTest { + + private ComponentRestartJobFactory factory; + + @BeforeEach + void setUp() { + factory = new ComponentRestartJobFactory(); + } + + @Test + void testGetCommandIdentifier() { + CommandIdentifier actualIdentifier = factory.getCommandIdentifier(); + assertNotNull(actualIdentifier); + assertEquals(CommandLevel.COMPONENT, actualIdentifier.getCommandLevel()); + assertEquals(Command.RESTART, actualIdentifier.getCommand()); + } +} diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/component/ComponentStartJobFactoryTest.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/component/ComponentStartJobFactoryTest.java new file mode 100644 index 00000000..c4ec3766 --- /dev/null +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/component/ComponentStartJobFactoryTest.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.server.command.factory.component; + +import org.apache.bigtop.manager.common.enums.Command; +import org.apache.bigtop.manager.server.command.CommandIdentifier; +import org.apache.bigtop.manager.server.enums.CommandLevel; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class ComponentStartJobFactoryTest { + + private ComponentStartJobFactory factory; + + @BeforeEach + void setUp() { + factory = new ComponentStartJobFactory(); + } + + @Test + void testGetCommandIdentifier() { + CommandIdentifier actualIdentifier = factory.getCommandIdentifier(); + assertNotNull(actualIdentifier); + assertEquals(CommandLevel.COMPONENT, actualIdentifier.getCommandLevel()); + assertEquals(Command.START, actualIdentifier.getCommand()); + } +} diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/component/ComponentStopJobFactoryTest.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/component/ComponentStopJobFactoryTest.java new file mode 100644 index 00000000..572869a7 --- /dev/null +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/component/ComponentStopJobFactoryTest.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.server.command.factory.component; + +import org.apache.bigtop.manager.common.enums.Command; +import org.apache.bigtop.manager.server.command.CommandIdentifier; +import org.apache.bigtop.manager.server.enums.CommandLevel; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class ComponentStopJobFactoryTest { + + private ComponentStopJobFactory factory; + + @BeforeEach + void setUp() { + factory = new ComponentStopJobFactory(); + } + + @Test + void testGetCommandIdentifier() { + CommandIdentifier actualIdentifier = factory.getCommandIdentifier(); + assertNotNull(actualIdentifier); + assertEquals(CommandLevel.COMPONENT, actualIdentifier.getCommandLevel()); + assertEquals(Command.STOP, actualIdentifier.getCommand()); + } +} diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/host/HostAddJobFactoryTest.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/host/HostAddJobFactoryTest.java new file mode 100644 index 00000000..54e12617 --- /dev/null +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/host/HostAddJobFactoryTest.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.server.command.factory.host; + +import org.apache.bigtop.manager.common.enums.Command; +import org.apache.bigtop.manager.server.command.CommandIdentifier; +import org.apache.bigtop.manager.server.enums.CommandLevel; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class HostAddJobFactoryTest { + + private HostAddJobFactory factory; + + @BeforeEach + void setUp() { + factory = new HostAddJobFactory(); + } + + @Test + void testGetCommandIdentifier() { + CommandIdentifier actualIdentifier = factory.getCommandIdentifier(); + assertNotNull(actualIdentifier); + assertEquals(CommandLevel.HOST, actualIdentifier.getCommandLevel()); + assertEquals(Command.ADD, actualIdentifier.getCommand()); + } +} diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/host/HostRestartJobFactoryTest.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/host/HostRestartJobFactoryTest.java new file mode 100644 index 00000000..eed3684a --- /dev/null +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/host/HostRestartJobFactoryTest.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.server.command.factory.host; + +import org.apache.bigtop.manager.common.enums.Command; +import org.apache.bigtop.manager.server.command.CommandIdentifier; +import org.apache.bigtop.manager.server.enums.CommandLevel; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class HostRestartJobFactoryTest { + + private HostRestartJobFactory factory; + + @BeforeEach + void setUp() { + factory = new HostRestartJobFactory(); + } + + @Test + void testGetCommandIdentifier() { + CommandIdentifier actualIdentifier = factory.getCommandIdentifier(); + assertNotNull(actualIdentifier); + assertEquals(CommandLevel.HOST, actualIdentifier.getCommandLevel()); + assertEquals(Command.RESTART, actualIdentifier.getCommand()); + } +} diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/host/HostStartJobFactoryTest.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/host/HostStartJobFactoryTest.java new file mode 100644 index 00000000..fb8bc5ca --- /dev/null +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/host/HostStartJobFactoryTest.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.server.command.factory.host; + +import org.apache.bigtop.manager.common.enums.Command; +import org.apache.bigtop.manager.server.command.CommandIdentifier; +import org.apache.bigtop.manager.server.enums.CommandLevel; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class HostStartJobFactoryTest { + + private HostStartJobFactory factory; + + @BeforeEach + void setUp() { + factory = new HostStartJobFactory(); + } + + @Test + void testGetCommandIdentifier() { + CommandIdentifier actualIdentifier = factory.getCommandIdentifier(); + assertNotNull(actualIdentifier); + assertEquals(CommandLevel.HOST, actualIdentifier.getCommandLevel()); + assertEquals(Command.START, actualIdentifier.getCommand()); + } +} diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/host/HostStopJobFactoryTest.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/host/HostStopJobFactoryTest.java new file mode 100644 index 00000000..7aa6da9e --- /dev/null +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/host/HostStopJobFactoryTest.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.server.command.factory.host; + +import org.apache.bigtop.manager.common.enums.Command; +import org.apache.bigtop.manager.server.command.CommandIdentifier; +import org.apache.bigtop.manager.server.enums.CommandLevel; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class HostStopJobFactoryTest { + + private HostStopJobFactory factory; + + @BeforeEach + void setUp() { + factory = new HostStopJobFactory(); + } + + @Test + void testGetCommandIdentifier() { + CommandIdentifier actualIdentifier = factory.getCommandIdentifier(); + assertNotNull(actualIdentifier); + assertEquals(CommandLevel.HOST, actualIdentifier.getCommandLevel()); + assertEquals(Command.STOP, actualIdentifier.getCommand()); + } +} diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceAddJobFactoryTest.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceAddJobFactoryTest.java new file mode 100644 index 00000000..152f7941 --- /dev/null +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceAddJobFactoryTest.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.server.command.factory.service; + +import org.apache.bigtop.manager.common.enums.Command; +import org.apache.bigtop.manager.server.command.CommandIdentifier; +import org.apache.bigtop.manager.server.enums.CommandLevel; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class ServiceAddJobFactoryTest { + + private ServiceAddJobFactory factory; + + @BeforeEach + void setUp() { + factory = new ServiceAddJobFactory(); + } + + @Test + void testGetCommandIdentifier() { + CommandIdentifier actualIdentifier = factory.getCommandIdentifier(); + assertNotNull(actualIdentifier); + assertEquals(CommandLevel.SERVICE, actualIdentifier.getCommandLevel()); + assertEquals(Command.ADD, actualIdentifier.getCommand()); + } +} diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceCheckJobFactoryTest.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceCheckJobFactoryTest.java new file mode 100644 index 00000000..59b48b8a --- /dev/null +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceCheckJobFactoryTest.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.server.command.factory.service; + +import org.apache.bigtop.manager.common.enums.Command; +import org.apache.bigtop.manager.server.command.CommandIdentifier; +import org.apache.bigtop.manager.server.enums.CommandLevel; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class ServiceCheckJobFactoryTest { + + private ServiceCheckJobFactory factory; + + @BeforeEach + void setUp() { + factory = new ServiceCheckJobFactory(); + } + + @Test + void testGetCommandIdentifier() { + CommandIdentifier actualIdentifier = factory.getCommandIdentifier(); + assertNotNull(actualIdentifier); + assertEquals(CommandLevel.SERVICE, actualIdentifier.getCommandLevel()); + assertEquals(Command.CHECK, actualIdentifier.getCommand()); + } +} diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceConfigureJobFactoryTest.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceConfigureJobFactoryTest.java new file mode 100644 index 00000000..633214f3 --- /dev/null +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceConfigureJobFactoryTest.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.server.command.factory.service; + +import org.apache.bigtop.manager.common.enums.Command; +import org.apache.bigtop.manager.server.command.CommandIdentifier; +import org.apache.bigtop.manager.server.enums.CommandLevel; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class ServiceConfigureJobFactoryTest { + + private ServiceConfigureJobFactory factory; + + @BeforeEach + void setUp() { + factory = new ServiceConfigureJobFactory(); + } + + @Test + void testGetCommandIdentifier() { + CommandIdentifier actualIdentifier = factory.getCommandIdentifier(); + assertNotNull(actualIdentifier); + assertEquals(CommandLevel.SERVICE, actualIdentifier.getCommandLevel()); + assertEquals(Command.CONFIGURE, actualIdentifier.getCommand()); + } +} diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceRestartJobFactoryTest.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceRestartJobFactoryTest.java new file mode 100644 index 00000000..55603065 --- /dev/null +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceRestartJobFactoryTest.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.server.command.factory.service; + +import org.apache.bigtop.manager.common.enums.Command; +import org.apache.bigtop.manager.server.command.CommandIdentifier; +import org.apache.bigtop.manager.server.enums.CommandLevel; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class ServiceRestartJobFactoryTest { + + private ServiceRestartJobFactory factory; + + @BeforeEach + void setUp() { + factory = new ServiceRestartJobFactory(); + } + + @Test + void testGetCommandIdentifier() { + CommandIdentifier actualIdentifier = factory.getCommandIdentifier(); + assertNotNull(actualIdentifier); + assertEquals(CommandLevel.SERVICE, actualIdentifier.getCommandLevel()); + assertEquals(Command.RESTART, actualIdentifier.getCommand()); + } +} diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceStartJobFactoryTest.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceStartJobFactoryTest.java new file mode 100644 index 00000000..8102c5c2 --- /dev/null +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceStartJobFactoryTest.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.server.command.factory.service; + +import org.apache.bigtop.manager.common.enums.Command; +import org.apache.bigtop.manager.server.command.CommandIdentifier; +import org.apache.bigtop.manager.server.enums.CommandLevel; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class ServiceStartJobFactoryTest { + + private ServiceStartJobFactory factory; + + @BeforeEach + void setUp() { + factory = new ServiceStartJobFactory(); + } + + @Test + void testGetCommandIdentifier() { + CommandIdentifier actualIdentifier = factory.getCommandIdentifier(); + assertNotNull(actualIdentifier); + assertEquals(CommandLevel.SERVICE, actualIdentifier.getCommandLevel()); + assertEquals(Command.START, actualIdentifier.getCommand()); + } +} diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceStopJobFactoryTest.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceStopJobFactoryTest.java new file mode 100644 index 00000000..8d20b297 --- /dev/null +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/command/factory/service/ServiceStopJobFactoryTest.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.server.command.factory.service; + +import org.apache.bigtop.manager.common.enums.Command; +import org.apache.bigtop.manager.server.command.CommandIdentifier; +import org.apache.bigtop.manager.server.enums.CommandLevel; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class ServiceStopJobFactoryTest { + + private ServiceStopJobFactory factory; + + @BeforeEach + void setUp() { + factory = new ServiceStopJobFactory(); + } + + @Test + void testGetCommandIdentifier() { + CommandIdentifier actualIdentifier = factory.getCommandIdentifier(); + assertNotNull(actualIdentifier); + assertEquals(CommandLevel.SERVICE, actualIdentifier.getCommandLevel()); + assertEquals(Command.STOP, actualIdentifier.getCommand()); + } +}