Skip to content

Commit 780e75b

Browse files
committed
add test case management
1 parent d4b4def commit 780e75b

File tree

109 files changed

+18376
-380
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+18376
-380
lines changed

components/fluent-builtin/pom.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@
4141
<version>2.21.0</version>
4242
<scope>test</scope>
4343
</dependency>
44-
44+
<dependency>
45+
<groupId>jakarta.xml.bind</groupId>
46+
<artifactId>jakarta.xml.bind-api</artifactId>
47+
<version>4.0.0</version>
48+
</dependency>
4549

4650
<!-- <dependency>-->
4751
<!-- <groupId>org.eclipse.collections</groupId>-->
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package io.fluent.builtin;
2+
3+
import cn.hutool.core.util.XmlUtil;
4+
import jakarta.xml.bind.JAXBContext;
5+
import jakarta.xml.bind.Unmarshaller;
6+
import lombok.extern.slf4j.Slf4j;
7+
import org.w3c.dom.Document;
8+
9+
import javax.xml.xpath.XPathConstants;
10+
import java.io.BufferedInputStream;
11+
import java.io.FileInputStream;
12+
13+
@Slf4j
14+
public class XmlUtils extends XmlUtil {
15+
16+
public static Document getDocument(String xmlFilePath) {
17+
return XmlUtil.readXML(xmlFilePath);
18+
}
19+
20+
public static Object getValueByXpath(String xmlFilePath,
21+
String xpathExpr) {
22+
Document doc = getDocument(xmlFilePath);
23+
return XmlUtil.getByXPath(xpathExpr, doc, XPathConstants.STRING);
24+
}
25+
26+
public static Object getValueByXpath(Document doc,
27+
String xpathExpr) {
28+
return XmlUtil.getByXPath(xpathExpr, doc, XPathConstants.STRING);
29+
}
30+
31+
/**
32+
* JAXB Read Xml file
33+
*
34+
* @param xmlFilePath
35+
* @param clazz
36+
* @return
37+
*/
38+
public static <T> T readXmlToObject(String xmlFilePath, Class<T> clazz) {
39+
40+
try {
41+
JAXBContext context = JAXBContext.newInstance(clazz);
42+
Unmarshaller unmarshaller = context.createUnmarshaller();
43+
return (T) unmarshaller.unmarshal(new BufferedInputStream(new FileInputStream(xmlFilePath)));
44+
} catch (Exception e) {
45+
log.error("parse xml failed,", e);
46+
throw new RuntimeException(e);
47+
}
48+
}
49+
50+
public static <T> T readXmlToObject(Document doc, Class<T> clazz) {
51+
52+
try {
53+
JAXBContext context = JAXBContext.newInstance(clazz);
54+
Unmarshaller unmarshaller = context.createUnmarshaller();
55+
return (T) unmarshaller.unmarshal(doc);
56+
} catch (Exception e) {
57+
log.error("parse xml failed,", e);
58+
throw new RuntimeException(e);
59+
}
60+
}
61+
}

components/fluent-ext/.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
target/
2+
!.mvn/wrapper/maven-wrapper.jar
3+
!**/src/main/**/target/
4+
!**/src/test/**/target/
5+
6+
### IntelliJ IDEA ###
7+
.idea/modules.xml
8+
.idea/jarRepositories.xml
9+
.idea/compiler.xml
10+
.idea/libraries/
11+
*.iws
12+
*.iml
13+
*.ipr
14+
15+
### Eclipse ###
16+
.apt_generated
17+
.classpath
18+
.factorypath
19+
.project
20+
.settings
21+
.springBeans
22+
.sts4-cache
23+
24+
### NetBeans ###
25+
/nbproject/private/
26+
/nbbuild/
27+
/dist/
28+
/nbdist/
29+
/.nb-gradle/
30+
build/
31+
!**/src/main/**/build/
32+
!**/src/test/**/build/
33+
34+
### VS Code ###
35+
.vscode/
36+
37+
### Mac OS ###
38+
.DS_Store

0 commit comments

Comments
 (0)