member noauthProbe method modify & add

This commit is contained in:
geek 2017-08-11 16:27:50 +09:00
parent e95e2f4cc4
commit 54927e47d3
3 changed files with 42 additions and 0 deletions

View File

@ -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);
}

View File

@ -32,4 +32,8 @@ public class NoAuthProbeService {
return this.noAuthProbeDAO.findOne(id);
}
public List<NoAuthProbe> registForNoAuthProbes(List<NoAuthProbe> noAuthProbes) {
return this.noAuthProbeDAO.save(noAuthProbes);
}
}

View File

@ -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 {