Browse Source

DEC-15861 feat: Fr/Bi融合与独立部署V1

remotes/1611766341912730171/master
zed 4 years ago
parent
commit
a7632f3931
  1. 12
      src/main/java/com/fanruan/api/decision/CommonKit.java
  2. 13
      src/test/java/com/fanruan/api/decision/CommonKitTest.java

12
src/main/java/com/fanruan/api/decision/CommonKit.java

@ -5,8 +5,10 @@ import com.fanruan.api.util.StringKit;
import com.fr.base.Base64;
import com.fr.base.ServerConfig;
import com.fr.decision.webservice.utils.DecisionServiceConstants;
import com.fr.decision.webservice.utils.WebServiceUtils;
import com.fr.stable.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.awt.Image;
/**
* @author richie
@ -63,4 +65,14 @@ public class CommonKit {
public static String encode(Image im, String format) {
return Base64.encode(im, format);
}
/**
* 是否是ajax请求
*
* @param request http请求
* @return 是否是ajax请求
*/
public static boolean ajaxRequest(HttpServletRequest request) {
return WebServiceUtils.ajaxRequest(request);
}
}

13
src/test/java/com/fanruan/api/decision/CommonKitTest.java

@ -10,9 +10,11 @@ import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.awt.Image;
import javax.servlet.http.HttpServletRequest;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
/**
* @author Lucian.Chen
@ -56,4 +58,13 @@ public class CommonKitTest {
String result = Base64.encode(im, "");
Assert.assertEquals(result, CommonKit.encode(im, ""));
}
@Test
public void ajaxRequest() throws Exception {
Class<?> classBook = Class.forName("com.fanruan.api.decision.CommonKit");
Assert.assertNotNull(classBook);
Method method1 = classBook.getDeclaredMethod("ajaxRequest", HttpServletRequest.class);
Assert.assertNotNull(method1);
}
}

Loading…
Cancel
Save