From c5bc4f79cedfa45dd6c1862c31c2431bb93515bc Mon Sep 17 00:00:00 2001 From: snoop Date: Wed, 28 Jun 2017 15:29:21 +0900 Subject: [PATCH] added service noauth probe --- .../service/NoAuthProbeServiceTest.java | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/test/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeServiceTest.java diff --git a/src/test/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeServiceTest.java b/src/test/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeServiceTest.java new file mode 100644 index 0000000..d019524 --- /dev/null +++ b/src/test/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeServiceTest.java @@ -0,0 +1,76 @@ +package com.loafle.overflow.module.noauthprobe.service; + +import com.loafle.overflow.module.domain.model.Domain; +import com.loafle.overflow.module.meta.model.MetaNoAuthProbeStatus; +import com.loafle.overflow.module.noauthprobe.model.NoAuthProbe; +import com.loafle.overflow.spring.AppConfig; +import com.loafle.overflow.spring.JdbcConfiguration; +import org.junit.Assert; +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; + +import java.util.List; + +import static org.junit.Assert.*; + +/** + * Created by snoop on 17. 6. 28. + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class}) +public class NoAuthProbeServiceTest { + + @Autowired + private NoAuthProbeService noAuthProbeService; + + @Test + public void regist() throws Exception { + + NoAuthProbe noAuthProbe = new NoAuthProbe(); + + + noAuthProbe.setHostName("snoop"); + noAuthProbe.setIpAddress(3232235980L); + noAuthProbe.setMacAddress(8796753988883L); + noAuthProbe.setApiKey("52abd6fd57e511e7ac52080027658d13"); + + MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus(); + metaNoAuthProbeStatus.setId((short)3); + + noAuthProbe.setStatus(metaNoAuthProbeStatus); + noAuthProbe.setTempProbeKey("ac7f252b5bc811e784ad080027658d13"); + + Domain d = new Domain(); + d.setId(1); + noAuthProbe.setDomain(d); + + this.noAuthProbeService.regist(noAuthProbe); + + Assert.assertNotEquals(noAuthProbe.getId(), 0); + + } + + @Test + public void readAllByDomain() throws Exception { + + Domain domain = new Domain(); + domain.setId(1); + + List probes = this.noAuthProbeService.readAllByDomain(domain); + + Assert.assertNotEquals(probes.size(), 0); + + } + + @Test + public void read() throws Exception { + + NoAuthProbe noAuthProbe = this.noAuthProbeService.read(1); + + Assert.assertNotEquals(noAuthProbe, null); + } + +} \ No newline at end of file