Adding test

This commit is contained in:
Luca Frosini 2023-01-19 11:52:27 +01:00
parent 7a8725b270
commit 6c5838e810
4 changed files with 51 additions and 4 deletions

View File

@ -187,7 +187,7 @@ public class DocumentationGenerator {
return row;
}
public StringBuffer generatePropertySection(Type type) {
protected StringBuffer generatePropertySection(Type type) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("\n");
String name = type.getName();
@ -206,7 +206,7 @@ public class DocumentationGenerator {
return stringBuffer;
}
public StringBuffer generateResourceSection(Type type) {
protected StringBuffer generateResourceSection(Type type) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("\n");
String name = type.getName();
@ -225,7 +225,7 @@ public class DocumentationGenerator {
return stringBuffer;
}
public StringBuffer generateFacetSection(Type type) {
protected StringBuffer generateFacetSection(Type type) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("\n");
String name = type.getName();
@ -282,7 +282,12 @@ public class DocumentationGenerator {
return stringBuffer;
}
public void generate(List<Package> pkgs) throws Exception {
public void generate() throws Exception {
List<Package> pkgs = Discovery.discoverPackages();
generate(pkgs);
}
protected void generate(List<Package> pkgs) throws Exception {
DocumentationSchemaAction schemaAction = new DocumentationSchemaAction(pkgs);
Discovery.discover(schemaAction);

View File

@ -1,5 +1,8 @@
package org.gcube.informationsystem.utils.documentation.rst.table;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public enum RowType {
HEADING(Table.ROW_SEPARATOR_HEADING),
NORMAL(Table.ROW_SEPARATOR);

View File

@ -0,0 +1,20 @@
package org.gcube.informationsystem.utils.documentation;
import java.io.File;
import java.net.URL;
import org.junit.Test;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public class GenerateTest {
@Test
public void testDocGeneration() throws Exception {
URL jsonFileURL = GenerateTest.class.getClassLoader().getResource("logback-test.xml");
File file = new File(jsonFileURL.toURI());
DocumentationGenerator documentationGenerator = new DocumentationGenerator(file.getParentFile());
documentationGenerator.generate();
}
}

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n</pattern>
</encoder>
</appender>
<logger name="org.gcube" level="ERROR" />
<logger name="org.gcube.informationsystem.utils.documentation" level="INFO" />
<root level="WARN">
<appender-ref ref="STDOUT" />
</root>
</configuration>