Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
cd512a38a4
|
@ -1,14 +1,18 @@
|
|||
package com.loafle.overflow.module.infra.dao;
|
||||
|
||||
import com.loafle.overflow.module.domain.model.Domain;
|
||||
import com.loafle.overflow.module.infra.model.Infra;
|
||||
import com.loafle.overflow.module.probe.model.Probe;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by insanity on 17. 6. 23.
|
||||
*/
|
||||
@Repository
|
||||
public interface InfraDAO extends JpaRepository<Infra, Long> {
|
||||
// @Query("select m from Member m WHERE m.email = :#{#m2.email}")
|
||||
// Member findByEmail(@Param("m2") Member member);
|
||||
public List<Infra> findAllByProbe(Probe probe);
|
||||
|
||||
}
|
|
@ -1,10 +1,14 @@
|
|||
package com.loafle.overflow.module.infra.service;
|
||||
|
||||
import com.loafle.overflow.module.domain.model.Domain;
|
||||
import com.loafle.overflow.module.infra.dao.InfraDAO;
|
||||
import com.loafle.overflow.module.infra.model.Infra;
|
||||
import com.loafle.overflow.module.probe.model.Probe;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by insanity on 17. 6. 28.
|
||||
*/
|
||||
|
@ -23,4 +27,8 @@ public class InfraService {
|
|||
return this.infraDAO.findOne(id);
|
||||
}
|
||||
|
||||
public List<Infra> readAllByProbe(Probe probe) {
|
||||
return this.infraDAO.findAllByProbe(probe);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.loafle.overflow.module.member.service;
|
|||
|
||||
import com.loafle.overflow.module.member.dao.MemberDAO;
|
||||
import com.loafle.overflow.module.member.model.Member;
|
||||
import com.loafle.overflow.module.meta.model.MetaMemberStatus;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -37,6 +38,10 @@ public class MemberService {
|
|||
|
||||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||
member.setPw(passwordEncoder.encode(member.getPw()));
|
||||
|
||||
if (member.getStatus() == null) {
|
||||
member.setStatus(new MetaMemberStatus((short) 1));
|
||||
}
|
||||
return this.memberDAO.save(member);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,4 +32,8 @@ public class NoAuthProbeService {
|
|||
return this.noAuthProbeDAO.findOne(id);
|
||||
}
|
||||
|
||||
public List<NoAuthProbe> registForNoAuthProbes(List<NoAuthProbe> noAuthProbes) {
|
||||
|
||||
return this.noAuthProbeDAO.save(noAuthProbes);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,10 @@ public class ProbeService {
|
|||
return this.probeDAO.findAllByDomain(domain);
|
||||
}
|
||||
|
||||
public Probe read(long id) {
|
||||
return this.probeDAO.findOne(id);
|
||||
}
|
||||
|
||||
public Probe readByProbeKey(String probeKey) {
|
||||
|
||||
return this.probeDAO.findByProbeKey(probeKey);
|
||||
|
|
|
@ -400,6 +400,12 @@ INSERT INTO public.api_key (api_key,create_date,domain_id) VALUES (
|
|||
INSERT INTO public.noauth_probe (api_key,create_date,host_name,ip_address,mac_address,temp_probe_key,domain_id,probe_id,status) VALUES (
|
||||
'52abd6fd57e511e7ac52080027658d13','2017-06-26 12:43:46.877','snoop',3232235980,8796753988883,'1cf2555c57d511e79714080027658d13',1,NULL,3);
|
||||
|
||||
INSERT INTO public.noauth_probe (api_key,create_date,host_name,ip_address,mac_address,temp_probe_key,domain_id,probe_id,status) VALUES (
|
||||
'52abd6fd57e511e7ac52080027658d14','2017-08-11 12:43:46.877','geek',3232235980,8796753988883,'1cf2555c57d511e79714080027658d14',1,NULL,3);
|
||||
|
||||
INSERT INTO public.noauth_probe (api_key,create_date,host_name,ip_address,mac_address,temp_probe_key,domain_id,probe_id,status) VALUES (
|
||||
'52abd6fd57e511e7ac52080027658d15','2017-08-11 12:43:46.877','insanity',3232235980,8796753988883,'1cf2555c57d511e79714080027658d15',1,NULL,3);
|
||||
|
||||
INSERT INTO public.infra_machine (create_date,meta) VALUES (
|
||||
'2017-07-27 19:54:26.677','');
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ 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.*;
|
||||
|
@ -54,6 +55,38 @@ public class NoAuthProbeServiceTest {
|
|||
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void registForNoAuthProbes() throws Exception {
|
||||
|
||||
NoAuthProbe noAuthProbe = new NoAuthProbe();
|
||||
|
||||
noAuthProbe.setHostName("geek");
|
||||
noAuthProbe.setIpAddress(3232235980L);
|
||||
noAuthProbe.setMacAddress(8796753988883L);
|
||||
noAuthProbe.setApiKey("521abd6fd57e511e7ac52080027658d13");
|
||||
|
||||
MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus();
|
||||
metaNoAuthProbeStatus.setId((short)3);
|
||||
|
||||
noAuthProbe.setStatus(metaNoAuthProbeStatus);
|
||||
noAuthProbe.setTempProbeKey("a1c7f252b5bc811e784ad080027658d13");
|
||||
|
||||
Domain d = new Domain();
|
||||
d.setId(1);
|
||||
noAuthProbe.setDomain(d);
|
||||
|
||||
List<NoAuthProbe> noAuthProbes = new ArrayList<NoAuthProbe>();
|
||||
|
||||
noAuthProbes.add(noAuthProbe);
|
||||
List<NoAuthProbe> dd = this.noAuthProbeService.registForNoAuthProbes(noAuthProbes);
|
||||
|
||||
// System.out.println(dd.get(0).getId());
|
||||
|
||||
Assert.assertNotEquals(noAuthProbes.size(), 2);
|
||||
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void readAllByDomain() throws Exception {
|
||||
|
|
|
@ -77,7 +77,7 @@ public class ProbeServiceTest {
|
|||
|
||||
List<Probe> probes = this.probeService.readAllByDomain(domain);
|
||||
|
||||
Assert.assertNotEquals(probes.size(), 0);
|
||||
Assert.assertEquals(probes.size(), 1);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user