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

kit-data-manager / pit-service / #157

pending completion
#157

Pull #125

github-actions

web-flow
Merge 4f575b7a7 into 7470716c4
Pull Request #125: 114 Unclear/non-standard response for post api/v1/pit/pid

124 of 124 new or added lines in 11 files covered. (100.0%)

758 of 1377 relevant lines covered (55.05%)

0.55 hits per line

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

59.09
/src/main/java/edu/kit/datamanager/pit/configuration/ApplicationProperties.java
1
/*
2
 * Copyright 2018 Karlsruhe Institute of Technology.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package edu.kit.datamanager.pit.configuration;
17

18
import edu.kit.datamanager.configuration.GenericApplicationProperties;
19
import edu.kit.datamanager.pit.pitservice.IValidationStrategy;
20
import edu.kit.datamanager.pit.pitservice.impl.EmbeddedStrictValidatorStrategy;
21
import edu.kit.datamanager.pit.pitservice.impl.NoValidationStrategy;
22

23
import java.net.URL;
24

25
import javax.validation.constraints.NotNull;
26

27
import org.springframework.beans.factory.annotation.Value;
28
import org.springframework.context.annotation.Bean;
29
import org.springframework.context.annotation.Configuration;
30
import org.springframework.validation.annotation.Validated;
31

32
/**
33
 * The main properties a user can give to this service using a
34
 * application.properties file.
35
 * 
36
 * Depending on the configuration, further configuration classes might be
37
 * loaded,
38
 * to give the user mode operions.
39
 * 
40
 * Example: If "pit.pidsystem.implementation" is "HANDLE_PROTOCOL" is set,
41
 * `HandleProtocolProperties` will be active.
42
 * 
43
 * @author Andreas Pfeil
44
 */
45
@Configuration
46
@Validated
47
public class ApplicationProperties extends GenericApplicationProperties {
1✔
48

49
  public enum IdentifierSystemImpl {
1✔
50
    IN_MEMORY,
1✔
51
    LOCAL,
1✔
52
    HANDLE_REST,
1✔
53
    HANDLE_PROTOCOL;
1✔
54
  }
55

56
  @Value("${pit.pidsystem.implementation}")
57
  @NotNull
58
  private IdentifierSystemImpl identifierSystemImplementation;
59

60
  public enum ValidationStrategy {
1✔
61
    EMBEDDED_STRICT,
1✔
62
    NONE_DEBUG;
1✔
63
  }
64

65
  @Value("${pit.validation.strategy:embedded-strict}")
1✔
66
  @NotNull
67
  private ValidationStrategy validationStrategy = ValidationStrategy.EMBEDDED_STRICT;
68

69
  @Bean
70
  public IValidationStrategy defaultValidationStrategy() {
71
    IValidationStrategy defaultStrategy = new NoValidationStrategy();
1✔
72
    if (this.validationStrategy == ValidationStrategy.EMBEDDED_STRICT) {
1✔
73
      defaultStrategy = new EmbeddedStrictValidatorStrategy();
1✔
74
    }
75
    return defaultStrategy;
1✔
76
  }
77

78
  public enum StorageStrategy {
1✔
79
    // Only store PIDs which have been created or modified using this instance
80
    KEEP_MODIFIED,
1✔
81
    // Store created, modified or resolved PIDs.
82
    KEEP_RESOLVED_AND_MODIFIED;
1✔
83

84
    public boolean storesModified() {
85
      return this == StorageStrategy.KEEP_MODIFIED
1✔
86
          || this == StorageStrategy.KEEP_RESOLVED_AND_MODIFIED;
87
    }
88

89
    public boolean storesResolved() {
90
      return this == StorageStrategy.KEEP_RESOLVED_AND_MODIFIED;
1✔
91
    }
92
  }
93

94
  @Value("${pit.storage.strategy:keep-modified}")
1✔
95
  @NotNull
96
  private StorageStrategy storageStrategy = StorageStrategy.KEEP_MODIFIED;
97

98
  // TODO Used by DTR implementation for resolving. Too unflexible in mid-term.
99
  @Value("${pit.pidsystem.handle.baseURI}")
100
  private URL handleBaseUri;
101

102
  @Value("${pit.typeregistry.baseURI}")
103
  private URL typeRegistryUri;
104

105
  @Value("${pit.typeregistry.cache.maxEntries:1000}")
106
  private int maximumSize;
107

108
  @Value("${pit.typeregistry.cache.lifetimeMinutes:10}")
109
  private long expireAfterWrite;
110

111
  @Value("${pit.validation.profileKey:21.T11148/076759916209e5d62bd5}")
112
  private String profileKey;
113

114
  public IdentifierSystemImpl getIdentifierSystemImplementation() {
115
    return this.identifierSystemImplementation;
1✔
116
  }
117

118
  public void setIdentifierSystemImplementation(IdentifierSystemImpl identifierSystemImplementation) {
119
    this.identifierSystemImplementation = identifierSystemImplementation;
×
120
  }
×
121

122
  public URL getHandleBaseUri() {
123
    return this.handleBaseUri;
1✔
124
  }
125

126
  public void setHandleBaseUri(URL handleBaseUri) {
127
    this.handleBaseUri = handleBaseUri;
×
128
  }
×
129

130
  public URL getTypeRegistryUri() {
131
    return this.typeRegistryUri;
×
132
  }
133

134
  public void setTypeRegistryUri(URL typeRegistryUri) {
135
    this.typeRegistryUri = typeRegistryUri;
×
136
  }
×
137

138
  public String getProfileKey() {
139
    return this.profileKey;
1✔
140
  }
141

142
  public void setProfileKey(String profileKey) {
143
    this.profileKey = profileKey;
×
144
  }
×
145

146
  public ValidationStrategy getValidationStrategy() {
147
    return this.validationStrategy;
×
148
  }
149

150
  public void setValidationStrategy(ValidationStrategy strategy) {
151
    this.validationStrategy = strategy;
×
152
  }
×
153

154
  public int getMaximumSize() {
155
    return maximumSize;
1✔
156
  }
157

158
  public void setMaximumSize(int maximumSize) {
159
    this.maximumSize = maximumSize;
×
160
  }
×
161

162
  public long getExpireAfterWrite() {
163
    return expireAfterWrite;
1✔
164
  }
165

166
  public void setExpireAfterWrite(long expireAfterWrite) {
167
    this.expireAfterWrite = expireAfterWrite;
×
168
  }
×
169

170
  public StorageStrategy getStorageStrategy() {
171
    return storageStrategy;
1✔
172
  }
173

174
  public void setStorageStrategy(StorageStrategy storageStrategy) {
175
    this.storageStrategy = storageStrategy;
×
176
  }
×
177
}
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