init sql
This commit is contained in:
@@ -5,17 +5,16 @@ import com.loafle.overflow.JdbcConfiguration;
|
||||
import com.loafle.overflow.module.infra.model.Infra;
|
||||
import com.loafle.overflow.module.probe.model.Probe;
|
||||
import com.loafle.overflow.module.target.model.Target;
|
||||
import org.junit.Ignore;
|
||||
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.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Ignore
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
|
||||
public class TargetDAOTest {
|
||||
@@ -23,11 +22,10 @@ public class TargetDAOTest {
|
||||
@Autowired
|
||||
private TargetDAO repo;
|
||||
|
||||
|
||||
@Test
|
||||
public void create() {
|
||||
Target t = new Target();
|
||||
t.setCreateDate(new Timestamp(new Date().getTime()));
|
||||
t.setCreateDate(new Date());
|
||||
|
||||
Infra i = new Infra();
|
||||
i.setId(1);
|
||||
@@ -39,8 +37,16 @@ public class TargetDAOTest {
|
||||
t.setInfra(i);
|
||||
t.setProbe(p);
|
||||
|
||||
Target ret = repo.save(t);
|
||||
repo.save(t);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void list() {
|
||||
|
||||
Probe p = new Probe();
|
||||
p.setId(1);
|
||||
List<Target> list = repo.findAllByProbe(p);
|
||||
Assert.assertNotNull(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user