diff --git a/src/main/java/com/loafle/overflow/proxy/ServiceProxy.java b/src/main/java/com/loafle/overflow/proxy/ServiceProxy.java new file mode 100644 index 0000000..ceaef6a --- /dev/null +++ b/src/main/java/com/loafle/overflow/proxy/ServiceProxy.java @@ -0,0 +1,55 @@ +package com.loafle.overflow.proxy; + +import com.loafle.overflow.api.ServerInput; +import com.loafle.overflow.module.domain.service.DomainService; +import com.loafle.overflow.module.email.service.EmailAuthService; +import com.loafle.overflow.module.infra.service.*; +import com.loafle.overflow.module.member.service.MemberService; +import com.loafle.overflow.module.noauthprobe.service.NoAuthProbeService; +import com.loafle.overflow.module.probe.service.ProbeService; +import com.loafle.overflow.module.probe.service.ProbeTaskService; +import com.loafle.overflow.module.sensor.service.SensorItemService; +import com.loafle.overflow.module.sensor.service.SensorService; +import com.loafle.overflow.module.target.service.TargetService; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Logger; + +/** + * Created by insanity on 17. 6. 28. + */ +public class ServiceProxy { + private static final Logger logger = Logger.getLogger(ServiceProxy.class.getName()); + + private static Map serviceMap = null; + + public ServiceProxy() { + ApplicationContext ctx = new AnnotationConfigApplicationContext("com.loafle.overflow"); + + serviceMap = new ConcurrentHashMap<>(); + serviceMap.put("member", ctx.getBean(MemberService.class)); + serviceMap.put("email", ctx.getBean(EmailAuthService.class)); + serviceMap.put("probe", ctx.getBean(ProbeService.class)); + serviceMap.put("probeTask", ctx.getBean(ProbeTaskService.class)); + serviceMap.put("noauthProbe", ctx.getBean(NoAuthProbeService.class)); + serviceMap.put("sensor", ctx.getBean(SensorService.class)); + serviceMap.put("sensorItem", ctx.getBean(SensorItemService.class)); + serviceMap.put("domain", ctx.getBean(DomainService.class)); + serviceMap.put("target", ctx.getBean(TargetService.class)); + serviceMap.put("infra", ctx.getBean(InfraService.class)); + serviceMap.put("infraHost", ctx.getBean(InfraHostService.class)); + serviceMap.put("infraMachine", ctx.getBean(InfraMachineService.class)); + serviceMap.put("infraOS", ctx.getBean(InfraOSService.class)); + serviceMap.put("infraOSApplication", ctx.getBean(InfraOSApplicationService.class)); + serviceMap.put("infraOSDaemon", ctx.getBean(InfraOSDaemonService.class)); + serviceMap.put("infraOSPort", ctx.getBean(InfraOSPortService.class)); + serviceMap.put("infraService", ctx.getBean(InfraServiceService.class)); + } + + public String process(ServerInput input, Object service) { + return null; + } +} diff --git a/src/main/proto/grpc.proto b/src/main/proto/grpc.proto deleted file mode 100644 index a02de1f..0000000 --- a/src/main/proto/grpc.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto3"; - -option java_multiple_files = true; -option java_package = "com.loafle.overflow.server.api"; -option java_generic_services = true; - - -message ServiceInput { - string serviceName = 1; - string methodName = 2; - map param = 3; -} - -message ServiceOutput { - string resultStr = 1; -} - -service overFlowServer { - rpc ExecServices(ServiceInput) returns (ServiceOutput) {} -} - - - diff --git a/src/test/java/com/loafle/overflow/module/email/service/EmailAuthServiceTest.java b/src/test/java/com/loafle/overflow/module/email/service/EmailAuthServiceTest.java index c4f4080..449d86d 100644 --- a/src/test/java/com/loafle/overflow/module/email/service/EmailAuthServiceTest.java +++ b/src/test/java/com/loafle/overflow/module/email/service/EmailAuthServiceTest.java @@ -1,19 +1,18 @@ package com.loafle.overflow.module.email.service; import com.loafle.overflow.spring.AppConfig; -import com.loafle.overflow.spring.JdbcConfiguration; import com.loafle.overflow.spring.MailConfiguration; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import static org.junit.Assert.*; - /** * Created by geek on 17. 6. 28. */ +@Ignore @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {AppConfig.class,MailConfiguration.class}) public class EmailAuthServiceTest { diff --git a/src/test/java/com/loafle/overflow/module/target/service/TargetDiscoveryServiceTest.java b/src/test/java/com/loafle/overflow/module/target/service/TargetDiscoveryServiceTest.java index 9389e4a..fd84fc2 100644 --- a/src/test/java/com/loafle/overflow/module/target/service/TargetDiscoveryServiceTest.java +++ b/src/test/java/com/loafle/overflow/module/target/service/TargetDiscoveryServiceTest.java @@ -6,6 +6,7 @@ import com.loafle.overflow.spring.AppConfig; import com.loafle.overflow.spring.JdbcConfiguration; import org.codehaus.jackson.map.DeserializationConfig; import org.codehaus.jackson.map.ObjectMapper; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -18,11 +19,10 @@ import java.io.FileReader; import java.io.IOException; import java.util.List; -import static org.junit.Assert.*; - /** * Created by snoop on 17. 6. 28. */ +@Ignore @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class}) public class TargetDiscoveryServiceTest {