ing
This commit is contained in:
		
							parent
							
								
									727b32b78b
								
							
						
					
					
						commit
						57d82209d2
					
				
							
								
								
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							@ -50,7 +50,7 @@
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>com.loafle.overflow</groupId>
 | 
			
		||||
            <artifactId>commons-java</artifactId>
 | 
			
		||||
            <version>1.0.84-SNAPSHOT</version>
 | 
			
		||||
            <version>1.0.85-SNAPSHOT</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
        <dependency>
 | 
			
		||||
 | 
			
		||||
@ -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")
 | 
			
		||||
  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")
 | 
			
		||||
  InfraHostPort findByInfraHostIPIdAndMetaPortTypeKeyAndPort(@Param("infraHostIPId") Long infraHostIPId,
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user