|
@@ -1,6 +1,7 @@
|
|
|
package com.dragonsoft.dcuc.approve.business.impl;
|
|
|
|
|
|
import com.dragoninfo.dcuc.common.http.SkipSslVerificationHttpRequestFactory;
|
|
|
+import com.dragonsoft.dcuc.approve.business.external.impl.BimBusinessImpl;
|
|
|
import com.dragonsoft.dcuc.approve.model.resp.bim.ZeroTrustAppItemUserTokenInfoRespVO;
|
|
|
import com.dragonsoft.dcuc.approve.model.resp.bim.ZeroTrustAppTokenInfoRespVO;
|
|
|
import com.dragonsoft.dcuc.approve.model.resp.bim.ZeroTrustUserTokenInfoRespVO;
|
|
@@ -10,10 +11,10 @@ import com.dragonsoft.smtools.loader.SMFactory;
|
|
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.github.dreamhead.moco.HttpServer;
|
|
|
-import com.github.dreamhead.moco.junit.MocoJunitRunner;
|
|
|
+import com.github.dreamhead.moco.Runner;
|
|
|
+import org.junit.AfterClass;
|
|
|
import org.junit.Assert;
|
|
|
-import org.junit.Before;
|
|
|
-import org.junit.Rule;
|
|
|
+import org.junit.BeforeClass;
|
|
|
import org.junit.Test;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
@@ -32,20 +33,29 @@ import static com.github.dreamhead.moco.Moco.*;
|
|
|
*/
|
|
|
public class BimBusinessImplTest {
|
|
|
|
|
|
+//
|
|
|
+// public static void main(String[] args) {
|
|
|
+// try {
|
|
|
+// BimBusinessImplTest.before();
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
- HttpServer httpServer = httpServer(19000, log());
|
|
|
- @Rule
|
|
|
- public MocoJunitRunner mocoJunitRunner = MocoJunitRunner.httpRunner(httpServer);
|
|
|
+ public static Runner runner;
|
|
|
|
|
|
|
|
|
static String identityUrl = "http://127.0.0.1:19000";
|
|
|
- static String appInfoUrl = "/idp/rest/getAppTokenInfo";
|
|
|
+// static String appInfoUrl = "/idp/rest/getAppTokenInfo";
|
|
|
+ static String appInfoUrl = "/idp/rest/testGetAppTokenInfo";
|
|
|
+
|
|
|
static String userInfoUrl = "/idp/rest/getUserTokenInfo";
|
|
|
|
|
|
static BimBusinessImpl bimBusiness;
|
|
|
|
|
|
- @Before
|
|
|
- public void before() throws Exception {
|
|
|
+ @BeforeClass
|
|
|
+ public static void before() throws Exception {
|
|
|
+ HttpServer httpServer = httpServer(19000, log());
|
|
|
|
|
|
httpServer.request(by(uri(appInfoUrl)))
|
|
|
.response(pathResource("bim/getAppTokenInfo.json"));
|
|
@@ -54,6 +64,11 @@ public class BimBusinessImplTest {
|
|
|
httpServer.request(by(uri(userInfoUrl)))
|
|
|
.response(pathResource("bim/getUserTokenInfo.json"));
|
|
|
|
|
|
+
|
|
|
+ runner = Runner.runner(httpServer);
|
|
|
+
|
|
|
+ runner.start();
|
|
|
+
|
|
|
SkipSslVerificationHttpRequestFactory skipSslVerificationHttpRequestFactory
|
|
|
= new SkipSslVerificationHttpRequestFactory();
|
|
|
skipSslVerificationHttpRequestFactory.setReadTimeout(5000);
|
|
@@ -75,6 +90,10 @@ public class BimBusinessImplTest {
|
|
|
bimBusiness.setSmFactory(smFactory);
|
|
|
}
|
|
|
|
|
|
+ @AfterClass
|
|
|
+ public static void stop() {
|
|
|
+ runner.stop();
|
|
|
+ }
|
|
|
|
|
|
@Test
|
|
|
public void getUserTokenInfo() {
|