From 1bb33e4e159656b816ac21291feed069cdb275cd Mon Sep 17 00:00:00 2001 From: huangsimin Date: Thu, 12 Dec 2019 18:33:33 +0800 Subject: [PATCH] init --- .factorypath | 8 + .gitattributes | 2 + .gitignore | 28 + .travis.yml | 4 + pom.xml | 121 +++++ src/main/java/com/yame/App.java | 13 + src/main/java/com/yame/Graph.java | 12 + src/main/resources/log4j.properties | 22 + src/test/java/com/yame/1.xml | 755 ++++++++++++++++++++++++++ src/test/java/com/yame/AppTest.java | 22 + src/test/java/com/yame/GraphTest.java | 47 ++ src/test/resources/log4j.properties | 22 + 12 files changed, 1056 insertions(+) create mode 100644 .factorypath create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 pom.xml create mode 100644 src/main/java/com/yame/App.java create mode 100644 src/main/java/com/yame/Graph.java create mode 100644 src/main/resources/log4j.properties create mode 100644 src/test/java/com/yame/1.xml create mode 100644 src/test/java/com/yame/AppTest.java create mode 100644 src/test/java/com/yame/GraphTest.java create mode 100644 src/test/resources/log4j.properties diff --git a/.factorypath b/.factorypath new file mode 100644 index 0000000..63442ab --- /dev/null +++ b/.factorypath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8dfa1eb --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# When shell scripts end in CRLF, bash gives a cryptic error message +*.sh text eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..00a9984 --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +# +# Standard Maven .gitignore +# +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +*.log + +# +# IntelliJ +# +*.iml +.idea/* +!.idea/runConfigurations/ + +# +# Visual Studio Code +# +.settings/ +.classpath +.project +.vscode/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..425ddca --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: java +jdk: oraclejdk8 +after_success: +- mvn coveralls:report diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7aae736 --- /dev/null +++ b/pom.xml @@ -0,0 +1,121 @@ + + + + 4.0.0 + + com.yame + mxgraph + 1.0-SNAPSHOT + + mxgraph + + http://www.example.com + + + UTF-8 + UTF-8 + + UTF-8 + UTF-8 + 1.11 + 11 + 11 + + + + + + + + org.apache.logging.log4j + log4j-core + 2.12.1 + + + + + org.apache.logging.log4j + log4j-api + 2.12.1 + + + + + org.slf4j + slf4j-log4j12 + 1.7.29 + + + + org.slf4j + slf4j-api + 1.7.29 + + + + com.github.vlsi.mxgraph + jgraphx + 4.0.5 + + + + + + + junit + junit + 4.12 + test + + + + + + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.1 + + 11 + + + + maven-surefire-plugin + 2.22.1 + + + maven-jar-plugin + 3.0.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + maven-site-plugin + 3.7.1 + + + maven-project-info-reports-plugin + 3.0.0 + + + + + diff --git a/src/main/java/com/yame/App.java b/src/main/java/com/yame/App.java new file mode 100644 index 0000000..2f85959 --- /dev/null +++ b/src/main/java/com/yame/App.java @@ -0,0 +1,13 @@ +package com.yame; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/src/main/java/com/yame/Graph.java b/src/main/java/com/yame/Graph.java new file mode 100644 index 0000000..7fa3430 --- /dev/null +++ b/src/main/java/com/yame/Graph.java @@ -0,0 +1,12 @@ +package com.yame; + + +/** + * Graph + */ +public class Graph { + + public void load() { + + } +} \ No newline at end of file diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties new file mode 100644 index 0000000..10ffffb --- /dev/null +++ b/src/main/resources/log4j.properties @@ -0,0 +1,22 @@ +log4j.rootLogger=debug, stdout, file + +# Redirect log messages to console +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n + +log4j.appender.file=org.apache.log4j.FileAppender +log4j.appender.file.File=./out.log +log4j.appender.file.layout=org.apache.log4j.SimpleLayout +# +# log4j.appender.C=org.apache.log4j.RollingFileAppender +# log4j.appender.C.File=E:\\log.html +# log4j.appender.C.MaxFileSize=1000KB +# log4j.appender.C.MaxBackupIndex=10 +# log4j.appender.C.layout=org.apache.log4j.HTMLLayout +# log4j.appender.C.encoding=gbk +# +# log4j.appender.D=org.apache.log4j.DailyRollingFileAppender +# log4j.appender.D.File=E:\\log.log +# log4j.appender.D.layout=org.apache.log4j.TTCCLayout */ \ No newline at end of file diff --git a/src/test/java/com/yame/1.xml b/src/test/java/com/yame/1.xml new file mode 100644 index 0000000..f0519dd --- /dev/null +++ b/src/test/java/com/yame/1.xml @@ -0,0 +1,755 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/java/com/yame/AppTest.java b/src/test/java/com/yame/AppTest.java new file mode 100644 index 0000000..b758e16 --- /dev/null +++ b/src/test/java/com/yame/AppTest.java @@ -0,0 +1,22 @@ +package com.yame; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +/** + * Unit test for simple App. + */ +public class AppTest +{ + + public static String testPath = "src/test/java/com/yame/"; + /** + * Rigorous Test :-) + */ + @Test + public void shouldAnswerWithTrue() + { + assertTrue( true ); + } +} diff --git a/src/test/java/com/yame/GraphTest.java b/src/test/java/com/yame/GraphTest.java new file mode 100644 index 0000000..5b81bf3 --- /dev/null +++ b/src/test/java/com/yame/GraphTest.java @@ -0,0 +1,47 @@ +package com.yame; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +import com.mxgraph.io.mxCodec; +import com.mxgraph.util.mxXmlUtils; +import com.mxgraph.view.mxGraph; + +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.log4j.*; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +/** + * GraphTest + */ + +public class GraphTest { + + private final Logger log = LoggerFactory.getLogger(GraphTest.class.getName()); + + @Test + public void TestCase1() { + mxGraph graph = new mxGraph(); + Path path = Paths.get(AppTest.testPath + "1.xml"); + try { + String xmlString = Files.readString( path ); + Document doc = mxXmlUtils.parseXml(xmlString); + mxCodec code = new mxCodec(doc); + Object a = code.decode(doc.getParentNode()); + log.debug(a.toString()); + // log.debug(mxXmlUtils.getXml( a)); + } catch (Exception e) { + // e.printStackTrace(); + log.error("Case1", e); + } + + + } +} \ No newline at end of file diff --git a/src/test/resources/log4j.properties b/src/test/resources/log4j.properties new file mode 100644 index 0000000..10ffffb --- /dev/null +++ b/src/test/resources/log4j.properties @@ -0,0 +1,22 @@ +log4j.rootLogger=debug, stdout, file + +# Redirect log messages to console +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n + +log4j.appender.file=org.apache.log4j.FileAppender +log4j.appender.file.File=./out.log +log4j.appender.file.layout=org.apache.log4j.SimpleLayout +# +# log4j.appender.C=org.apache.log4j.RollingFileAppender +# log4j.appender.C.File=E:\\log.html +# log4j.appender.C.MaxFileSize=1000KB +# log4j.appender.C.MaxBackupIndex=10 +# log4j.appender.C.layout=org.apache.log4j.HTMLLayout +# log4j.appender.C.encoding=gbk +# +# log4j.appender.D=org.apache.log4j.DailyRollingFileAppender +# log4j.appender.D.File=E:\\log.log +# log4j.appender.D.layout=org.apache.log4j.TTCCLayout */ \ No newline at end of file