3 Commits

370 changed files with 12602 additions and 14910 deletions

BIN
.DS_Store vendored

Binary file not shown.

6
.gitignore vendored
View File

@@ -1,4 +1,5 @@
/target/
/config/
!.mvn/wrapper/maven-wrapper.jar
### STS ###
@@ -29,8 +30,5 @@
/.nb-gradle/
/cygnus-onprem-app/target
/cygnus-cloud-client/target
/cygnus-installer/src/test
/cygnus-cloud-service/target
/cygnus-installer/src/target
/cygnus-installer/target
/cygnus-onprem-db/target
/cygnus-lib/target

10
.vscode/launch.json vendored
View File

@@ -59,19 +59,15 @@
"REDIS_HOST": "103.125.129.116",
"REDIS_PORT": "7901",
"REDIS_PASSWORD": "M@triXR3d1s@6202",
"REDIS_DATABASE": "1",
"REDIS_SSL": "false",
"CYGNUS_QUERY_CACHE_ENABLED": "false",
"CYGNUS_CLOUD_BASE_URL": "http://localhost:8090",
"CYGNUS_TOKEN_URL": "http://localhost:8090/oauth2/token",
"CYGNUS_CLIENT_ID": "matrix",
"CYGNUS_INSTALLATION_ID": "matrix-delhi-cygnus-01",
"CYGNUS_CLIENT_ASSERTION": "file:${workspaceFolder}/config/clients/matrix/matrix-matrix-delhi-cygnus-01-assertion.jwt",
"CYGNUS_CLIENT_ASSERTION": "file:${workspaceFolder}/matrix-installation/config/machine-assertion.jwt",
"CYGNUS_LOGIN_KEY_ID": "cygnus-login-2026-01",
"CYGNUS_LOGIN_PUBLIC_KEY": "file:${workspaceFolder}/config/keys/login-public.pem",
"CYGNUS_PAYLOAD_PRIVATE_KEY": "file:${workspaceFolder}/config/keys/case-save-private.pem",
"CYGNUS_PAYLOAD_PUBLIC_KEY": "file:${workspaceFolder}/config/keys/case-save-public.pem",
"CYGNUS_CLOUD_REQUEST_TIMEOUT": "PT30S",
"CYGNUS_LOGIN_PUBLIC_KEY": "file:${workspaceFolder}/matrix-installation/config/keys/login-public.pem",
"CYGNUS_CLOUD_REQUEST_TIMEOUT": "PT10S",
"CYGNUS_TOKEN_REFRESH_SKEW": "PT30S"
},
"vmArgs": "-Dserver.port=8080 -Djava.awt.headless=true -Dmatrix.webapp=${workspaceFolder}/cygnus-onprem-app/build/WebContent -Dmatrix.classes=${workspaceFolder}/cygnus-onprem-app/target/classes",

View File

@@ -1 +0,0 @@
eyJlbmMiOiJBMjU2R0NNIiwiYWxnIjoiUlNBLU9BRVAtMjU2In0.rf8bViJPb5bRJHFamVoCftE0TLA1Gz7JyGnfcjtKEx3KiUL4SSbgYSUQlsKhCt8VJMWE--UpgbkM0Bv3pFVsMF_uh693MhFstEy_A6S3MODjoUV_bMLa_Zr1yH2Jwzud4LSyw-ctJ7G-vO8S_I6YML0HV5kNbobdFmMfXFLGKssVmM_Km0m57ZgSjj3zRii0cKpmdwwSbWoJC2y519TpKhIja0OZAoN1oB3IVKvERlFYCQYUpQmcRkzULGrlSoLIm9iqbRX4qMGhGISwVS6JdVtn9WjpSjF3xkUxN_QsVuYKYFL_kEKWSNepIcfoip7Ag9Qw_S1RZA_KO908MgrzGRbs2UIpxY9sAM8yZ-k1NTk0swV836s5pdDIP3PHovcd6iR8mqWBPt7mq7ES98vNeCZxqPLB_b1JuNfKsbLPdRIvEk2DTjZHeEi-yA1yl5uMi_1f4la6mgy65u_jLL_Ow28uZtj-8yQ3dR4lF3K7tkxQaB4LQiH5nl6lXEndpoPe.Cpu6VoHf2ptCue_L.uH-Pq1WZN-x_c71Iyx8X1QJa1JZRp9sYta9iUOmQ4W8x4Qh2wYm-_tpr8FEw56MLvIb8IH_gHVVLAJgXTmCZhyo26vJlPCtnMMPYFDrPRzTJv9Ewg7RMpsAh_kXFFK4UJ6Tgt_r7Tg_bnVOTKXodUjl3wVdMowZRX_ua-gKwLU-2LDWdqIRmuFDSOkMb1sFBZLPyjWHg_rThs-RwVa4YJdDi74s-L0WX0xRPXzeovu1-xvOgZ0xYf0ScbsFQgvK-JwAxOWsB1WKeHRqnnx5-apK6qtzhpiJ30c7ukPlrg2nieuJvkXOVuKBKXLVRLSViOH4HU76DD96btDUA0Cg2kEURpepucX0VWPyB7K3xb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K8lNGG6aImLPmtJijEvOL0VsUdp+oO87VnTFAgMBAAE=
-----END PUBLIC KEY-----

View File

@@ -1,17 +1,11 @@
package com.cygnus.client;
import com.cygnus.client.model.CloudIdentitySession;
import com.cygnus.client.model.CloudDataItem;
import com.cygnus.client.model.CloudDataRequest;
import com.cygnus.client.model.CloudQueryResponse;
import com.cygnus.client.model.LoginPayload;
import com.cygnus.client.security.LoginEnvelopeEncryptor;
import com.cygnus.client.security.MachineTokenProvider;
import java.time.Clock;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.client.WebClient;
@@ -19,9 +13,6 @@ import reactor.core.publisher.Mono;
public class CloudIdentityClient {
private static final ParameterizedTypeReference<List<CloudDataItem>> CLOUD_DATA_LIST =
new ParameterizedTypeReference<>() { };
private final WebClient webClient;
private final MachineTokenProvider tokenProvider;
private final LoginEnvelopeEncryptor encryptor;
@@ -59,39 +50,4 @@ public class CloudIdentityClient {
.bodyToMono(CloudIdentitySession.class))
.timeout(properties.requestTimeout());
}
public Mono<CloudQueryResponse> fetchQuery(int queryId) {
return tokenProvider.accessToken()
.flatMap(token -> webClient.get()
.uri(properties.baseUri().resolve("/api/v1/queries/" + queryId))
.header(HttpHeaders.AUTHORIZATION, "Bearer " + token)
.accept(MediaType.APPLICATION_JSON)
.retrieve()
.bodyToMono(CloudQueryResponse.class))
.timeout(properties.requestTimeout());
}
public Mono<CloudQueryResponse> fetchQuery(String queryKey) {
return tokenProvider.accessToken()
.flatMap(token -> webClient.get()
.uri(properties.baseUri().resolve("/api/v1/queries/key/" + queryKey))
.header(HttpHeaders.AUTHORIZATION, "Bearer " + token)
.accept(MediaType.APPLICATION_JSON)
.retrieve()
.bodyToMono(CloudQueryResponse.class))
.timeout(properties.requestTimeout());
}
public Mono<List<CloudDataItem>> fetchData(String scope, Map<String, Object> data) {
return tokenProvider.accessToken()
.flatMap(token -> webClient.post()
.uri(properties.baseUri().resolve("/api/v1/platform/data"))
.header(HttpHeaders.AUTHORIZATION, "Bearer " + token)
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
.bodyValue(new CloudDataRequest(scope, Map.copyOf(data)))
.retrieve()
.bodyToMono(CLOUD_DATA_LIST))
.timeout(properties.requestTimeout());
}
}

View File

@@ -1,6 +0,0 @@
package com.cygnus.client.model;
import java.util.Map;
public record CloudDataItem(Object value, String label, String group, Map<String, Object> data) {
}

View File

@@ -1,6 +0,0 @@
package com.cygnus.client.model;
import java.util.Map;
public record CloudDataRequest(String scope, Map<String, Object> data) {
}

View File

@@ -1,4 +0,0 @@
package com.cygnus.client.model;
public record CloudQueryResponse(int queryId, String query) {
}

View File

@@ -1,49 +0,0 @@
package com.cygnus.cloud.platform.api;
import com.cygnus.cloud.platform.service.ScopedDataException;
import com.cygnus.cloud.platform.service.ScopedDataService;
import jakarta.validation.Valid;
import java.util.Map;
import java.util.UUID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.oauth2.jwt.Jwt;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
@RestController
@RequestMapping("/api/v1/platform/data")
public class ScopedDataController {
private static final Logger LOGGER = LoggerFactory.getLogger(ScopedDataController.class);
private final ScopedDataService service;
public ScopedDataController(ScopedDataService service) {
this.service = service;
}
@PostMapping
public Flux<ScopedDataItem> data(
@AuthenticationPrincipal Jwt machineJwt,
@Valid @RequestBody ScopedDataRequest request) {
if (machineJwt == null) throw new ScopedDataException("Machine authentication required");
try {
return service.fetch(UUID.fromString(machineJwt.getClaimAsString("tenant_id")), request);
} catch (IllegalArgumentException exception) {
throw new ScopedDataException("Machine tenant is invalid");
}
}
@ExceptionHandler(ScopedDataException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
Map<String, String> invalidRequest(ScopedDataException exception) {
LOGGER.warn("Scoped platform-data request rejected: {}", exception.getMessage());
return Map.of("code", "PLATFORM_DATA_INVALID", "message", exception.getMessage());
}
}

View File

@@ -1,10 +0,0 @@
package com.cygnus.cloud.platform.api;
import java.util.Map;
public record ScopedDataItem(
Object value,
String label,
String group,
Map<String, Object> data) {
}

View File

@@ -1,10 +0,0 @@
package com.cygnus.cloud.platform.api;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.util.Map;
public record ScopedDataRequest(
@NotBlank String scope,
@NotNull Map<String, Object> data) {
}

View File

@@ -1,106 +0,0 @@
package com.cygnus.cloud.platform.repository;
import com.cygnus.cloud.database.ReactiveDatabaseClient;
import com.cygnus.cloud.platform.api.ScopedDataItem;
import io.vertx.sqlclient.Row;
import io.vertx.sqlclient.Tuple;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Flux;
@Repository
public class ScopedDataRepository {
private static final String COMPANY_OPTIONS = """
SELECT ov.opt_value AS value,
ov.val_description AS label,
lower(o.description) || '.' AS group_name
FROM platform.company_options_mapping m
JOIN platform.options o ON o.option_id = m.option_id
JOIN platform.options_values ov ON ov.opt_value_id = m.opt_value_id
JOIN identity.company c ON c.company_id = m.company_id
WHERE c.tenant_id = $1
AND m.company_id = $2
AND o.isactive = 1
AND ov.isactive = 1
AND o.description = ANY($3::text[])
ORDER BY o.description, ov.val_description
""";
private static final String PORTFOLIO_OPTIONS = """
SELECT ov.opt_value AS value,
ov.val_description AS label,
lower(o.description) || '.' AS group_name
FROM platform.options_mapping m
JOIN platform.options o ON o.option_id = m.option_id
JOIN platform.options_values ov ON ov.opt_value_id = m.opt_value_id
JOIN identity.company c ON c.company_id = m.company_id
JOIN platform.company_branch_portfolios cbp
ON cbp.company_id = m.company_id
AND cbp.portfolio_reference = m.portfolio_reference
WHERE c.tenant_id = $1
AND m.company_id = $2
AND cbp.company_branch_id = $3
AND m.portfolio_reference = $4
AND o.isactive = 1
AND ov.isactive = 1
AND o.description = ANY($5::text[])
ORDER BY o.description, ov.val_description
""";
private static final String REPORT_DEFINITION = """
SELECT r.report_key, r.report_title, r.hide_leading_zero_columns,
c.column_key, c.column_label, c.display_order, c.alignment,
c.column_width, c.is_visible, c.is_totalled
FROM platform.report_definition r
JOIN platform.report_column_definition c ON c.report_key = r.report_key
WHERE r.report_key = $1
AND r.enabled = true
ORDER BY c.display_order
""";
private final ReactiveDatabaseClient database;
public ScopedDataRepository(ReactiveDatabaseClient database) {
this.database = database;
}
public Flux<ScopedDataItem> companyOptions(
UUID tenantId, short companyId, List<String> descriptions) {
return rows(COMPANY_OPTIONS, Tuple.of(tenantId, companyId, descriptions.toArray(String[]::new)));
}
public Flux<ScopedDataItem> portfolioOptions(
UUID tenantId, short companyId, short branchId, UUID portfolioReference,
List<String> descriptions) {
return rows(PORTFOLIO_OPTIONS,
Tuple.of(tenantId, companyId, branchId, portfolioReference,
descriptions.toArray(String[]::new)));
}
public Flux<ScopedDataItem> reportDefinition(String reportKey) {
return database.preparedQuery(REPORT_DEFINITION, Tuple.of(reportKey))
.flatMapMany(result -> Flux.fromIterable(result))
.map(row -> new ScopedDataItem(null, null, null, Map.of(
"reportKey", row.getString("report_key"),
"reportTitle", row.getString("report_title"),
"hideLeadingZeroColumns", row.getBoolean("hide_leading_zero_columns"),
"columnKey", row.getString("column_key"),
"columnLabel", row.getString("column_label"),
"displayOrder", row.getInteger("display_order"),
"alignment", row.getString("alignment"),
"columnWidth", row.getInteger("column_width"),
"visible", row.getBoolean("is_visible"),
"totalled", row.getBoolean("is_totalled"))));
}
private Flux<ScopedDataItem> rows(String sql, Tuple parameters) {
return database.preparedQuery(sql, parameters)
.flatMapMany(result -> Flux.fromIterable(result))
.map(this::item);
}
private ScopedDataItem item(Row row) {
return new ScopedDataItem(
row.getValue("value"), row.getString("label"), row.getString("group_name"), Map.of());
}
}

View File

@@ -1,7 +0,0 @@
package com.cygnus.cloud.platform.service;
public class ScopedDataException extends RuntimeException {
public ScopedDataException(String message) {
super(message);
}
}

View File

@@ -1,87 +0,0 @@
package com.cygnus.cloud.platform.service;
import com.cygnus.cloud.platform.api.ScopedDataItem;
import com.cygnus.cloud.platform.api.ScopedDataRequest;
import com.cygnus.cloud.platform.repository.ScopedDataRepository;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Flux;
@Service
public class ScopedDataService {
public static final String COMPANY_OPTIONS = "company-options";
public static final String PORTFOLIO_OPTIONS = "portfolio-options";
public static final String REPORT_DEFINITION = "report-definition";
private final ScopedDataRepository repository;
public ScopedDataService(ScopedDataRepository repository) {
this.repository = repository;
}
public Flux<ScopedDataItem> fetch(UUID tenantId, ScopedDataRequest request) {
Map<String, Object> data = request.data();
String scope = request.scope().trim().toLowerCase(Locale.ROOT);
if (REPORT_DEFINITION.equals(scope)) {
return repository.reportDefinition(textValue(data, "reportKey"));
}
short companyId = shortValue(data, "companyId");
List<String> descriptions = descriptions(data);
return switch (scope) {
case COMPANY_OPTIONS -> repository.companyOptions(tenantId, companyId, descriptions);
case PORTFOLIO_OPTIONS -> repository.portfolioOptions(
tenantId, companyId, shortValue(data, "branchId"),
uuidValue(data, "portfolioReference"), descriptions);
default -> Flux.error(new ScopedDataException("Unsupported data scope"));
};
}
private String textValue(Map<String, Object> data, String name) {
String value = String.valueOf(data.getOrDefault(name, "")).trim();
if (value.isEmpty() || value.length() > 100 || !value.matches("[a-z0-9-]+")) {
throw new ScopedDataException(name + " is invalid");
}
return value;
}
private UUID uuidValue(Map<String, Object> data, String name) {
try {
return UUID.fromString(String.valueOf(data.get(name)));
} catch (RuntimeException exception) {
throw new ScopedDataException(name + " must be a valid UUID");
}
}
private short shortValue(Map<String, Object> data, String name) {
Object value = data.get(name);
try {
short result = value instanceof Number number
? number.shortValue() : Short.parseShort(String.valueOf(value));
if (result <= 0) throw new NumberFormatException();
return result;
} catch (RuntimeException exception) {
throw new ScopedDataException(name + " must be a positive number");
}
}
private List<String> descriptions(Map<String, Object> data) {
Object value = data.get("descriptions");
if (!(value instanceof List<?> values)) {
throw new ScopedDataException("descriptions must be a non-empty list");
}
List<String> result = values.stream()
.map(String::valueOf)
.map(String::trim)
.filter(text -> !text.isEmpty())
.map(text -> text.toUpperCase(Locale.ROOT))
.distinct()
.toList();
if (result.isEmpty() || result.size() > 20) {
throw new ScopedDataException("descriptions must contain between 1 and 20 values");
}
return result;
}
}

View File

@@ -1,4 +0,0 @@
package com.cygnus.cloud.query;
public record CloudQuery(int queryId, String query) {
}

View File

@@ -1,34 +0,0 @@
package com.cygnus.cloud.query;
import jakarta.validation.constraints.Min;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;
@Validated
@RestController
@RequestMapping("/api/v1/queries")
public class CloudQueryController {
private final QueryCatalogRepository repository;
public CloudQueryController(QueryCatalogRepository repository) {
this.repository = repository;
}
@GetMapping("/{queryId}")
public Mono<CloudQuery> query(
@PathVariable @Min(1) int queryId) {
return repository.findEnabled(queryId)
.switchIfEmpty(Mono.error(new QueryNotFoundException(queryId)));
}
@GetMapping("/key/{queryKey}")
public Mono<CloudQuery> queryByKey(@PathVariable String queryKey) {
return repository.findEnabled(queryKey)
.switchIfEmpty(Mono.error(new QueryNotFoundException(queryKey)));
}
}

View File

@@ -1,71 +0,0 @@
package com.cygnus.cloud.query;
import com.cygnus.cloud.database.ReactiveDatabaseClient;
import io.vertx.sqlclient.Tuple;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Mono;
@Repository
public class QueryCatalogRepository {
private static final String INITIALIZE = """
CREATE SCHEMA IF NOT EXISTS platform;
CREATE SEQUENCE IF NOT EXISTS platform.application_query_id_seq;
CREATE TABLE IF NOT EXISTS platform.application_query (
query_id integer PRIMARY KEY DEFAULT nextval('platform.application_query_id_seq'),
query_key varchar(100),
query_text text NOT NULL,
enabled boolean NOT NULL DEFAULT true,
created_at timestamptz NOT NULL DEFAULT current_timestamp,
updated_at timestamptz NOT NULL DEFAULT current_timestamp,
CONSTRAINT ck_platform_application_query_id
CHECK (query_id > 0),
CONSTRAINT ck_platform_application_query_text
CHECK (length(btrim(query_text)) > 0)
);
ALTER TABLE platform.application_query
ADD COLUMN IF NOT EXISTS query_key varchar(100);
ALTER TABLE platform.application_query ALTER COLUMN query_id
SET DEFAULT nextval('platform.application_query_id_seq');
CREATE UNIQUE INDEX IF NOT EXISTS ux_platform_application_query_key
ON platform.application_query (query_key) WHERE query_key IS NOT NULL;
SELECT setval('platform.application_query_id_seq',
greatest(coalesce((SELECT max(query_id) FROM platform.application_query), 0) + 1, 1), false)
""";
private static final String FIND = """
SELECT query_id, query_text
FROM platform.application_query
WHERE query_id = $1
AND enabled = true
""";
private static final String FIND_BY_KEY = """
SELECT query_id, query_text
FROM platform.application_query
WHERE query_key = $1
AND enabled = true
""";
private final ReactiveDatabaseClient database;
public QueryCatalogRepository(ReactiveDatabaseClient database) {
this.database = database;
}
public Mono<Void> initialize() {
return database.query(INITIALIZE).then();
}
public Mono<CloudQuery> findEnabled(int queryId) {
return database.preparedQuery(FIND, Tuple.of(queryId))
.flatMapMany(rows -> reactor.core.publisher.Flux.fromIterable(rows))
.next()
.map(row -> new CloudQuery(
row.getInteger("query_id"), row.getString("query_text")));
}
public Mono<CloudQuery> findEnabled(String queryKey) {
return database.preparedQuery(FIND_BY_KEY, Tuple.of(queryKey))
.flatMapMany(rows -> reactor.core.publisher.Flux.fromIterable(rows))
.next()
.map(row -> new CloudQuery(row.getInteger("query_id"), row.getString("query_text")));
}
}

View File

@@ -1,22 +0,0 @@
package com.cygnus.cloud.query;
import java.time.Duration;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
@Component
public class QueryCatalogSchemaInitializer implements ApplicationRunner {
private final QueryCatalogRepository repository;
public QueryCatalogSchemaInitializer(QueryCatalogRepository repository) {
this.repository = repository;
}
@Override
public void run(ApplicationArguments arguments) {
repository.initialize()
.block(Duration.ofMinutes(2));
}
}

View File

@@ -1,16 +0,0 @@
package com.cygnus.cloud.query;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(HttpStatus.NOT_FOUND)
public class QueryNotFoundException extends RuntimeException {
public QueryNotFoundException(int queryId) {
super("Query was not found: " + queryId);
}
public QueryNotFoundException(String queryKey) {
super("Query was not found: " + queryKey);
}
}

View File

@@ -36,10 +36,6 @@ public class CloudSecurityConfiguration {
.permitAll()
.pathMatchers("/api/v1/identity/login")
.hasAuthority("SCOPE_identity.login")
.pathMatchers("/api/v1/queries/**")
.hasAuthority("SCOPE_identity.login")
.pathMatchers("/api/v1/platform/data")
.hasAuthority("SCOPE_identity.login")
.pathMatchers("/api/v1/admin/**")
.hasAuthority("SCOPE_cygnus.admin")
.anyExchange().authenticated())

View File

@@ -1,23 +0,0 @@
CREATE SCHEMA IF NOT EXISTS platform;
CREATE SEQUENCE IF NOT EXISTS platform.application_query_id_seq;
CREATE TABLE IF NOT EXISTS platform.application_query (
query_id integer PRIMARY KEY DEFAULT nextval('platform.application_query_id_seq'),
query_key varchar(100),
query_text text NOT NULL,
enabled boolean NOT NULL DEFAULT true,
created_at timestamptz NOT NULL DEFAULT current_timestamp,
updated_at timestamptz NOT NULL DEFAULT current_timestamp,
CONSTRAINT ck_platform_application_query_id
CHECK (query_id > 0),
CONSTRAINT ck_platform_application_query_text
CHECK (length(btrim(query_text)) > 0)
);
ALTER TABLE platform.application_query
ADD COLUMN IF NOT EXISTS query_key varchar(100);
CREATE UNIQUE INDEX IF NOT EXISTS ux_platform_application_query_key
ON platform.application_query (query_key) WHERE query_key IS NOT NULL;
ALTER TABLE platform.application_query ALTER COLUMN query_id
SET DEFAULT nextval('platform.application_query_id_seq');
SELECT setval('platform.application_query_id_seq',
greatest(coalesce((SELECT max(query_id) FROM platform.application_query), 0) + 1, 1), false);

View File

@@ -1,25 +0,0 @@
DO $$
DECLARE
current_type text;
BEGIN
SELECT data_type
INTO current_type
FROM information_schema.columns
WHERE table_schema = 'platform'
AND table_name = 'application_query'
AND column_name = 'query_id';
IF current_type IN ('character varying', 'text') THEN
ALTER TABLE platform.application_query
DROP CONSTRAINT IF EXISTS ck_platform_application_query_id;
ALTER TABLE platform.application_query
ALTER COLUMN query_id TYPE integer
USING regexp_replace(query_id, '^Query', '')::integer;
ALTER TABLE platform.application_query
ADD CONSTRAINT ck_platform_application_query_id
CHECK (query_id > 0);
END IF;
END
$$;

View File

@@ -1,11 +0,0 @@
-- Stable query key; query_id is generated by PostgreSQL.
BEGIN;
INSERT INTO platform.application_query(query_key, query_text, enabled, created_at, updated_at, ismigrated)
VALUES ('APPLICATION_SAVE',
'procedure!C0L!select * from public.save_application_details(?::jsonb,?::smallint,?::smallint,?::smallint)',
true, clock_timestamp(), clock_timestamp(), true)
ON CONFLICT (query_key) WHERE query_key IS NOT NULL DO UPDATE SET
query_text=excluded.query_text, enabled=true, updated_at=clock_timestamp(), ismigrated=true;
COMMIT;

View File

@@ -1,38 +0,0 @@
CREATE TABLE IF NOT EXISTS platform.report_definition (
report_key varchar(100) PRIMARY KEY,
report_title varchar(200) NOT NULL,
hide_leading_zero_columns boolean NOT NULL DEFAULT false,
enabled boolean NOT NULL DEFAULT true,
updated_at timestamptz NOT NULL DEFAULT current_timestamp
);
CREATE TABLE IF NOT EXISTS platform.report_column_definition (
report_key varchar(100) NOT NULL REFERENCES platform.report_definition(report_key) ON DELETE CASCADE,
column_key varchar(100) NOT NULL,
column_label varchar(100) NOT NULL,
display_order integer NOT NULL,
alignment varchar(10) NOT NULL DEFAULT 'left',
column_width integer NOT NULL DEFAULT 80,
is_visible boolean NOT NULL DEFAULT true,
is_totalled boolean NOT NULL DEFAULT false,
PRIMARY KEY (report_key, column_key)
);
INSERT INTO platform.report_definition(report_key, report_title, hide_leading_zero_columns)
VALUES ('hourly-mis', 'HOURLY MIS (EDP)', true)
ON CONFLICT (report_key) DO NOTHING;
INSERT INTO platform.report_column_definition
(report_key,column_key,column_label,display_order,alignment,column_width,is_visible,is_totalled)
VALUES ('hourly-mis','date','Date',0,'left',110,true,false),
('hourly-mis','total','Total',25,'center',70,true,true)
ON CONFLICT (report_key,column_key) DO NOTHING;
INSERT INTO platform.report_column_definition
(report_key,column_key,column_label,display_order,alignment,column_width,is_visible,is_totalled)
SELECT 'hourly-mis', 'hour'||hour, hour::text, hour+1, 'center', 55, true, true
FROM generate_series(0,23) hour
ON CONFLICT (report_key,column_key) DO NOTHING;
DELETE FROM platform.application_query
WHERE query_key = 'report-definition';

Binary file not shown.

View File

@@ -30,7 +30,6 @@ public class DeploymentWriter {
try {
Path normalizedOutput = output.toAbsolutePath().normalize();
Path config = normalizedOutput.resolve("config");
protectCloudConfiguration(config, profile);
Path keyDirectory = config.resolve("keys");
Files.createDirectories(keyDirectory);
@@ -83,23 +82,6 @@ public class DeploymentWriter {
}
}
private void protectCloudConfiguration(Path deploymentConfig, ProductProfile profile) {
if (isInside(deploymentConfig, profile.assertionEncryptionPublicKey())
|| isInside(deploymentConfig, profile.loginEncryptionPublicKey())) {
throw new IllegalArgumentException(
"Refusing to write deployment files over the cloud-service "
+ "configuration directory");
}
}
private boolean isInside(Path directory, Path file) {
if (file == null) {
return false;
}
return file.toAbsolutePath().normalize().startsWith(
directory.toAbsolutePath().normalize());
}
private String installationConfiguration(
UUID installationUuid,
String installationCode,
@@ -192,7 +174,6 @@ public class DeploymentWriter {
appendEnvironment(env, "REDIS_HOST", runtime.redisHost());
appendEnvironment(env, "REDIS_PORT", runtime.redisPort());
appendEnvironment(env, "REDIS_PASSWORD", runtime.redisPassword());
appendEnvironment(env, "REDIS_DATABASE", "1");
appendEnvironment(env, "REDIS_SSL", Boolean.toString(runtime.redisSsl()));
appendEnvironment(
env, "CYGNUS_CLOUD_BASE_URL", normalizedCloudServiceUrl(runtime));

View File

@@ -156,7 +156,6 @@ public class InstallationService {
if (request.outputDirectory() == null) {
throw new IllegalArgumentException("Output directory is required");
}
validateOutputIsolation(request.outputDirectory());
RuntimeConfiguration runtime = request.runtimeConfiguration();
if (runtime == null) {
throw new IllegalArgumentException("Runtime configuration is required");
@@ -205,27 +204,6 @@ public class InstallationService {
}
}
private void validateOutputIsolation(Path outputDirectory) {
Path deploymentConfig = outputDirectory
.toAbsolutePath()
.normalize()
.resolve("config");
if (isInside(deploymentConfig, profile.assertionEncryptionPublicKey())
|| isInside(deploymentConfig, profile.loginEncryptionPublicKey())) {
throw new IllegalArgumentException(
"Output directory would overwrite the cloud-service config folder. "
+ "Select a dedicated deployment directory, such as "
+ "'matrix-installation'.");
}
}
private boolean isInside(Path directory, Path file) {
if (file == null) {
return false;
}
return file.toAbsolutePath().normalize().startsWith(directory);
}
private String normalizedCloudServiceUrl(String value) {
String normalized = value.trim();
return normalized.endsWith("/")

View File

@@ -42,9 +42,8 @@ import org.springframework.stereotype.Service;
public class SwingInstallationWizard {
private static final String WELCOME = "welcome";
private static final String DATABASE = "database";
private static final String DEPLOYMENT = "deployment";
private static final String DETAILS = "details";
private static final String RUNTIME = "runtime";
private static final String INSTALLING = "installing";
private static final Color ACCENT = new Color(35, 97, 146);
private static final Color BACKGROUND = new Color(236, 243, 247);
@@ -69,9 +68,7 @@ public class SwingInstallationWizard {
private JPasswordField dockerPassword;
private JTextField outputDirectory;
private JTextField containerCloudServiceUrl;
private JTextField databaseHost;
private JTextField databasePort;
private JTextField databaseName;
private JTextField databaseUrl;
private JTextField databaseUsername;
private JPasswordField databasePassword;
private JTextField redisHost;
@@ -142,9 +139,8 @@ public class SwingInstallationWizard {
cardPanel = new JPanel(cards);
cardPanel.setBackground(BACKGROUND);
cardPanel.add(welcomePanel(), WELCOME);
cardPanel.add(databasePanel(), DATABASE);
cardPanel.add(deploymentPanel(), DEPLOYMENT);
cardPanel.add(detailsPanel(), DETAILS);
cardPanel.add(runtimePanel(), RUNTIME);
cardPanel.add(installingPanel(), INSTALLING);
root.add(cardPanel, BorderLayout.CENTER);
return root;
@@ -201,8 +197,7 @@ public class SwingInstallationWizard {
JPanel top = new JPanel(new BorderLayout());
top.setOpaque(false);
top.add(heading("Installation details"), BorderLayout.NORTH);
top.add(text("Review and enter the activation details supplied by Technobee."),
BorderLayout.SOUTH);
top.add(text("Enter the activation details supplied by Technobee."), BorderLayout.SOUTH);
panel.add(top, BorderLayout.NORTH);
JPanel form = new JPanel(new GridBagLayout());
@@ -214,32 +209,6 @@ public class SwingInstallationWizard {
licenseKey = new JPasswordField();
installationCode = new JTextField();
installationName = new JTextField();
int row = 0;
row = addField(form, row, "Client code", clientCode, null);
row = addField(form, row, "License key", licenseKey, null);
row = addField(form, row, "Installation code", installationCode, null);
addField(form, row, "Installation name", installationName, null);
panel.add(form, BorderLayout.CENTER);
JButton back = secondaryButton("Back");
back.addActionListener(event -> cards.show(cardPanel, DEPLOYMENT));
JButton install = primaryButton("Install");
install.addActionListener(event -> startInstallation());
panel.add(actions(back, install), BorderLayout.SOUTH);
return panel;
}
private JPanel deploymentPanel() {
JPanel panel = contentPanel();
panel.setLayout(new BorderLayout(0, 12));
JPanel top = new JPanel(new BorderLayout());
top.setOpaque(false);
top.add(heading("Docker and deployment"), BorderLayout.NORTH);
top.add(text("Configure the container image, registry and deployment location."),
BorderLayout.SOUTH);
panel.add(top, BorderLayout.NORTH);
JPanel form = formPanel();
containerCloudServiceUrl =
new JTextField(settings.containerCloudServiceUrl().toString());
containerCloudServiceUrl.setEditable(true);
@@ -251,6 +220,10 @@ public class SwingInstallationWizard {
outputDirectory = new JTextField(
settings.defaultOutputDirectory().toAbsolutePath().normalize().toString());
int row = 0;
row = addField(form, row, "Client code", clientCode, null);
row = addField(form, row, "License key", licenseKey, null);
row = addField(form, row, "Installation code", installationCode, null);
row = addField(form, row, "Installation name", installationName, null);
row = addField(
form,
row,
@@ -264,11 +237,8 @@ public class SwingInstallationWizard {
dockerImage,
null);
row = addField(form, row, "Docker registry", dockerRegistry, null);
row = addComponentField(
form,
row,
"Docker credentials",
credentialFields(dockerUsername, dockerPassword));
row = addField(form, row, "Docker username", dockerUsername, null);
row = addField(form, row, "Docker password", dockerPassword, null);
for (String field : profile.optionalInstallationFields()) {
JTextField input = new JTextField();
optionalFields.put(field, input);
@@ -284,28 +254,31 @@ public class SwingInstallationWizard {
panel.add(scroll, BorderLayout.CENTER);
JButton back = secondaryButton("Back");
back.addActionListener(event -> cards.show(cardPanel, DATABASE));
back.addActionListener(event -> cards.show(cardPanel, WELCOME));
JButton next = primaryButton("Next");
next.addActionListener(event -> cards.show(cardPanel, DETAILS));
next.addActionListener(event -> cards.show(cardPanel, RUNTIME));
panel.add(actions(back, next), BorderLayout.SOUTH);
return panel;
}
private JPanel databasePanel() {
private JPanel runtimePanel() {
JPanel panel = contentPanel();
panel.setLayout(new BorderLayout(0, 12));
JPanel top = new JPanel(new BorderLayout());
top.setOpaque(false);
top.add(heading("Database and Redis"), BorderLayout.NORTH);
top.add(heading("Runtime configuration"), BorderLayout.NORTH);
top.add(text("Configure the database and Redis services used by the "
+ profile.displayName() + " on-premises container."), BorderLayout.SOUTH);
panel.add(top, BorderLayout.NORTH);
JPanel form = formPanel();
databaseHost = new JTextField("localhost");
databasePort = new JTextField("5432");
databaseName = new JTextField("matrix");
JPanel form = new JPanel(new GridBagLayout());
form.setBackground(PANEL);
form.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(new Color(205, 217, 225)),
BorderFactory.createEmptyBorder(14, 16, 14, 16)));
databaseUrl = new JTextField("jdbc:postgresql://localhost:5432/matrix");
databaseUsername = new JTextField("postgres");
databasePassword = new JPasswordField();
redisHost = new JTextField("localhost");
@@ -314,16 +287,9 @@ public class SwingInstallationWizard {
cloudRequestTimeout = new JTextField("PT10S");
tokenRefreshSkew = new JTextField("PT30S");
int row = 0;
row = addComponentField(
form,
row,
"Database",
databaseConnectionFields());
row = addComponentField(
form,
row,
"Database credentials",
credentialFields(databaseUsername, databasePassword));
row = addField(form, row, "Database URL", databaseUrl, null);
row = addField(form, row, "Database username", databaseUsername, null);
row = addField(form, row, "Database password", databasePassword, null);
row = addField(form, row, "Redis host", redisHost, null);
row = addField(form, row, "Redis port", redisPort, null);
row = addField(form, row, "Redis password", redisPassword, null);
@@ -338,10 +304,10 @@ public class SwingInstallationWizard {
panel.add(form, BorderLayout.CENTER);
JButton back = secondaryButton("Back");
back.addActionListener(event -> cards.show(cardPanel, WELCOME));
JButton next = primaryButton("Next");
next.addActionListener(event -> cards.show(cardPanel, DEPLOYMENT));
panel.add(actions(back, next), BorderLayout.SOUTH);
back.addActionListener(event -> cards.show(cardPanel, DETAILS));
JButton install = primaryButton("Install");
install.addActionListener(event -> startInstallation());
panel.add(actions(back, install), BorderLayout.SOUTH);
return panel;
}
@@ -407,7 +373,7 @@ public class SwingInstallationWizard {
progressBar.setValue(0);
progressPercentage.setText("0%");
progressMessage.setText("Preparing installation");
cards.show(cardPanel, DEPLOYMENT);
cards.show(cardPanel, RUNTIME);
containerCloudServiceUrl.requestFocusInWindow();
});
@@ -449,8 +415,8 @@ public class SwingInstallationWizard {
button.setText("Check Docker and continue");
try {
get();
cards.show(cardPanel, DATABASE);
databaseHost.requestFocusInWindow();
cards.show(cardPanel, DETAILS);
clientCode.requestFocusInWindow();
} catch (Exception exception) {
showError(message(exception));
}
@@ -479,12 +445,7 @@ public class SwingInstallationWizard {
optionalValues(),
new RuntimeConfiguration(
containerCloudServiceUrl.getText(),
"jdbc:postgresql://"
+ databaseHost.getText().trim()
+ ":"
+ databasePort.getText().trim()
+ "/"
+ databaseName.getText().trim(),
databaseUrl.getText(),
databaseUsername.getText(),
new String(databaseSecret),
redisHost.getText(),
@@ -598,9 +559,7 @@ public class SwingInstallationWizard {
validateAbsoluteHttpUrl(
runtime.containerCloudServiceUrl(),
"Container cloud service URL");
if (databaseHost.getText().isBlank()
|| databasePort.getText().isBlank()
|| databaseName.getText().isBlank()
if (runtime.databaseUrl().isBlank()
|| runtime.databaseUsername().isBlank()
|| runtime.databasePassword().isBlank()) {
throw new IllegalArgumentException(
@@ -673,95 +632,6 @@ public class SwingInstallationWizard {
return row + 1;
}
private int addComponentField(
JPanel form,
int row,
String label,
Component input) {
GridBagConstraints labelConstraints = constraints(0, row);
labelConstraints.weightx = 0;
labelConstraints.fill = GridBagConstraints.NONE;
labelConstraints.anchor = GridBagConstraints.LINE_START;
JLabel fieldLabel = new JLabel(label);
fieldLabel.setFont(fieldLabel.getFont().deriveFont(Font.BOLD, 12f));
form.add(fieldLabel, labelConstraints);
GridBagConstraints inputConstraints = constraints(1, row);
inputConstraints.weightx = 1;
inputConstraints.fill = GridBagConstraints.HORIZONTAL;
form.add(input, inputConstraints);
return row + 1;
}
private JPanel formPanel() {
JPanel form = new JPanel(new GridBagLayout());
form.setBackground(PANEL);
form.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(new Color(205, 217, 225)),
BorderFactory.createEmptyBorder(14, 16, 14, 16)));
return form;
}
private JPanel databaseConnectionFields() {
JPanel fields = inlineFieldsPanel();
addInlineField(fields, databaseHost, 0, 0.50);
addInlineSeparator(fields, ":", 1);
addInlineField(fields, databasePort, 2, 0.15);
addInlineSeparator(fields, "/", 3);
addInlineField(fields, databaseName, 4, 0.35);
databaseHost.setToolTipText("Database host");
databasePort.setToolTipText("Database port");
databaseName.setToolTipText("Database name");
return fields;
}
private JPanel credentialFields(JTextField username, JTextField password) {
JPanel fields = inlineFieldsPanel();
addInlineLabel(fields, "Username", 0);
addInlineField(fields, username, 1, 0.5);
addInlineLabel(fields, "Password", 2);
addInlineField(fields, password, 3, 0.5);
return fields;
}
private JPanel inlineFieldsPanel() {
JPanel fields = new JPanel(new GridBagLayout());
fields.setOpaque(false);
return fields;
}
private void addInlineField(
JPanel panel,
JTextField field,
int column,
double weight) {
GridBagConstraints constraints = new GridBagConstraints();
constraints.gridx = column;
constraints.weightx = weight;
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.insets = new Insets(0, column == 0 ? 0 : 5, 0, 0);
field.setPreferredSize(new Dimension(120, 29));
panel.add(field, constraints);
}
private void addInlineLabel(JPanel panel, String text, int column) {
GridBagConstraints constraints = new GridBagConstraints();
constraints.gridx = column;
constraints.weightx = 0;
constraints.insets = new Insets(0, column == 0 ? 0 : 12, 0, 5);
JLabel label = new JLabel(text);
label.setForeground(new Color(75, 88, 99));
panel.add(label, constraints);
}
private void addInlineSeparator(JPanel panel, String text, int column) {
GridBagConstraints constraints = new GridBagConstraints();
constraints.gridx = column;
constraints.weightx = 0;
constraints.insets = new Insets(0, 5, 0, 0);
panel.add(new JLabel(text), constraints);
}
private GridBagConstraints constraints(int column, int row) {
GridBagConstraints constraints = new GridBagConstraints();
constraints.gridx = column;
@@ -794,7 +664,6 @@ public class SwingInstallationWizard {
JLabel label = new JLabel(value);
label.setFont(label.getFont().deriveFont(Font.BOLD, 19f));
label.setForeground(new Color(35, 48, 58));
label.setAlignmentX(Component.LEFT_ALIGNMENT);
return label;
}
@@ -808,7 +677,6 @@ public class SwingInstallationWizard {
private JPanel summaryRow(String label, String value) {
JPanel row = new JPanel(new BorderLayout(18, 0));
row.setOpaque(false);
row.setAlignmentX(Component.LEFT_ALIGNMENT);
row.setBorder(BorderFactory.createEmptyBorder(7, 0, 7, 0));
JLabel name = new JLabel(label);
name.setPreferredSize(new Dimension(130, 20));
@@ -823,8 +691,7 @@ public class SwingInstallationWizard {
JPanel row = new JPanel(new BorderLayout(18, 0));
row.setOpaque(false);
row.setAlignmentX(Component.LEFT_ALIGNMENT);
row.setBorder(BorderFactory.createEmptyBorder(7, 0, 7, 0));
row.setMaximumSize(new Dimension(Integer.MAX_VALUE, 42));
row.setMaximumSize(new Dimension(Integer.MAX_VALUE, 34));
JLabel name = new JLabel(label);
name.setFont(name.getFont().deriveFont(Font.BOLD));
name.setPreferredSize(new Dimension(130, 28));

View File

@@ -23,7 +23,6 @@ public class TechnobeeServiceInstallerApplication implements CommandLineRunner {
}
public static void main(String[] args) {
disableAccidentalSpringDebug(args);
SpringApplication application =
new SpringApplication(TechnobeeServiceInstallerApplication.class);
application.setWebApplicationType(WebApplicationType.NONE);
@@ -40,18 +39,6 @@ public class TechnobeeServiceInstallerApplication implements CommandLineRunner {
}
}
static void disableAccidentalSpringDebug(String[] args) {
boolean debugRequested = Arrays.stream(args)
.anyMatch(argument -> "--debug".equals(argument)
|| "--debug=true".equalsIgnoreCase(argument));
if (!debugRequested && System.getProperty("debug") == null) {
// DEBUG is commonly exported by developer tools with non-boolean
// values. Spring maps it to its own debug switch unless a more
// specific system property is present.
System.setProperty("debug", "false");
}
}
@Override
public void run(String... args) {
boolean cli = Arrays.asList(args).contains("--cli");

View File

@@ -1,7 +1,6 @@
package com.cygnus.installer;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.net.URI;
import java.nio.file.Files;
@@ -109,7 +108,6 @@ class DeploymentWriterTest {
.contains("MATRIX_IMAGE=\"registry.example.com/matrix:1.0.0\"")
.contains("MATRIX_DB_URL=\"jdbc:postgresql://db:5432/matrix\"")
.contains("REDIS_HOST=\"redis\"")
.contains("REDIS_DATABASE=\"1\"")
.contains("CYGNUS_CLOUD_BASE_URL=\"http://host.docker.internal:8090\"")
.contains("CYGNUS_TOKEN_URL=\"http://host.docker.internal:8090/oauth2/token\"")
.contains("CYGNUS_CLIENT_ID=\"matrix-client\"")
@@ -123,84 +121,4 @@ class DeploymentWriterTest {
assertThat(output.resolve("config/keys/client-signing-private.pem"))
.isRegularFile();
}
@Test
void refusesToOverwriteCloudServiceConfiguration() throws Exception {
Path cloudConfig = temporaryDirectory.resolve("config");
Path cloudKeys = cloudConfig.resolve("keys");
Files.createDirectories(cloudKeys);
Path assertionPublic = cloudKeys.resolve("assertion-decryption-public.pem");
Path loginPublic = cloudKeys.resolve("login-public.pem");
Files.writeString(assertionPublic, "assertion-public-key");
Files.writeString(loginPublic, "login-public-key");
var profile = new ProductProfile(
"matrix",
"Matrix",
"matrix-onprem",
"MATRIX_IMAGE",
"matrix",
"installation.yml",
"MATRIX_INSTALLATION_CONFIG",
"/srv/matrix/config/installation.yml",
"8080:8080",
"/matrix/",
"/oauth2/token",
assertionPublic,
loginPublic,
"cygnus-login-2026-01",
List.of());
assertThatThrownBy(() -> new DeploymentWriter().write(
temporaryDirectory,
UUID.randomUUID(),
"primary",
"matrix-client",
new ActivationDtos.ValidationResponse(
"activation-token",
OffsetDateTime.now().plusMinutes(5),
UUID.randomUUID(),
"matrix-client",
"FULL",
2),
new ActivationDtos.RegistrationResponse(
UUID.randomUUID(),
UUID.randomUUID(),
UUID.randomUUID(),
null,
"primary",
1,
"ACTIVE"),
new InstallationKeyService().generate(),
"assertion",
new InstallerSettings(
"matrix",
URI.create("https://cloud.example.com"),
URI.create("https://cloud.example.com"),
"/api/v1/installations",
"production",
temporaryDirectory,
temporaryDirectory,
"1",
new IniDocument(Map.of())),
profile,
"registry.example.com/matrix:1.0.0",
Map.of(),
new RuntimeConfiguration(
"https://cloud.example.com",
"jdbc:postgresql://db/matrix",
"postgres",
"secret",
"redis",
"7901",
"secret",
false,
"PT10S",
"PT30S")))
.isInstanceOf(IllegalArgumentException.class)
.hasMessageContaining("cloud-service configuration");
assertThat(assertionPublic).hasContent("assertion-public-key");
assertThat(loginPublic).hasContent("login-public-key");
}
}

View File

@@ -1,29 +0,0 @@
package com.cygnus.installer;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
class TechnobeeServiceInstallerApplicationTest {
@AfterEach
void clearDebugProperty() {
System.clearProperty("debug");
}
@Test
void disablesDebugUnlessExplicitlyRequested() {
TechnobeeServiceInstallerApplication.disableAccidentalSpringDebug(new String[0]);
assertThat(System.getProperty("debug")).isEqualTo("false");
}
@Test
void preservesExplicitDebugRequest() {
TechnobeeServiceInstallerApplication.disableAccidentalSpringDebug(
new String[] {"--debug"});
assertThat(System.getProperty("debug")).isNull();
}
}

View File

@@ -0,0 +1,12 @@
spring:
main:
banner-mode: "off"
application:
name: technobee-service-installer
technobee:
installer:
config: ${TECHNOBEE_INSTALLER_CONFIG:./installer.ini}
version: ${TECHNOBEE_INSTALLER_VERSION:1.0.0}
logging:
level:
root: WARN

View File

@@ -0,0 +1,3 @@
artifactId=technobee-service-installer
groupId=com.cygnus
version=1.0.0-SNAPSHOT

View File

@@ -0,0 +1,36 @@
com/cygnus/installer/MachineAssertionService.class
com/cygnus/installer/ActivationDtos$ValidationResponse.class
com/cygnus/installer/SwingInstallationWizard$2.class
com/cygnus/installer/CommandResult.class
com/cygnus/installer/InstallationProgressListener.class
com/cygnus/installer/ProductProfileRegistry.class
com/cygnus/installer/InstallationRequest.class
com/cygnus/installer/InstallerConfiguration.class
com/cygnus/installer/ProductProfile.class
com/cygnus/installer/InstallationWizard.class
com/cygnus/installer/TechnobeeServiceInstallerApplication.class
com/cygnus/installer/DeploymentWriter.class
com/cygnus/installer/InstallationKeyService.class
com/cygnus/installer/DockerComposeDeploymentService.class
com/cygnus/installer/ActivationClient.class
com/cygnus/installer/ActivationDtos$RegistrationResponse.class
com/cygnus/installer/IniDocument.class
com/cygnus/installer/SwingInstallationWizard$3.class
com/cygnus/installer/InstallerConfigurationException.class
com/cygnus/installer/DockerRegistryLoginService.class
com/cygnus/installer/SwingInstallationWizard.class
com/cygnus/installer/ActivationDtos.class
com/cygnus/installer/DockerPrerequisiteChecker.class
com/cygnus/installer/InstallerBootstrapProperties.class
com/cygnus/installer/SwingInstallationWizard$1.class
com/cygnus/installer/CommandExecutor.class
com/cygnus/installer/IniConfigurationLoader.class
com/cygnus/installer/InstallationService.class
com/cygnus/installer/InstallationResult.class
com/cygnus/installer/RuntimeConfiguration.class
com/cygnus/installer/ActivationDtos$RegistrationRequest.class
com/cygnus/installer/ActivationDtos$ValidationRequest.class
com/cygnus/installer/PrerequisiteException.class
com/cygnus/installer/InstallerSettings.class
com/cygnus/installer/InstallationKeyPair.class
com/cygnus/installer/SwingInstallationWizard$ProgressUpdate.class

View File

@@ -0,0 +1,28 @@
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/ActivationClient.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/ActivationDtos.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/CommandExecutor.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/CommandResult.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/DeploymentWriter.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/DockerComposeDeploymentService.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/DockerPrerequisiteChecker.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/DockerRegistryLoginService.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/IniConfigurationLoader.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/IniDocument.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/InstallationKeyPair.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/InstallationKeyService.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/InstallationProgressListener.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/InstallationRequest.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/InstallationResult.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/InstallationService.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/InstallationWizard.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/InstallerBootstrapProperties.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/InstallerConfiguration.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/InstallerConfigurationException.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/InstallerSettings.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/MachineAssertionService.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/PrerequisiteException.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/ProductProfile.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/ProductProfileRegistry.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/RuntimeConfiguration.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/SwingInstallationWizard.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/main/java/com/cygnus/installer/TechnobeeServiceInstallerApplication.java

View File

@@ -0,0 +1,11 @@
com/cygnus/installer/MachineAssertionServiceTest.class
com/cygnus/installer/DockerRegistryLoginServiceTest$CapturingExecutor.class
com/cygnus/installer/DockerRegistryLoginServiceTest.class
com/cygnus/installer/DockerComposeDeploymentServiceTest$CapturingExecutor.class
com/cygnus/installer/InstallationServiceTest.class
com/cygnus/installer/DockerPrerequisiteCheckerTest$1.class
com/cygnus/installer/ProductProfileRegistryTest.class
com/cygnus/installer/IniConfigurationLoaderTest.class
com/cygnus/installer/DockerComposeDeploymentServiceTest.class
com/cygnus/installer/DeploymentWriterTest.class
com/cygnus/installer/DockerPrerequisiteCheckerTest.class

View File

@@ -0,0 +1,8 @@
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/test/java/com/cygnus/installer/DeploymentWriterTest.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/test/java/com/cygnus/installer/DockerComposeDeploymentServiceTest.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/test/java/com/cygnus/installer/DockerPrerequisiteCheckerTest.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/test/java/com/cygnus/installer/DockerRegistryLoginServiceTest.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/test/java/com/cygnus/installer/IniConfigurationLoaderTest.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/test/java/com/cygnus/installer/InstallationServiceTest.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/test/java/com/cygnus/installer/MachineAssertionServiceTest.java
/Users/maddy/Projects/cygnus/matrix/cygnus-installer/src/test/java/com/cygnus/installer/ProductProfileRegistryTest.java

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: com.cygnus.installer.DeploymentWriterTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.174 s -- in com.cygnus.installer.DeploymentWriterTest

View File

@@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: com.cygnus.installer.DockerComposeDeploymentServiceTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 s -- in com.cygnus.installer.DockerComposeDeploymentServiceTest

View File

@@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: com.cygnus.installer.DockerPrerequisiteCheckerTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 s -- in com.cygnus.installer.DockerPrerequisiteCheckerTest

View File

@@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: com.cygnus.installer.DockerRegistryLoginServiceTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.010 s -- in com.cygnus.installer.DockerRegistryLoginServiceTest

View File

@@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: com.cygnus.installer.IniConfigurationLoaderTest
-------------------------------------------------------------------------------
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.008 s -- in com.cygnus.installer.IniConfigurationLoaderTest

View File

@@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: com.cygnus.installer.InstallationServiceTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 s -- in com.cygnus.installer.InstallationServiceTest

View File

@@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: com.cygnus.installer.MachineAssertionServiceTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.570 s -- in com.cygnus.installer.MachineAssertionServiceTest

View File

@@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: com.cygnus.installer.ProductProfileRegistryTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 s -- in com.cygnus.installer.ProductProfileRegistryTest

Some files were not shown because too many files have changed in this diff Show More