PageRenderTime 50ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/gmonitor/gmonitor-common/src/test/java/com/zdingke/gmonitor/common/test/TestStringFileTransUtil.java

https://gitlab.com/zhengdingke/gmonitor
Java | 31 lines | 22 code | 9 blank | 0 comment | 0 complexity | 2ccc191fff978ede5dabe7c008defc18 MD5 | raw file
  1. package com.zdingke.gmonitor.common.test;
  2. import java.io.File;
  3. import org.junit.Test;
  4. import com.alibaba.fastjson.JSON;
  5. import com.zdingke.gmonitor.common.StringFileTransUtil;
  6. public class TestStringFileTransUtil {
  7. @Test
  8. public void file2String() {
  9. String x = StringFileTransUtil.file2String(new File(TestStringFileTransUtil.class.getResource("/").getFile().toString() + "nimbus.json"), "GBK");
  10. System.out.println(JSON.toJSON(x));
  11. }
  12. @Test
  13. public void string2File() {
  14. String x = StringFileTransUtil.file2String(new File(TestStringFileTransUtil.class.getResource("/").getFile().toString() + "nimbus.json"), "GBK");
  15. StringFileTransUtil.string2File(x, new File(TestStringFileTransUtil.class.getResource("/").getFile().toString() + "nimbus1.json"));
  16. }
  17. @Test
  18. public void testGetStringFromMetric() {
  19. String comstr = StringFileTransUtil.getComponentInfo("tomcat", "E:/eclipse/eclipse_pro/kingee_pro/bigdata/ganglia-metric/src/test/resources/test");
  20. System.out.println("comstr:" + comstr);
  21. }
  22. }