-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BIGTOP-4338: Add ut cases for command factory classes in server module (
#158)
- Loading branch information
Showing
18 changed files
with
846 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
...va/org/apache/bigtop/manager/server/command/factory/cluster/ClusterAddJobFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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()); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...rg/apache/bigtop/manager/server/command/factory/cluster/ClusterRestartJobFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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()); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
.../org/apache/bigtop/manager/server/command/factory/cluster/ClusterStartJobFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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()); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...a/org/apache/bigtop/manager/server/command/factory/cluster/ClusterStopJobFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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()); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...rg/apache/bigtop/manager/server/command/factory/component/ComponentAddJobFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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()); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...pache/bigtop/manager/server/command/factory/component/ComponentRestartJobFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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()); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
.../apache/bigtop/manager/server/command/factory/component/ComponentStartJobFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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()); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...g/apache/bigtop/manager/server/command/factory/component/ComponentStopJobFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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()); | ||
} | ||
} |
Oops, something went wrong.