From 17e3913581c3af49406bfce19f57ab1cd3b14d92 Mon Sep 17 00:00:00 2001 From: insanity Date: Fri, 23 Jun 2017 15:43:26 +0900 Subject: [PATCH] infra arrange --- .../overflow/module/infra/dao/InfraDAO.java | 14 ++++++++++ .../module/infra/dao/InfraHostDAO.java | 12 +++++++++ .../module/infra/dao/InfraMachineDAO.java | 12 +++++++++ .../infra/dao/InfraOSApplicationDAO.java | 12 +++++++++ .../overflow/module/infra/dao/InfraOSDAO.java | 12 +++++++++ .../module/infra/dao/InfraOSDaemonDAO.java | 12 +++++++++ .../module/infra/dao/InfraOSPortDAO.java | 12 +++++++++ .../module/infra/dao/InfraServiceDAO.java | 12 +++++++++ .../module/infra/{ => model}/Infra.java | 2 +- .../module/infra/{ => model}/InfraHost.java | 2 +- .../infra/{ => model}/InfraMachine.java | 2 +- .../module/infra/{ => model}/InfraOS.java | 2 +- .../infra/{ => model}/InfraOSApplication.java | 2 +- .../infra/{ => model}/InfraOSDaemon.java | 2 +- .../module/infra/{ => model}/InfraOSPort.java | 2 +- .../infra/{ => model}/InfraService.java | 2 +- .../overflow/module/target/model/Target.java | 2 +- src/main/resources/database.properties | 8 +++--- .../overflow/infra/dao/JPAInfraDAOTest.java | 26 +++++++++++++++++++ .../overflow/target/dao/JPATargetDAOTest.java | 2 +- 20 files changed, 138 insertions(+), 14 deletions(-) create mode 100644 src/main/java/com/loafle/overflow/module/infra/dao/InfraDAO.java create mode 100644 src/main/java/com/loafle/overflow/module/infra/dao/InfraHostDAO.java create mode 100644 src/main/java/com/loafle/overflow/module/infra/dao/InfraMachineDAO.java create mode 100644 src/main/java/com/loafle/overflow/module/infra/dao/InfraOSApplicationDAO.java create mode 100644 src/main/java/com/loafle/overflow/module/infra/dao/InfraOSDAO.java create mode 100644 src/main/java/com/loafle/overflow/module/infra/dao/InfraOSDaemonDAO.java create mode 100644 src/main/java/com/loafle/overflow/module/infra/dao/InfraOSPortDAO.java create mode 100644 src/main/java/com/loafle/overflow/module/infra/dao/InfraServiceDAO.java rename src/main/java/com/loafle/overflow/module/infra/{ => model}/Infra.java (96%) rename src/main/java/com/loafle/overflow/module/infra/{ => model}/InfraHost.java (96%) rename src/main/java/com/loafle/overflow/module/infra/{ => model}/InfraMachine.java (96%) rename src/main/java/com/loafle/overflow/module/infra/{ => model}/InfraOS.java (96%) rename src/main/java/com/loafle/overflow/module/infra/{ => model}/InfraOSApplication.java (96%) rename src/main/java/com/loafle/overflow/module/infra/{ => model}/InfraOSDaemon.java (96%) rename src/main/java/com/loafle/overflow/module/infra/{ => model}/InfraOSPort.java (97%) rename src/main/java/com/loafle/overflow/module/infra/{ => model}/InfraService.java (97%) create mode 100644 src/test/java/com/loafle/overflow/infra/dao/JPAInfraDAOTest.java diff --git a/src/main/java/com/loafle/overflow/module/infra/dao/InfraDAO.java b/src/main/java/com/loafle/overflow/module/infra/dao/InfraDAO.java new file mode 100644 index 0000000..dec00ed --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/dao/InfraDAO.java @@ -0,0 +1,14 @@ +package com.loafle.overflow.module.infra.dao; + +import com.loafle.overflow.module.infra.model.Infra; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface InfraDAO extends JpaRepository { +// @Query("select m from Member m WHERE m.email = :#{#m2.email}") +// Member findByEmail(@Param("m2") Member member); +} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/infra/dao/InfraHostDAO.java b/src/main/java/com/loafle/overflow/module/infra/dao/InfraHostDAO.java new file mode 100644 index 0000000..0c1eb90 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/dao/InfraHostDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.infra.dao; + +import com.loafle.overflow.module.infra.model.InfraHost; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface InfraHostDAO extends JpaRepository { +} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/infra/dao/InfraMachineDAO.java b/src/main/java/com/loafle/overflow/module/infra/dao/InfraMachineDAO.java new file mode 100644 index 0000000..bfedb13 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/dao/InfraMachineDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.infra.dao; + +import com.loafle.overflow.module.infra.model.InfraMachine; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface InfraMachineDAO extends JpaRepository { +} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSApplicationDAO.java b/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSApplicationDAO.java new file mode 100644 index 0000000..43d626a --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSApplicationDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.infra.dao; + +import com.loafle.overflow.module.infra.model.InfraOSApplication; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface InfraOSApplicationDAO extends JpaRepository { +} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSDAO.java b/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSDAO.java new file mode 100644 index 0000000..073dda4 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.infra.dao; + +import com.loafle.overflow.module.infra.model.InfraOS; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface InfraOSDAO extends JpaRepository { +} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSDaemonDAO.java b/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSDaemonDAO.java new file mode 100644 index 0000000..1a1df72 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSDaemonDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.infra.dao; + +import com.loafle.overflow.module.infra.model.InfraOSDaemon; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface InfraOSDaemonDAO extends JpaRepository { +} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSPortDAO.java b/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSPortDAO.java new file mode 100644 index 0000000..80d4be5 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSPortDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.infra.dao; + +import com.loafle.overflow.module.infra.model.InfraOSPort; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface InfraOSPortDAO extends JpaRepository { +} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/infra/dao/InfraServiceDAO.java b/src/main/java/com/loafle/overflow/module/infra/dao/InfraServiceDAO.java new file mode 100644 index 0000000..1c89a97 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/dao/InfraServiceDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.infra.dao; + +import com.loafle.overflow.module.infra.model.InfraService; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface InfraServiceDAO extends JpaRepository { +} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/infra/Infra.java b/src/main/java/com/loafle/overflow/module/infra/model/Infra.java similarity index 96% rename from src/main/java/com/loafle/overflow/module/infra/Infra.java rename to src/main/java/com/loafle/overflow/module/infra/model/Infra.java index fddf5fd..60dbe62 100644 --- a/src/main/java/com/loafle/overflow/module/infra/Infra.java +++ b/src/main/java/com/loafle/overflow/module/infra/model/Infra.java @@ -1,4 +1,4 @@ -package com.loafle.overflow.module.infra; +package com.loafle.overflow.module.infra.model; import com.loafle.overflow.meta.model.MetaInfraType; diff --git a/src/main/java/com/loafle/overflow/module/infra/InfraHost.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraHost.java similarity index 96% rename from src/main/java/com/loafle/overflow/module/infra/InfraHost.java rename to src/main/java/com/loafle/overflow/module/infra/model/InfraHost.java index 5b97d22..265b0ad 100644 --- a/src/main/java/com/loafle/overflow/module/infra/InfraHost.java +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraHost.java @@ -1,4 +1,4 @@ -package com.loafle.overflow.module.infra; +package com.loafle.overflow.module.infra.model; import javax.persistence.*; import java.util.Date; diff --git a/src/main/java/com/loafle/overflow/module/infra/InfraMachine.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraMachine.java similarity index 96% rename from src/main/java/com/loafle/overflow/module/infra/InfraMachine.java rename to src/main/java/com/loafle/overflow/module/infra/model/InfraMachine.java index fa482f7..14a44b8 100644 --- a/src/main/java/com/loafle/overflow/module/infra/InfraMachine.java +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraMachine.java @@ -1,4 +1,4 @@ -package com.loafle.overflow.module.infra; +package com.loafle.overflow.module.infra.model; import com.loafle.overflow.module.probe.model.Probe; diff --git a/src/main/java/com/loafle/overflow/module/infra/InfraOS.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraOS.java similarity index 96% rename from src/main/java/com/loafle/overflow/module/infra/InfraOS.java rename to src/main/java/com/loafle/overflow/module/infra/model/InfraOS.java index de236d4..d920490 100644 --- a/src/main/java/com/loafle/overflow/module/infra/InfraOS.java +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraOS.java @@ -1,4 +1,4 @@ -package com.loafle.overflow.module.infra; +package com.loafle.overflow.module.infra.model; import com.loafle.overflow.meta.model.MetaInfraVendor; diff --git a/src/main/java/com/loafle/overflow/module/infra/InfraOSApplication.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraOSApplication.java similarity index 96% rename from src/main/java/com/loafle/overflow/module/infra/InfraOSApplication.java rename to src/main/java/com/loafle/overflow/module/infra/model/InfraOSApplication.java index 3abd24b..6d7701c 100644 --- a/src/main/java/com/loafle/overflow/module/infra/InfraOSApplication.java +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraOSApplication.java @@ -1,4 +1,4 @@ -package com.loafle.overflow.module.infra; +package com.loafle.overflow.module.infra.model; import javax.persistence.*; import java.util.Date; diff --git a/src/main/java/com/loafle/overflow/module/infra/InfraOSDaemon.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraOSDaemon.java similarity index 96% rename from src/main/java/com/loafle/overflow/module/infra/InfraOSDaemon.java rename to src/main/java/com/loafle/overflow/module/infra/model/InfraOSDaemon.java index c20b2e7..5238545 100644 --- a/src/main/java/com/loafle/overflow/module/infra/InfraOSDaemon.java +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraOSDaemon.java @@ -1,4 +1,4 @@ -package com.loafle.overflow.module.infra; +package com.loafle.overflow.module.infra.model; import javax.persistence.*; import java.util.Date; diff --git a/src/main/java/com/loafle/overflow/module/infra/InfraOSPort.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraOSPort.java similarity index 97% rename from src/main/java/com/loafle/overflow/module/infra/InfraOSPort.java rename to src/main/java/com/loafle/overflow/module/infra/model/InfraOSPort.java index 899de41..c07f3c9 100644 --- a/src/main/java/com/loafle/overflow/module/infra/InfraOSPort.java +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraOSPort.java @@ -1,4 +1,4 @@ -package com.loafle.overflow.module.infra; +package com.loafle.overflow.module.infra.model; import com.loafle.overflow.meta.model.MetaInfraVendor; diff --git a/src/main/java/com/loafle/overflow/module/infra/InfraService.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraService.java similarity index 97% rename from src/main/java/com/loafle/overflow/module/infra/InfraService.java rename to src/main/java/com/loafle/overflow/module/infra/model/InfraService.java index 564e5be..796762e 100644 --- a/src/main/java/com/loafle/overflow/module/infra/InfraService.java +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraService.java @@ -1,4 +1,4 @@ -package com.loafle.overflow.module.infra; +package com.loafle.overflow.module.infra.model; import com.loafle.overflow.meta.model.MetaInfraVendor; diff --git a/src/main/java/com/loafle/overflow/module/target/model/Target.java b/src/main/java/com/loafle/overflow/module/target/model/Target.java index 15e901a..362a967 100644 --- a/src/main/java/com/loafle/overflow/module/target/model/Target.java +++ b/src/main/java/com/loafle/overflow/module/target/model/Target.java @@ -1,6 +1,6 @@ package com.loafle.overflow.module.target.model; -import com.loafle.overflow.module.infra.Infra; +import com.loafle.overflow.module.infra.model.Infra; import com.loafle.overflow.module.probe.model.Probe; import javax.persistence.*; diff --git a/src/main/resources/database.properties b/src/main/resources/database.properties index 7347b51..22f6e34 100644 --- a/src/main/resources/database.properties +++ b/src/main/resources/database.properties @@ -1,11 +1,11 @@ -spring.datasource.url=jdbc:postgresql://192.168.1.106:5432/postgres -spring.datasource.username=vertx -spring.datasource.password=qwe123 +spring.datasource.url=jdbc:postgresql://192.168.1.106:5432/overflow +spring.datasource.username=overflow +spring.datasource.password=qwer5795 spring.datasource.driver-class-name=org.postgresql.Driver spring.jpa.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect spring.jpa.database=postgresql -spring.jpa.hibernate.ddl-auto=create +spring.jpa.hibernate.ddl-auto=update #spring.jpa.hibernate.ddl-auto=update spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy spring.jpa.show-sql=true diff --git a/src/test/java/com/loafle/overflow/infra/dao/JPAInfraDAOTest.java b/src/test/java/com/loafle/overflow/infra/dao/JPAInfraDAOTest.java new file mode 100644 index 0000000..b2c7bbe --- /dev/null +++ b/src/test/java/com/loafle/overflow/infra/dao/JPAInfraDAOTest.java @@ -0,0 +1,26 @@ +package com.loafle.overflow.infra.dao; + +import com.loafle.overflow.AppConfig; +import com.loafle.overflow.JdbcConfiguration; +import com.loafle.overflow.module.infra.dao.InfraDAO; +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; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class}) +public class JPAInfraDAOTest { + + @Autowired + private InfraDAO repo; + + + @Test + public void create() { + + } + + +} \ No newline at end of file diff --git a/src/test/java/com/loafle/overflow/target/dao/JPATargetDAOTest.java b/src/test/java/com/loafle/overflow/target/dao/JPATargetDAOTest.java index 219a0d4..1e7921f 100644 --- a/src/test/java/com/loafle/overflow/target/dao/JPATargetDAOTest.java +++ b/src/test/java/com/loafle/overflow/target/dao/JPATargetDAOTest.java @@ -2,7 +2,7 @@ package com.loafle.overflow.target.dao; import com.loafle.overflow.AppConfig; import com.loafle.overflow.JdbcConfiguration; -import com.loafle.overflow.module.infra.Infra; +import com.loafle.overflow.module.infra.model.Infra; import com.loafle.overflow.module.probe.model.Probe; import com.loafle.overflow.module.target.dao.TargetDAO; import com.loafle.overflow.module.target.model.Target;