added test discovery

This commit is contained in:
snoop 2017-10-13 18:04:22 +09:00
parent 2ad726523d
commit 890f37d968
2 changed files with 39 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package com.loafle.overflow.module.discovery.service;
import com.loafle.overflow.commons.service.MessagePublisher;
import com.loafle.overflow.module.discovery.model.DiscoveryStartInfo;
import com.loafle.overflow.module.domain.model.Domain;
import org.codehaus.jackson.map.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -27,4 +28,25 @@ public class DiscoveryService {
System.out.println(json);
// this.messagePublisher.publishToProbe("/auth", noAuthProbe.getTempProbeKey(), "NoAuthProbeService.acceptNoAuthProbe", probe.getProbeKey());
}
public boolean testDiscovery(int types, String obj) {
Domain domain = new Domain();
domain.setId(1);
switch (types) {
case 1 :
messagePublisher.publishToDomain("/web", domain, "DiscoveryService.discoveryIngHost", obj);
break;
case 2 :
messagePublisher.publishToDomain("/web", domain, "DiscoveryService.discoveryIngPort", obj);
break;
case 3 :
messagePublisher.publishToDomain("/web", domain, "DiscoveryService.discoveryIngService", obj);
break;
}
return true;
}
}

View File

@ -1,5 +1,6 @@
package com.loafle.overflow.module.noauthprobe.service;
import com.loafle.overflow.commons.service.MessagePublisher;
import com.loafle.overflow.module.domain.model.Domain;
import com.loafle.overflow.module.meta.model.MetaNoAuthProbeStatus;
import com.loafle.overflow.module.noauthprobe.model.NoAuthProbe;
@ -26,6 +27,9 @@ public class NoAuthProbeServiceTest {
@Autowired
private NoAuthProbeService noAuthProbeService;
@Autowired
private MessagePublisher messagePublisher;
@Ignore
@Test
public void regist() throws Exception {
@ -139,4 +143,17 @@ public class NoAuthProbeServiceTest {
}
@Test
public void sendWeb() {
Domain domain = new Domain();
domain.setId(1);
List<NoAuthProbe> probes = this.noAuthProbeService.readAllByDomain(domain);
messagePublisher.publishToDomain("/web", domain, "NoAuthProbeService.regist", probes);
}
}