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

pkiraly / metadata-qa-marc / #1527

22 Aug 2025 02:21PM UTC coverage: 90.345%. Remained the same
#1527

push

pkiraly
Improve timeline handling

5191 of 6416 new or added lines in 219 files covered. (80.91%)

886 existing lines in 78 files now uncovered.

36717 of 40641 relevant lines covered (90.34%)

0.9 hits per line

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

93.33
/src/main/java/de/gwdg/metadataqa/marc/cli/parameters/MarcToSolrParameters.java
1
package de.gwdg.metadataqa.marc.cli.parameters;
2

3
import de.gwdg.metadataqa.marc.model.SolrFieldType;
4
import org.apache.commons.cli.ParseException;
5
import org.apache.solr.client.solrj.SolrClient;
6

7
public class MarcToSolrParameters extends CommonParameters {
8

9
  private int DEFAULT_COMMIT_AT = 10000;
1✔
10
  private boolean useEmbedded = false;
1✔
11
  private String solrUrl = null;
1✔
12
  private boolean doCommit = false;
1✔
13
  private SolrFieldType solrFieldType = SolrFieldType.MIXED;
1✔
14
  private SolrClient mainClient = null;
1✔
15
  private SolrClient validationClient = null;
1✔
16
  private boolean indexWithTokenizedField = false;
1✔
17

18
  private boolean isOptionSet = false;
1✔
19
  private int commitAt = DEFAULT_COMMIT_AT;
1✔
20
  private boolean indexFieldCounts = false;
1✔
21
  private boolean indexSubfieldCounts = false;
1✔
22
  private String fieldPrefix = null;
1✔
23

24
  @Override
25
  protected void setOptions() {
26
    if (!isOptionSet) {
1✔
27
      super.setOptions();
1✔
28
      options.addOption("S", "solrUrl", true, "the URL of Solr server including the core (e.g. http://localhost:8983/solr/loc)");
1✔
29
      options.addOption("A", "doCommit", false, "commits Solr index regularly");
1✔
30
      options.addOption("T", "solrFieldType", true,
1✔
31
        "type of Solr fields, could be one of 'marc-tags', 'human-readable', or 'mixed'");
32
      options.addOption("B", "useEmbedded", false, "use embedded Solr server (used in tests only)");
1✔
33
      options.addOption("C", "indexWithTokenizedField", false, "index data elements as tokenized field as well");
1✔
34
      options.addOption("D", "commitAt", true, "commit index after this number of records");
1✔
35
      options.addOption("E", "indexFieldCounts", false, "index the count of field instances");
1✔
36
      options.addOption("G", "indexSubfieldCounts", false, "index the count of subfield instances");
1✔
37
      options.addOption("F", "fieldPrefix", true, "field prefix");
1✔
38
      isOptionSet = true;
1✔
39
    }
40
  }
1✔
41

42
  public MarcToSolrParameters() {
43
    super();
1✔
44
  }
1✔
45

46
  public MarcToSolrParameters(String[] arguments) throws ParseException {
47
    super(arguments);
1✔
48

49
    if (cmd.hasOption("solrUrl"))
1✔
50
      solrUrl = cmd.getOptionValue("solrUrl");
1✔
51

52
    if (cmd.hasOption("doCommit"))
1✔
53
      doCommit = true;
1✔
54

55
    if (cmd.hasOption("solrFieldType"))
1✔
56
      solrFieldType = SolrFieldType.byCode(cmd.getOptionValue("solrFieldType"));
1✔
57

58
    if (cmd.hasOption("useEmbedded"))
1✔
59
      useEmbedded = true;
1✔
60

61
    if (cmd.hasOption("indexWithTokenizedField"))
1✔
UNCOV
62
      indexWithTokenizedField = true;
×
63

64
    if (cmd.hasOption("commitAt"))
1✔
UNCOV
65
      commitAt = Integer.valueOf(cmd.getOptionValue("commitAt"));
×
66

67
    if (cmd.hasOption("indexFieldCounts"))
1✔
68
      indexFieldCounts = true;
1✔
69

70
    if (cmd.hasOption("indexSubfieldCounts"))
1✔
NEW
71
      indexSubfieldCounts = true;
×
72

73
    if (cmd.hasOption("fieldPrefix"))
1✔
74
      fieldPrefix = cmd.getOptionValue("fieldPrefix");
1✔
75
  }
1✔
76

77
  public String getSolrUrl() {
78
    return solrUrl;
1✔
79
  }
80

81
  public boolean isDoCommit() {
82
    return doCommit;
1✔
83
  }
84

85
  public SolrFieldType getSolrFieldType() {
86
    return solrFieldType;
1✔
87
  }
88

89
  public SolrClient getMainClient() {
90
    return mainClient;
1✔
91
  }
92

93
  public void setMainClient(SolrClient mainClient) {
94
    this.mainClient = mainClient;
1✔
95
  }
1✔
96

97
  public SolrClient getValidationClient() {
98
    return validationClient;
1✔
99
  }
100

101
  public void setValidationClient(SolrClient validationClient) {
102
    this.validationClient = validationClient;
1✔
103
  }
1✔
104

105
  public boolean isUseEmbedded() {
106
    return useEmbedded;
1✔
107
  }
108

109
  public boolean isIndexWithTokenizedField() {
110
    return indexWithTokenizedField;
1✔
111
  }
112

113
  public int getCommitAt() {
114
    return commitAt;
1✔
115
  }
116

117
  public boolean isIndexFieldCounts() {
118
    return indexFieldCounts;
1✔
119
  }
120

121
  public boolean isIndexSubfieldCounts() {
122
    return indexSubfieldCounts;
1✔
123
  }
124

125
  public String getFieldPrefix() {
126
    return fieldPrefix != null ? fieldPrefix : "";
1✔
127
  }
128

129
  public void setFieldPrefix(String fieldPrefix) {
NEW
130
    this.fieldPrefix = fieldPrefix;
×
NEW
131
  }
×
132

133
  @Override
134
  public String formatParameters() {
135
    String text = super.formatParameters();
1✔
136
    text += String.format("solrUrl: %s%n", solrUrl);
1✔
137
    text += String.format("doCommit: %s%n", doCommit);
1✔
138
    text += String.format("solrFieldType: %s%n", solrFieldType);
1✔
139
    text += String.format("indexWithTokenizedField: %s%n", indexWithTokenizedField);
1✔
140
    text += String.format("commitAt: %s%n", commitAt);
1✔
141
    text += String.format("indexFieldCounts: %s%n", indexFieldCounts);
1✔
142
    text += String.format("indexSubfieldCounts: %s%n", indexSubfieldCounts);
1✔
143
    text += String.format("fieldPrefix: %s%n", fieldPrefix);
1✔
144
    return text;
1✔
145
  }
146

147
}
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

© 2026 Coveralls, Inc