Skip to content

Commit

Permalink
chore: extract identifiers, globalconf generated code out of common-u…
Browse files Browse the repository at this point in the history
…til (#1968)

* chore: extract identifiers, globalconf generated code out of common-util

* chore: split remaining code into separate modules.

* chore: backmerge version changes from develop

* chore: fix passwordstore compile script

* chore: fix passwordstore package

* chore: checkstyle fixes

* chore: passwordstore test fixes

* chore: passwordstore test fixes
  • Loading branch information
ricardas-buc authored Feb 22, 2024
1 parent 665ebe0 commit 1244414
Show file tree
Hide file tree
Showing 497 changed files with 2,226 additions and 3,507 deletions.
18 changes: 17 additions & 1 deletion .ort.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,23 @@ excludes:
reason: "TEST_OF"
comment: "This directory contains tests."

- pattern: "src/common/common-util/src/test/**"
- pattern: "src/common/common-core/src/test/**"
reason: "TEST_OF"
comment: "This directory contains tests."

- pattern: "src/common/common-jetty/src/test/**"
reason: "TEST_OF"
comment: "This directory contains tests."

- pattern: "src/common/common-globalconf/src/test/**"
reason: "TEST_OF"
comment: "This directory contains tests."

- pattern: "src/common/common-message/src/test/**"
reason: "TEST_OF"
comment: "This directory contains tests."

- pattern: "src/common/common-scheduler/src/test/**"
reason: "TEST_OF"
comment: "This directory contains tests."

Expand Down
4 changes: 2 additions & 2 deletions ansible/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ For fast development, you can compile and update modules separately using the an
ansible-playbook -i hosts/example_xroad_hosts.txt xroad_dev_partial.yml -e selected_modules=proxy-ui-api
```

It is also possible to compile and update several modules (JARs or WARs). The following command compiles and updates JAR-files for modules `common-util`, `signer` and `proxy-ui-api` to the defined existing server installations.
It is also possible to compile and update several modules (JARs or WARs). The following command compiles and updates JAR-files for modules `signer` and `proxy-ui-api` to the defined existing server installations.

```
ansible-playbook -i hosts/example_xroad_hosts.txt xroad_dev_partial.yml -e selected_modules=common-util,proxy-ui-api,signer
ansible-playbook -i hosts/example_xroad_hosts.txt xroad_dev_partial.yml -e selected_modules=proxy-ui-api,signer
```

This updates the **selected modules (JARs or WARs)** to ones compiled locally.
Expand Down
5 changes: 0 additions & 5 deletions ansible/vars_files/common_modules.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
---
common_modules:
common-util:
dir: common/common-util
build: build
lib: common-util-1.0.jar
target: /usr/share/xroad/jlib
signer:
dir: signer
build: build
Expand Down
8 changes: 0 additions & 8 deletions ansible/xroad_modules.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
---
modules:
common-util:
dir: common-util
build: build
lib: common-util-1.0.jar
target: /usr/share/xroad/jlib
hosts:
- cp_servers
- cs_servers
signer:
dir: signer
build: build
Expand Down
531 changes: 265 additions & 266 deletions src/3RD-PARTY-NOTICES.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/addons/hwtoken/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dependencies {
exclude group: 'org.springframework', module: 'spring-context'
}
implementation(project(':signer-protocol'))
implementation(project(':common:common-util'))
implementation(project(':common:common-domain'))

// Necessary since there are jars with no adequate Maven dependencies
implementation fileTree(dir: '../../libs', include: '*.jar')
Expand Down
4 changes: 3 additions & 1 deletion src/addons/messagelog/messagelog-addon/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
dependencies {
implementation(project(':proxy'))
implementation(project(':common:common-util'))
implementation(project(':common:common-jetty'))
implementation(project(':common:common-globalconf'))
implementation(project(':common:common-scheduler'))
implementation(project(':serverconf'))
implementation(project(':common:common-messagelog'))
implementation(project(':common:common-op-monitoring'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@

import static ee.ria.xroad.common.ErrorCodes.X_INTERNAL_ERROR;
import static ee.ria.xroad.common.conf.globalconf.ConfigurationDirectory.METADATA_SUFFIX;
import static ee.ria.xroad.common.metadata.MetadataRequests.ASIC;
import static ee.ria.xroad.common.metadata.MetadataRequests.VERIFICATIONCONF;
import static ee.ria.xroad.common.util.JettyUtils.setContentType;
import static ee.ria.xroad.proxy.clientproxy.AbstractClientProxyHandler.getIsAuthenticationData;
import static ee.ria.xroad.proxy.util.MetadataRequests.ASIC;
import static ee.ria.xroad.proxy.util.MetadataRequests.VERIFICATIONCONF;
import static org.eclipse.jetty.http.HttpStatus.BAD_REQUEST_400;
import static org.eclipse.jetty.http.HttpStatus.INTERNAL_SERVER_ERROR_500;
import static org.eclipse.jetty.http.HttpStatus.NOT_FOUND_404;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

dependencies {
implementation project(':common:common-util')
implementation project(':common:common-core')
}

ext {
Expand Down
2 changes: 1 addition & 1 deletion src/addons/messagelog/messagelog-archiver/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

dependencies {

implementation(project(':common:common-util'))
implementation(project(':common:common-scheduler'))
implementation(project(':common:common-db'))
implementation(project(':common:common-messagelog'))
implementation(project(':addons:messagelog:messagelog-db'))
Expand Down
2 changes: 1 addition & 1 deletion src/addons/metaservice/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies {
implementation project(':proxy')
implementation project(':common:common-util')
implementation project(':common:common-jetty')
implementation project(':serverconf')
implementation project(":common:common-op-monitoring")
implementation project(":common:common-verifier")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
import java.util.Arrays;
import java.util.Enumeration;

import static ee.ria.xroad.common.metadata.MetadataRequests.LIST_CLIENTS;
import static ee.ria.xroad.common.util.JettyUtils.setContentType;
import static ee.ria.xroad.proxy.util.MetadataRequests.LIST_CLIENTS;
import static org.eclipse.jetty.io.Content.Sink.asOutputStream;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@
import static ee.ria.xroad.common.ErrorCodes.X_INVALID_REQUEST;
import static ee.ria.xroad.common.ErrorCodes.X_INVALID_SERVICE_TYPE;
import static ee.ria.xroad.common.ErrorCodes.X_UNKNOWN_SERVICE;
import static ee.ria.xroad.common.metadata.MetadataRequests.ALLOWED_METHODS;
import static ee.ria.xroad.common.metadata.MetadataRequests.GET_WSDL;
import static ee.ria.xroad.common.metadata.MetadataRequests.LIST_METHODS;
import static ee.ria.xroad.proxy.util.MetadataRequests.ALLOWED_METHODS;
import static ee.ria.xroad.proxy.util.MetadataRequests.GET_WSDL;
import static ee.ria.xroad.proxy.util.MetadataRequests.LIST_METHODS;

@Slf4j
class MetadataServiceHandlerImpl implements ServiceHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
import ee.ria.xroad.common.util.CachingStream;
import ee.ria.xroad.common.util.MimeTypes;
import ee.ria.xroad.common.util.MimeUtils;
import ee.ria.xroad.common.util.OpenapiDescriptionFiletype;
import ee.ria.xroad.proxy.protocol.ProxyMessage;
import ee.ria.xroad.proxy.protocol.ProxyMessageDecoder;
import ee.ria.xroad.proxy.protocol.ProxyMessageEncoder;
import ee.ria.xroad.proxy.util.OpenapiDescriptionFiletype;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down Expand Up @@ -68,10 +68,10 @@

import static ee.ria.xroad.common.ErrorCodes.X_INTERNAL_ERROR;
import static ee.ria.xroad.common.ErrorCodes.X_INVALID_REQUEST;
import static ee.ria.xroad.common.metadata.MetadataRequests.ALLOWED_METHODS;
import static ee.ria.xroad.common.metadata.MetadataRequests.GET_OPENAPI;
import static ee.ria.xroad.common.metadata.MetadataRequests.LIST_METHODS;
import static ee.ria.xroad.common.util.MimeUtils.HEADER_REQUEST_ID;
import static ee.ria.xroad.proxy.util.MetadataRequests.ALLOWED_METHODS;
import static ee.ria.xroad.proxy.util.MetadataRequests.GET_OPENAPI;
import static ee.ria.xroad.proxy.util.MetadataRequests.LIST_METHODS;

/**
* Handler for REST metadata services
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
import java.util.List;
import java.util.stream.Collectors;

import static ee.ria.xroad.common.metadata.MetadataRequests.LIST_CLIENTS;
import static ee.ria.xroad.proxy.util.MetadataRequests.LIST_CLIENTS;
import static ee.ria.xroad.proxy.util.MetaserviceTestUtil.xmlUtf8ContentTypes;
import static org.hamcrest.Matchers.arrayContaining;
import static org.hamcrest.Matchers.containsInAnyOrder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@
import static ee.ria.xroad.common.ErrorCodes.X_INVALID_SERVICE_TYPE;
import static ee.ria.xroad.common.ErrorCodes.X_UNKNOWN_SERVICE;
import static ee.ria.xroad.common.conf.serverconf.ServerConfDatabaseCtx.doInTransaction;
import static ee.ria.xroad.common.metadata.MetadataRequests.ALLOWED_METHODS;
import static ee.ria.xroad.common.metadata.MetadataRequests.GET_WSDL;
import static ee.ria.xroad.common.metadata.MetadataRequests.LIST_METHODS;
import static ee.ria.xroad.common.util.MimeTypes.TEXT_XML_UTF8;
import static ee.ria.xroad.common.util.MimeUtils.HEADER_CONTENT_TYPE;
import static ee.ria.xroad.proxy.util.MetadataRequests.ALLOWED_METHODS;
import static ee.ria.xroad.proxy.util.MetadataRequests.GET_WSDL;
import static ee.ria.xroad.proxy.util.MetadataRequests.LIST_METHODS;
import static ee.ria.xroad.proxy.util.MetaserviceTestUtil.ALLOWED_METHODS_REQUEST;
import static ee.ria.xroad.proxy.util.MetaserviceTestUtil.CodedExceptionMatcher.faultCodeEquals;
import static ee.ria.xroad.proxy.util.MetaserviceTestUtil.GET_WSDL_REQUEST;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
import static ee.ria.xroad.common.metadata.MetadataRequests.ALLOWED_METHODS;
import static ee.ria.xroad.common.metadata.MetadataRequests.GET_OPENAPI;
import static ee.ria.xroad.common.metadata.MetadataRequests.LIST_METHODS;
import static ee.ria.xroad.proxy.util.MetadataRequests.ALLOWED_METHODS;
import static ee.ria.xroad.proxy.util.MetadataRequests.GET_OPENAPI;
import static ee.ria.xroad.proxy.util.MetadataRequests.LIST_METHODS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
import ee.ria.xroad.common.identifier.ClientId;
import ee.ria.xroad.common.metadata.ClientListType;
import ee.ria.xroad.common.metadata.ClientType;
import ee.ria.xroad.common.metadata.MetadataRequests;
import ee.ria.xroad.common.metadata.ObjectFactory;
import ee.ria.xroad.common.util.AbstractHttpSender;
import ee.ria.xroad.proxy.testsuite.Message;
import ee.ria.xroad.proxy.testsuite.MessageTestCase;
import ee.ria.xroad.proxy.testsuite.TestSuiteGlobalConf;
import ee.ria.xroad.proxy.util.MetadataRequests;
import ee.ria.xroad.proxy.util.MetaserviceTestUtil;

import jakarta.xml.bind.JAXBContext;
Expand Down
4 changes: 3 additions & 1 deletion src/addons/op-monitoring/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ dependencies {
implementation project(':common:common-op-monitoring')

implementation project(':proxy')
implementation project(':common:common-util')
implementation project(':common:common-domain')
implementation project(':common:common-message')
implementation project(':common:common-jetty')
implementation project(':serverconf')

testImplementation project(':common:common-test')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ To use this wsdl, copy the wsdl and schemas from this directory
(monitoring.wsdl, monitoring.xsd and xroad.xsd) along with the following
imported schema to the same directory:
- `identifiers.xsd`
- from `xroad/src/common/common-util/src/main/resources/identifiers.xsd`
- from `xroad/src/common/common-domain/src/main/resources/identifiers.xsd`
7 changes: 4 additions & 3 deletions src/addons/proxymonitor/metaservice/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ project.ext.schemaTargetDir = layout.buildDirectory.dir("generated-sources").get
sourceSets {
main {
java.srcDirs = ["src/main/java", schemaTargetDir]
resources.srcDirs = ['src/main/resources', '../../../common/common-util/src/main/resources']
resources.srcDirs = ['src/main/resources', '../../../common/common-domain/src/main/resources']
}
}

dependencies {
implementation project(':proxy')
implementation project(':common:common-util')
implementation project(':common:common-message')
implementation project(':common:common-domain')
implementation project(':common:common-jetty')
implementation project(":serverconf")
implementation project(":common:common-op-monitoring")
implementation project(":common:common-verifier")
Expand All @@ -25,7 +27,6 @@ dependencies {

implementation "com.google.guava:guava:$guavaVersion"

testImplementation project(path: ':common:common-util', configuration: 'testArtifacts')
testImplementation project(path: ":proxy", configuration: 'testArtifacts')
testImplementation project(':common:common-test')
testImplementation 'org.hamcrest:hamcrest:2.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
package ee.ria.xroad.proxymonitor.util;

import ee.ria.xroad.common.util.SystemMetrics;
import ee.ria.xroad.proxy.util.SystemMetrics;

import com.sun.management.UnixOperatingSystemMXBean;
import io.grpc.stub.StreamObserver;
Expand Down
2 changes: 1 addition & 1 deletion src/asic-util/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dependencies {
implementation project(':common:common-util')
implementation project(':common:common-message')
implementation project(':common:common-verifier')
implementation "xerces:xercesImpl:$xercesVersion"

Expand Down
2 changes: 1 addition & 1 deletion src/asicverifier/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies {
implementation project(':common:common-verifier'),
project(':asic-util')

implementation(project(':common:common-util'))
implementation(project(':common:common-core'))

testImplementation project(':common:common-test')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public class AsicContainerVerifierTest {
*/
@BeforeClass
public static void setUpConf() {
System.setProperty(SystemProperties.CONFIGURATION_PATH, "../common/common-util/src/test/resources/globalconf_good");
System.setProperty(SystemProperties.CONFIGURATION_PATH, "../common/common-globalconf/src/test/resources/globalconf_good");
System.setProperty(SystemProperties.CONFIGURATION_ANCHOR_FILE,
"../common/common-util/src/test/resources/configuration-anchor1.xml");
"../common/common-globalconf/src/test/resources/configuration-anchor1.xml");

GlobalConf.reload(new TestGlobalConfImpl() {
@Override
Expand Down
2 changes: 1 addition & 1 deletion src/central-server/admin-service/api-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
dependencies {
api project(':central-server:openapi-model')

implementation project(':common:common-util')
implementation project(':common:common-core')
implementation project(':common:common-verifier')

compileOnly("jakarta.servlet:jakarta.servlet-api:$jakartaServletApiVersion")
Expand Down
2 changes: 1 addition & 1 deletion src/central-server/admin-service/core-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

dependencies {
api project(':common:common-util')
api project(':common:common-globalconf')
api project(':signer-protocol')
api project(':common:common-admin-api')
api project(':common:common-management-request')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,25 @@

import ee.ria.xroad.common.identifier.ClientId;

import io.vavr.control.Option;
import org.niis.xroad.cs.admin.api.domain.GlobalGroupMember;
import org.niis.xroad.cs.admin.api.domain.SecurityServer;
import org.niis.xroad.cs.admin.api.domain.XRoadMember;
import org.niis.xroad.cs.admin.api.dto.MemberCreationRequest;

import java.util.List;
import java.util.Optional;

public interface MemberService {

XRoadMember add(MemberCreationRequest request);

void delete(ClientId clientId);

Option<XRoadMember> findMember(ClientId clientId);
Optional<XRoadMember> findMember(ClientId clientId);

List<GlobalGroupMember> getMemberGlobalGroups(ClientId memberId);

List<SecurityServer> getMemberOwnedServers(ClientId memberId);

Option<XRoadMember> updateMemberName(ClientId clientId, String newName);
Optional<XRoadMember> updateMemberName(ClientId clientId, String newName);
}
1 change: 0 additions & 1 deletion src/central-server/admin-service/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ dependencies {
api("jakarta.transaction:jakarta.transaction-api")
api("jakarta.persistence:jakarta.persistence-api")

implementation("io.vavr:vavr:$vavrVersion")
implementation("org.apache.commons:commons-compress:$commonsCompressVersion")

testImplementation project(':common:common-test')
Expand Down
Loading

0 comments on commit 1244414

Please sign in to comment.