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>
|
||||
<groupId>com.loafle.overflow</groupId>
|
||||
<artifactId>commons-java</artifactId>
|
||||
<version>1.0.78-SNAPSHOT</version>
|
||||
<version>1.0.79-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -6,11 +6,15 @@ 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<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")
|
||||
InfraService findByInfraHostPortInfraHostIPIdAndInfraHostPortMetaPortTypeKeyAndInfraHostPortPort(
|
||||
@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 {
|
||||
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.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<InfraHost> infraHosts = this.infraService.readAllInfraHostByInfraZoneID((long) 1);
|
||||
|
||||
String json = this.objectMapper.writeValueAsString(infraHosts);
|
||||
|
||||
System.out.println(json);
|
||||
|
||||
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