Commit 3235203d by Future

证书文件存储单测类调整

parent e82187d9
...@@ -12,6 +12,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -12,6 +12,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
/** /**
...@@ -33,14 +37,35 @@ public class SaveApnsTest { ...@@ -33,14 +37,35 @@ public class SaveApnsTest {
String pwd = "123456"; String pwd = "123456";
InputStream certificate = IosPush.getApnsCertificate(apnsCertificatePath); // InputStream certificate = IosPush.getApnsCertificate(apnsCertificatePath);
String encode = Base64.encode(certificate); // String encode = Base64.encode(certificate);
File file = new File("C:\\wenzhd\\res\\ios\\ChatSdk_ios.p12");
String base64 = null;
FileInputStream fin = null;
try {
fin = new FileInputStream(file);
byte[] buff = new byte[fin.available()];
fin.read(buff);
base64 = Base64.encode(buff);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (fin != null) {
try {
fin.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
ImIosApns imIosApns = new ImIosApns(); ImIosApns imIosApns = new ImIosApns();
imIosApns.setId(SnowflakeUtil.getId()); imIosApns.setId(SnowflakeUtil.getId());
imIosApns.setFkAppId(0L); imIosApns.setFkAppId(1L);
imIosApns.setApnsFileValue(encode); imIosApns.setApnsFileValue(base64);
imIosApns.setEnv(1); imIosApns.setEnv(1);
imIosApns.setBundleId(topicBundleId); imIosApns.setBundleId(topicBundleId);
imIosApns.setPwd(pwd); imIosApns.setPwd(pwd);
......
...@@ -51,7 +51,7 @@ public class ImIosApnsServiceImpl extends BaseServiceImpl<ImIosApnsMapper, ImIos ...@@ -51,7 +51,7 @@ public class ImIosApnsServiceImpl extends BaseServiceImpl<ImIosApnsMapper, ImIos
} }
@Override @Override
@Cacheable(key = "#p0") // @Cacheable(key = "#p0")
public ImIosApns getImIosApnsByAppId(Long appId) { public ImIosApns getImIosApnsByAppId(Long appId) {
return this.getOne(new QueryWrapper<ImIosApns>().lambda().eq( return this.getOne(new QueryWrapper<ImIosApns>().lambda().eq(
ImIosApns::getFkAppId, appId ImIosApns::getFkAppId, appId
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment