• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

GeoDienstenCentrum / schemaspy-maven-plugin / #11935

02 Nov 2024 03:27AM CUT coverage: 72.308%. Remained the same
#11935

push

github

web-flow
Merge 4ee4f5117 into 6152a071c

188 of 260 relevant lines covered (72.31%)

0.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/main/java/com/wakaleo/schemaspy/MavenSchemaAnalyzer.java
1
package com.wakaleo.schemaspy;
2

3
import org.schemaspy.LayoutFolder;
4
import org.schemaspy.SchemaAnalyzer;
5
import org.schemaspy.cli.CommandLineArgumentParser;
6
import org.schemaspy.cli.CommandLineArguments;
7
import org.schemaspy.input.dbms.service.DatabaseServiceFactory;
8
import org.schemaspy.input.dbms.service.SqlService;
9
import org.schemaspy.output.OutputProducer;
10
import org.schemaspy.output.xml.dom.XmlProducerUsingDOM;
11

12
import java.io.IOException;
13
import java.sql.SQLException;
14
import java.util.List;
15
import java.util.Objects;
16

17
/**
18
 * Wrapper around the {@link SchemaAnalyzer} to hide the initialization details from the {@link SchemaSpyReport}
19
 * maven mojo.
20
 */
21
public class MavenSchemaAnalyzer {
1✔
22
    private SchemaAnalyzer analyzer;
23

24
    private CommandLineArguments cliArgs;
25

26
    /**
27
     * Adds the schemaspy plugin configuration properties. This is necessary before calling {@link #analyze()}.
28
     * @param argList a list of property-value pairs.
29
     */
30
    public void applyConfiguration(List<String> argList) {
31
        String[] args = argList.toArray(new String[0]);
1✔
32
        CommandLineArgumentParser parser = new CommandLineArgumentParser(new CommandLineArguments(), null);
1✔
33
        cliArgs = parser.parse(args);
1✔
34
    }
1✔
35

36
    /**
37
     * Executes the schemaspy analyzer process.
38
     */
39
    public void analyze() throws SQLException, IOException {
40
        cliArgs = Objects.requireNonNull(cliArgs, "The field 'commandLineArguments' need to reference an instance. Call 'applyConfiguration(...) to initiate command line arguments");
1✔
41
        SqlService sqlService = new SqlService();
1✔
42
        DatabaseServiceFactory databaseServiceFactory = new DatabaseServiceFactory(sqlService);
1✔
43
        OutputProducer outputProducer = new XmlProducerUsingDOM();
1✔
44
        LayoutFolder layoutFolder = new LayoutFolder(SchemaAnalyzer.class.getClassLoader());
1✔
45
        analyzer = new SchemaAnalyzer(sqlService, databaseServiceFactory, cliArgs, outputProducer, layoutFolder);
1✔
46
        analyzer.analyze();
1✔
47
    }
1✔
48
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc