added test discovery
This commit is contained in:
parent
2ad726523d
commit
890f37d968
|
@ -2,6 +2,7 @@ package com.loafle.overflow.module.discovery.service;
|
||||||
|
|
||||||
import com.loafle.overflow.commons.service.MessagePublisher;
|
import com.loafle.overflow.commons.service.MessagePublisher;
|
||||||
import com.loafle.overflow.module.discovery.model.DiscoveryStartInfo;
|
import com.loafle.overflow.module.discovery.model.DiscoveryStartInfo;
|
||||||
|
import com.loafle.overflow.module.domain.model.Domain;
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
import org.codehaus.jackson.map.ObjectMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -27,4 +28,25 @@ public class DiscoveryService {
|
||||||
System.out.println(json);
|
System.out.println(json);
|
||||||
// this.messagePublisher.publishToProbe("/auth", noAuthProbe.getTempProbeKey(), "NoAuthProbeService.acceptNoAuthProbe", probe.getProbeKey());
|
// 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.loafle.overflow.module.noauthprobe.service;
|
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.domain.model.Domain;
|
||||||
import com.loafle.overflow.module.meta.model.MetaNoAuthProbeStatus;
|
import com.loafle.overflow.module.meta.model.MetaNoAuthProbeStatus;
|
||||||
import com.loafle.overflow.module.noauthprobe.model.NoAuthProbe;
|
import com.loafle.overflow.module.noauthprobe.model.NoAuthProbe;
|
||||||
|
@ -26,6 +27,9 @@ public class NoAuthProbeServiceTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
private NoAuthProbeService noAuthProbeService;
|
private NoAuthProbeService noAuthProbeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MessagePublisher messagePublisher;
|
||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void regist() throws Exception {
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user