This commit is contained in:
crusader 2018-06-15 17:58:29 +09:00
parent 727b32b78b
commit 57d82209d2
3 changed files with 55 additions and 2 deletions

View File

@ -50,7 +50,7 @@
<dependency> <dependency>
<groupId>com.loafle.overflow</groupId> <groupId>com.loafle.overflow</groupId>
<artifactId>commons-java</artifactId> <artifactId>commons-java</artifactId>
<version>1.0.84-SNAPSHOT</version> <version>1.0.85-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -19,7 +19,7 @@ public interface InfraHostPortDAO extends JpaRepository<InfraHostPort, Long> {
@Query("SELECT ihp from InfraHostPort ihp where ihp.infraHostIP.id = :infraHostIPId AND metaPortType.key = :metaPortTypeKey") @Query("SELECT ihp from InfraHostPort ihp where ihp.infraHostIP.id = :infraHostIPId AND metaPortType.key = :metaPortTypeKey")
List<InfraHostPort> findAllByInfraHostIPIdAndMetaPortTypeKey(@Param("infraHostIPId") Long infraHostIPId, List<InfraHostPort> findAllByInfraHostIPIdAndMetaPortTypeKey(@Param("infraHostIPId") Long infraHostIPId,
@Param("metaPortTypeKey") Short metaPortTypeKey); @Param("metaPortTypeKey") String metaPortTypeKey);
@Query("SELECT ihp from InfraHostPort ihp where ihp.infraHostIP.id = :infraHostIPId AND metaPortType.key = :metaPortTypeKey AND port = :port") @Query("SELECT ihp from InfraHostPort ihp where ihp.infraHostIP.id = :infraHostIPId AND metaPortType.key = :metaPortTypeKey AND port = :port")
InfraHostPort findByInfraHostIPIdAndMetaPortTypeKeyAndPort(@Param("infraHostIPId") Long infraHostIPId, InfraHostPort findByInfraHostIPIdAndMetaPortTypeKeyAndPort(@Param("infraHostIPId") Long infraHostIPId,

View File

@ -0,0 +1,53 @@
package com.loafle.overflow.central.module.infra.dao;
import static org.junit.Assert.assertNotNull;
import java.util.List;
import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.model.domain.Domain;
import com.loafle.overflow.model.infra.InfraHostPort;
import com.loafle.overflow.model.member.Member;
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;
/**
* Created by snoop on 17. 9. 14.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { AppConfigTest.class })
public class InfraHostPortDAOTest {
@Autowired
private InfraHostPortDAO infraHostPortDAO;
@Test
public void findAllByInfraHostIPId() throws Exception {
List<InfraHostPort> infraHostPorts = this.infraHostPortDAO.findAllByInfraHostIPId((long) 1);
assertNotNull(infraHostPorts);
}
@Test
public void findAllByInfraHostIPIdAndMetaPortTypeKey() throws Exception {
List<InfraHostPort> infraHostPorts = this.infraHostPortDAO.findAllByInfraHostIPIdAndMetaPortTypeKey((long) 1,
"TCP");
assertNotNull(infraHostPorts);
}
@Test
public void findByInfraHostIPIdAndMetaPortTypeKeyAndPort() throws Exception {
InfraHostPort infraHostPort = this.infraHostPortDAO.findByInfraHostIPIdAndMetaPortTypeKeyAndPort((long) 1, "TCP",
5432);
assertNotNull(infraHostPort);
}
}