Skip to content

Commit

Permalink
Add some ut cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
xianrenzw committed Feb 11, 2025
1 parent 07ce789 commit 6c7a248
Show file tree
Hide file tree
Showing 16 changed files with 562 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,49 @@
*/
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 script = new FlinkHistoryServerScript();
private final FlinkHistoryServerScript flinkHistoryServerScript = new FlinkHistoryServerScript();

@Test
void testGetComponentName() {
assertEquals("flink_historyserver", script.getComponentName());
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.add(params));
}

@Test
public void testStopParamsNull() {
Params params = null;
assertThrows(NullPointerException.class, () -> flinkHistoryServerScript.configure(params));
}

@Test
public void testStatusParamsNull() {
Params params = null;
assertThrows(NullPointerException.class, () -> flinkHistoryServerScript.start(params));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,49 @@
*/
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() {
DataNodeScript dataNodeScript = new DataNodeScript();
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.add(params));
}

@Test
public void testStopParamsNull() {
Params params = null;
assertThrows(NullPointerException.class, () -> dataNodeScript.configure(params));
}

@Test
public void testStatusParamsNull() {
Params params = null;
assertThrows(NullPointerException.class, () -> dataNodeScript.start(params));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,49 @@
*/
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() {
HistoryServerScript historyServerScript = new HistoryServerScript();
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.add(params));
}

@Test
public void testStopParamsNull() {
Params params = null;
assertThrows(NullPointerException.class, () -> historyServerScript.configure(params));
}

@Test
public void testStatusParamsNull() {
Params params = null;
assertThrows(NullPointerException.class, () -> historyServerScript.start(params));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,49 @@
*/
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() {
NameNodeScript nameNodeScript = new NameNodeScript();
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.add(params));
}

@Test
public void testStopParamsNull() {
Params params = null;
assertThrows(NullPointerException.class, () -> nameNodeScript.configure(params));
}

@Test
public void testStatusParamsNull() {
Params params = null;
assertThrows(NullPointerException.class, () -> nameNodeScript.start(params));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,49 @@
*/
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() {
NodeManagerScript nodeManagerScript = new NodeManagerScript();
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.add(params));
}

@Test
public void testStopParamsNull() {
Params params = null;
assertThrows(NullPointerException.class, () -> nodeManagerScript.configure(params));
}

@Test
public void testStatusParamsNull() {
Params params = null;
assertThrows(NullPointerException.class, () -> nodeManagerScript.start(params));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,49 @@
*/
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() {
ResourceManagerScript resourceManagerScript = new ResourceManagerScript();
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.add(params));
}

@Test
public void testStopParamsNull() {
Params params = null;
assertThrows(NullPointerException.class, () -> resourceManagerScript.configure(params));
}

@Test
public void testStatusParamsNull() {
Params params = null;
assertThrows(NullPointerException.class, () -> resourceManagerScript.start(params));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,49 @@
*/
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() {
SNameNodeScript sNameNodeScript = new SNameNodeScript();
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.add(params));
}

@Test
public void testStopParamsNull() {
Params params = null;
assertThrows(NullPointerException.class, () -> sNameNodeScript.configure(params));
}

@Test
public void testStatusParamsNull() {
Params params = null;
assertThrows(NullPointerException.class, () -> sNameNodeScript.start(params));
}
}
Loading

0 comments on commit 6c7a248

Please sign in to comment.