diff --git a/.vscode/test-launch.json b/.vscode/test-launch.json
deleted file mode 100644
index d9a72db..0000000
--- a/.vscode/test-launch.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "run": [
- {
- "name": "central",
- "projectName": "central",
- "workingDirectory": "/project/loafle/overflow/central",
- "args": [],
- "vmargs": [],
- "preLaunchTask": ""
- }
- ],
- "debug": [
- {
- "name": "central",
- "projectName": "central",
- "workingDirectory": "/project/loafle/overflow/central",
- "args": [],
- "vmargs": [],
- "preLaunchTask": ""
- }
- ]
-}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 30fa5f6..befe2c5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,7 +51,7 @@
com.loafle.overflow
commons-java
- 1.0.78-SNAPSHOT
+ 1.0.79-SNAPSHOT
diff --git a/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraServiceDAO.java b/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraServiceDAO.java
index 4385faa..95367f2 100644
--- a/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraServiceDAO.java
+++ b/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraServiceDAO.java
@@ -6,13 +6,17 @@ import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
+import java.util.List;
+
/**
* Created by insanity on 17. 6. 23.
*/
@Repository
public interface InfraServiceDAO extends JpaRepository {
+ List findAllByInfraHostPortId(Long infraHostPortId);
+
@Query("SELECT i from InfraService i where i.infraHostPort.infraHostIP.id = :infraHostIPId AND i.infraHostPort.metaPortType.key = :metaPortTypeKey AND i.infraHostPort.port = :port")
InfraService findByInfraHostPortInfraHostIPIdAndInfraHostPortMetaPortTypeKeyAndInfraHostPortPort(
@Param("infraHostIPId") Long infraHostIPId, @Param("metaPortTypeKey") String metaPortTypeKey,
@Param("port") Integer port);
-}
+}
\ No newline at end of file
diff --git a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraService.java b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraService.java
index a47f8c8..119192a 100644
--- a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraService.java
+++ b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraService.java
@@ -361,4 +361,9 @@ public class CentralInfraService implements InfraService {
public List readAllInfraHostByInfraZoneID(Long infraZoneID) throws OverflowException {
return this.infraHostDAO.findAllByInfraZoneId(infraZoneID);
}
-}
+
+ public List readAllInfraServiceByInfraHostPortID(Long infraHostPortID)
+ throws OverflowException {
+ return this.infraServiceDAO.findAllByInfraHostPortId(infraHostPortID);
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/loafle/overflow/central/module/infra/service/InfraServiceTest.java b/src/test/java/com/loafle/overflow/central/module/infra/service/InfraServiceTest.java
index 9426640..a36099b 100644
--- a/src/test/java/com/loafle/overflow/central/module/infra/service/InfraServiceTest.java
+++ b/src/test/java/com/loafle/overflow/central/module/infra/service/InfraServiceTest.java
@@ -7,6 +7,7 @@ import java.util.List;
import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.model.infra.InfraHost;
+import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -19,6 +20,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { AppConfigTest.class })
public class InfraServiceTest {
+ @Autowired
+ private ObjectMapper objectMapper;
@Autowired
private CentralInfraService infraService;
@@ -27,7 +30,23 @@ public class InfraServiceTest {
public void readAllInfraHostByInfraZoneID() throws Exception {
List infraHosts = this.infraService.readAllInfraHostByInfraZoneID((long) 1);
+ String json = this.objectMapper.writeValueAsString(infraHosts);
+
+ System.out.println(json);
+
assertNotNull(infraHosts);
}
-}
\ No newline at end of file
+ @Test
+ public void readAllInfraServiceByInfraHostPortID() throws Exception {
+ List infraServices = this.infraService
+ .readAllInfraServiceByInfraHostPortID((long) 1);
+
+ String json = this.objectMapper.writeValueAsString(infraServices);
+
+ System.out.println(json);
+
+ assertNotNull(infraServices);
+ }
+
+}