Browse Source

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

Merge in TC/finekit from ~ZED/finekit:master to master

* commit 'afef877673596122b93e8ee3d2775e1408302600':
  fix
  DEC-15861 feat: Fr/Bi融合与独立部署V1
master
zed 4 years ago
parent
commit
4793f9c62f
  1. 12
      src/main/java/com/fanruan/api/decision/CommonKit.java
  2. 11
      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);
}
}

11
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 javax.servlet.http.HttpServletRequest;
import java.awt.Image;
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