From 533c1b33d81ceeecdc32279a4292c70ef3417d68 Mon Sep 17 00:00:00 2001 From: snoop Date: Sun, 25 Jun 2017 17:01:20 +0900 Subject: [PATCH] added test meta --- .../dao/MetaProbeArchitectureDAOTest.java | 50 ++++++++++ .../overflow/meta/dao/MetaProbeOsDAOTest.java | 62 ++++++++++++ .../meta/dao/MetaProbePackageDAOTest.java | 97 +++++++++++++++++++ .../meta/dao/MetaProbeVersionDAOTest.java | 54 +++++++++++ 4 files changed, 263 insertions(+) create mode 100644 src/test/java/com/loafle/overflow/meta/dao/MetaProbeArchitectureDAOTest.java create mode 100644 src/test/java/com/loafle/overflow/meta/dao/MetaProbeOsDAOTest.java create mode 100644 src/test/java/com/loafle/overflow/meta/dao/MetaProbePackageDAOTest.java create mode 100644 src/test/java/com/loafle/overflow/meta/dao/MetaProbeVersionDAOTest.java diff --git a/src/test/java/com/loafle/overflow/meta/dao/MetaProbeArchitectureDAOTest.java b/src/test/java/com/loafle/overflow/meta/dao/MetaProbeArchitectureDAOTest.java new file mode 100644 index 0000000..ff042df --- /dev/null +++ b/src/test/java/com/loafle/overflow/meta/dao/MetaProbeArchitectureDAOTest.java @@ -0,0 +1,50 @@ +package com.loafle.overflow.meta.dao; + +import com.loafle.overflow.AppConfig; +import com.loafle.overflow.JdbcConfiguration; +import com.loafle.overflow.meta.model.MetaProbeArchitecture; +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.ArrayList; +import java.util.List; + +import static org.junit.Assert.*; + +/** + * Created by root on 17. 6. 25. + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class}) +public class MetaProbeArchitectureDAOTest { + + @Autowired + private MetaProbeArchitectureDAO metaProbeArchitectureDAO; + + @Test + public void Create() { + + + MetaProbeArchitecture ax8632 = new MetaProbeArchitecture(); + ax8632.setArchitecture("x86-32bit"); + + MetaProbeArchitecture ax8664 = new MetaProbeArchitecture(); + ax8632.setArchitecture("x86-64bit"); + + + List list = new ArrayList<>(); + list.add(ax8632); + list.add(ax8664); + + for(int indexI =1; indexI<= list.size(); ++indexI) { + MetaProbeArchitecture architecture = list.get(indexI-1); + architecture.setId((short)indexI); + this.metaProbeArchitectureDAO.save(architecture); + } + + } + +} \ No newline at end of file diff --git a/src/test/java/com/loafle/overflow/meta/dao/MetaProbeOsDAOTest.java b/src/test/java/com/loafle/overflow/meta/dao/MetaProbeOsDAOTest.java new file mode 100644 index 0000000..edb090a --- /dev/null +++ b/src/test/java/com/loafle/overflow/meta/dao/MetaProbeOsDAOTest.java @@ -0,0 +1,62 @@ +package com.loafle.overflow.meta.dao; + +import com.loafle.overflow.AppConfig; +import com.loafle.overflow.JdbcConfiguration; +import com.loafle.overflow.meta.model.MetaProbeOs; +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.ArrayList; +import java.util.List; + +import static org.junit.Assert.*; + +/** + * Created by root on 17. 6. 25. + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class}) +public class MetaProbeOsDAOTest { + + @Autowired + private MetaProbeOsDAO metaProbeOsDAO; + + @Test + public void Create() { + + MetaProbeOs metaWindows = new MetaProbeOs(); + metaWindows.setName("Windows"); + + MetaProbeOs metaDebian = new MetaProbeOs(); + metaDebian.setName("Debian"); + + MetaProbeOs metaUbuntu = new MetaProbeOs(); + metaUbuntu.setName("Ubuntu"); + + MetaProbeOs metaFedora = new MetaProbeOs(); + metaFedora.setName("Fedora"); + + List probeOs = new ArrayList<>(); + + probeOs.add(metaWindows); + probeOs.add(metaDebian); + probeOs.add(metaUbuntu); + probeOs.add(metaFedora); + + + + for (int indexIO = 1; indexIO <= probeOs.size(); ++indexIO) { + + MetaProbeOs os = probeOs.get(indexIO -1); + os.setId((short)indexIO); + + this.metaProbeOsDAO.save(os); + } + + + } + +} \ No newline at end of file diff --git a/src/test/java/com/loafle/overflow/meta/dao/MetaProbePackageDAOTest.java b/src/test/java/com/loafle/overflow/meta/dao/MetaProbePackageDAOTest.java new file mode 100644 index 0000000..9357529 --- /dev/null +++ b/src/test/java/com/loafle/overflow/meta/dao/MetaProbePackageDAOTest.java @@ -0,0 +1,97 @@ +package com.loafle.overflow.meta.dao; + +import com.loafle.overflow.AppConfig; +import com.loafle.overflow.JdbcConfiguration; +import com.loafle.overflow.meta.model.MetaProbeArchitecture; +import com.loafle.overflow.meta.model.MetaProbeOs; +import com.loafle.overflow.meta.model.MetaProbePackage; +import com.loafle.overflow.meta.model.MetaProbeVersion; +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.ArrayList; +import java.util.List; + +import static org.junit.Assert.*; + +/** + * Created by root on 17. 6. 25. + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class}) +public class MetaProbePackageDAOTest { + + @Autowired + private MetaProbePackageDAO metaProbePackageDAO; + + @Test + public void create() + { + + MetaProbeArchitecture ax8632 = new MetaProbeArchitecture(); + ax8632.setId((short)1); + + MetaProbeArchitecture ax8664 = new MetaProbeArchitecture(); + ax8664.setId((short)2); + + List archilist = new ArrayList<>(); + archilist.add(ax8632); + archilist.add(ax8664); + + MetaProbeOs metaWindows = new MetaProbeOs(); + metaWindows.setId((short)1); + + MetaProbeOs metaDebian = new MetaProbeOs(); + metaDebian.setId((short)2); + + MetaProbeOs metaUbuntu = new MetaProbeOs(); + metaUbuntu.setId((short)3); + + MetaProbeOs metaFedora = new MetaProbeOs(); + metaFedora.setId((short)4); + + List probeOs = new ArrayList<>(); + probeOs.add(metaWindows); + probeOs.add(metaDebian); + probeOs.add(metaUbuntu); + probeOs.add(metaFedora); + + + MetaProbeVersion version100 = new MetaProbeVersion(); + version100.setId((short)1); + + MetaProbeVersion version110 = new MetaProbeVersion(); + version110.setId((short)2); + + List versionlist = new ArrayList<>(); + + versionlist.add(version100); + versionlist.add(version110); + + + + + for(MetaProbeVersion version : versionlist) { + + for(MetaProbeArchitecture architecture : archilist) { + + for(MetaProbeOs os : probeOs) { + + MetaProbePackage aPackage = new MetaProbePackage(); + aPackage.setOs(os); + aPackage.setArchitecture(architecture); + aPackage.setVersion(version); + + this.metaProbePackageDAO.save(aPackage); + + } + + } + + } + } + +} \ No newline at end of file diff --git a/src/test/java/com/loafle/overflow/meta/dao/MetaProbeVersionDAOTest.java b/src/test/java/com/loafle/overflow/meta/dao/MetaProbeVersionDAOTest.java new file mode 100644 index 0000000..b06f7c6 --- /dev/null +++ b/src/test/java/com/loafle/overflow/meta/dao/MetaProbeVersionDAOTest.java @@ -0,0 +1,54 @@ +package com.loafle.overflow.meta.dao; + +import com.loafle.overflow.AppConfig; +import com.loafle.overflow.JdbcConfiguration; +import com.loafle.overflow.meta.model.MetaProbeVersion; +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.ArrayList; +import java.util.List; + +import static org.junit.Assert.*; + +/** + * Created by root on 17. 6. 25. + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class}) +public class MetaProbeVersionDAOTest { + + @Autowired + private MetaProbeVersionDAO metaProbeVersionDAO; + + + @Test + public void Create() { + + MetaProbeVersion version100 = new MetaProbeVersion(); + version100.setVersion("1.0.0"); + + + MetaProbeVersion version110 = new MetaProbeVersion(); + version110.setVersion("1.1.0"); + + + List list = new ArrayList<>(); + + list.add(version100); + list.add(version110); + + + for(int indexI = 1; indexI <= list.size() ;++indexI) { + MetaProbeVersion version = list.get(indexI - 1); + version.setId((short)indexI); + + this.metaProbeVersionDAO.save(version); + } + + } + +} \ No newline at end of file