import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
public class TestMirrorMakerAgent {
+
MirrorMakerAgent mirrorMakerAgent = new MirrorMakerAgent();
ListMirrorMaker listMirrorMaker = new ListMirrorMaker();
MirrorMaker mirrorMaker = new MirrorMaker();
MirrorMaker mirrorMaker2 = new MirrorMaker();
ArrayList<MirrorMaker> listsMirrorMaker = new ArrayList<MirrorMaker>();
Gson g = new Gson();
- @Mock
- ListMirrorMaker mirrorMakers;
- @InjectMocks
- MirrorMakerAgent agent;
+ MirrorMakerAgent agent = spy(new MirrorMakerAgent());
@Before
public void setUp() {
@Test
public void testReadAgentTopics() {
- MirrorMakerAgent agent = spy(new MirrorMakerAgent());
when(agent.subscribeTopic("60000")).thenReturn(null);
agent.exitLoop = true;
agent.readAgentTopic();
@Test
public void testReadCreateMirrorMaker() {
- agent = spy(new MirrorMakerAgent());
when(agent.publishTopic(
"{\"messageID\":\"test\",\"listMirrorMaker\":[{\"name\":\"test\",\"consumer\":\"test\",\"producer\":\"test\",\"status\":\"STOPPED\"}]}"))
.thenReturn(null);
@Test
public void testReadUpdateMirrorMaker() {
- agent = spy(new MirrorMakerAgent());
when(agent.publishTopic(
"{\"messageID\":\"test\",\"listMirrorMaker\":[{\"name\":\"test\",\"consumer\":\"test\",\"producer\":\"test\",\"status\":\"STOPPED\"}]}"))
.thenReturn(null);
@Test
public void testReadDeleteMirrorMaker() {
- agent = spy(new MirrorMakerAgent());
when(agent.publishTopic(
"{\"messageID\":\"test\",\"listMirrorMaker\":[{\"name\":\"test\",\"consumer\":\"test\",\"producer\":\"test\",\"status\":\"STOPPED\"}]}"))
.thenReturn(null);
@Test
public void testReadListMirrorMaker() {
- agent = spy(new MirrorMakerAgent());
when(agent.publishTopic(
"{\"messageID\":\"test\",\"listMirrorMaker\":[{\"name\":\"test\",\"consumer\":\"test\",\"producer\":\"test\",\"status\":\"STOPPED\"}]}"))
.thenReturn(null);
@Test
public void testReadWhitelistMirrorMaker() {
- agent = spy(new MirrorMakerAgent());
when(agent.publishTopic(
"{\"messageID\":\"test\",\"listMirrorMaker\":[{\"name\":\"test\",\"consumer\":\"test\",\"producer\":\"test\",\"status\":\"STOPPED\"}]}"))
.thenReturn(null);