added service
noauth probe
This commit is contained in:
parent
09b58f1df7
commit
c5bc4f79ce
|
@ -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<NoAuthProbe> 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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user