ing
This commit is contained in:
parent
d6bda70a70
commit
339131e112
22
.vscode/test-launch.json
vendored
22
.vscode/test-launch.json
vendored
|
@ -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": ""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
2
pom.xml
2
pom.xml
|
@ -51,7 +51,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.loafle.overflow</groupId>
|
<groupId>com.loafle.overflow</groupId>
|
||||||
<artifactId>commons-java</artifactId>
|
<artifactId>commons-java</artifactId>
|
||||||
<version>1.0.78-SNAPSHOT</version>
|
<version>1.0.79-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -6,11 +6,15 @@ import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by insanity on 17. 6. 23.
|
* Created by insanity on 17. 6. 23.
|
||||||
*/
|
*/
|
||||||
@Repository
|
@Repository
|
||||||
public interface InfraServiceDAO extends JpaRepository<InfraService, Long> {
|
public interface InfraServiceDAO extends JpaRepository<InfraService, Long> {
|
||||||
|
List<InfraService> 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")
|
@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(
|
InfraService findByInfraHostPortInfraHostIPIdAndInfraHostPortMetaPortTypeKeyAndInfraHostPortPort(
|
||||||
@Param("infraHostIPId") Long infraHostIPId, @Param("metaPortTypeKey") String metaPortTypeKey,
|
@Param("infraHostIPId") Long infraHostIPId, @Param("metaPortTypeKey") String metaPortTypeKey,
|
||||||
|
|
|
@ -361,4 +361,9 @@ public class CentralInfraService implements InfraService {
|
||||||
public List<InfraHost> readAllInfraHostByInfraZoneID(Long infraZoneID) throws OverflowException {
|
public List<InfraHost> readAllInfraHostByInfraZoneID(Long infraZoneID) throws OverflowException {
|
||||||
return this.infraHostDAO.findAllByInfraZoneId(infraZoneID);
|
return this.infraHostDAO.findAllByInfraZoneId(infraZoneID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<com.loafle.overflow.model.infra.InfraService> readAllInfraServiceByInfraHostPortID(Long infraHostPortID)
|
||||||
|
throws OverflowException {
|
||||||
|
return this.infraServiceDAO.findAllByInfraHostPortId(infraHostPortID);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -7,6 +7,7 @@ import java.util.List;
|
||||||
import com.loafle.overflow.central.spring.AppConfigTest;
|
import com.loafle.overflow.central.spring.AppConfigTest;
|
||||||
import com.loafle.overflow.model.infra.InfraHost;
|
import com.loafle.overflow.model.infra.InfraHost;
|
||||||
|
|
||||||
|
import org.codehaus.jackson.map.ObjectMapper;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -19,6 +20,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@ContextConfiguration(classes = { AppConfigTest.class })
|
@ContextConfiguration(classes = { AppConfigTest.class })
|
||||||
public class InfraServiceTest {
|
public class InfraServiceTest {
|
||||||
|
@Autowired
|
||||||
|
private ObjectMapper objectMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CentralInfraService infraService;
|
private CentralInfraService infraService;
|
||||||
|
@ -27,7 +30,23 @@ public class InfraServiceTest {
|
||||||
public void readAllInfraHostByInfraZoneID() throws Exception {
|
public void readAllInfraHostByInfraZoneID() throws Exception {
|
||||||
List<InfraHost> infraHosts = this.infraService.readAllInfraHostByInfraZoneID((long) 1);
|
List<InfraHost> infraHosts = this.infraService.readAllInfraHostByInfraZoneID((long) 1);
|
||||||
|
|
||||||
|
String json = this.objectMapper.writeValueAsString(infraHosts);
|
||||||
|
|
||||||
|
System.out.println(json);
|
||||||
|
|
||||||
assertNotNull(infraHosts);
|
assertNotNull(infraHosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void readAllInfraServiceByInfraHostPortID() throws Exception {
|
||||||
|
List<com.loafle.overflow.model.infra.InfraService> infraServices = this.infraService
|
||||||
|
.readAllInfraServiceByInfraHostPortID((long) 1);
|
||||||
|
|
||||||
|
String json = this.objectMapper.writeValueAsString(infraServices);
|
||||||
|
|
||||||
|
System.out.println(json);
|
||||||
|
|
||||||
|
assertNotNull(infraServices);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user