Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 428ffdc5 authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

Fix unit test

parent 138fcc1b
No related branches found
No related tags found
No related merge requests found
......@@ -3,11 +3,12 @@
<form [formGroup]="domainForm">
<mat-card>
<mat-card-title>Domain properties</mat-card-title>
<mat-card-content >
<mat-card-content>
<fieldset style="border: none;">
<mat-form-field style="width:100%">
<input matInput placeholder="Domain Code" name="domainCode"
id="domainCode_id"
matTooltip="The SMP's domain code. The code is used in HTTP header 'Domain' when adding service group using the webservice API"
[formControl]="domainForm.controls['domainCode']" maxlength="63" required>
<mat-hint align="end">For WS API integration: the Domain property</mat-hint>
<div
......@@ -23,9 +24,10 @@
</mat-form-field>
<mat-form-field style="width:100%">
<input matInput placeholder="SML domain"
matTooltip="The domain-specific part of the SML DNS zone (e.g., ‘mydomain’ for mydomain.sml.dns.zone or leave empty for sml.dns.zone). Note: has informative value only, SML DNS zone used for publishing is based on SML configuration."
name="smlSubdomain" id="smldomain_id"
[formControl]="domainForm.controls['smlSubdomain']" maxlength="63" >
<mat-hint align="end">The domain-specific part of the SML DNS zone (e.g., ‘mydomain’ for mydomain.sml.dns.zone or leave empty for sml.dns.zone). Note: informative value.</mat-hint>
[formControl]="domainForm.controls['smlSubdomain']" maxlength="63">
<mat-hint align="end">The domain-specific part of the SML DNS zone (e.g., ‘mydomain’ for mydomain.sml.dns.zone).</mat-hint>
<div
*ngIf="(!editMode && domainForm.controls['smlSubdomain'].touched || editMode)
&& domainForm.controls['smlSubdomain'].hasError('pattern')"
......@@ -54,7 +56,8 @@
{{cert.alias}} ({{cert.certificateId}})
</mat-option>
</mat-select>
<mat-hint align="end">Empty value will cause that ServiceMetadata response will not be signed by SMP!</mat-hint>
<mat-hint align="end">Empty value will cause that ServiceMetadata response will not be signed by SMP!
</mat-hint>
</mat-form-field>
</fieldset>
</mat-card-content>
......@@ -64,7 +67,8 @@
<mat-card-content>
<fieldset style="border: none;">
<mat-form-field style="width:100%">
<input matInput placeholder="SML SMP identifier" name="smlSmpId" id="smlSMPId_id"
<input matInput placeholder="SML SMP identifier" name="smlSmpId"
id="smlSMPId_id"
[formControl]="domainForm.controls['smlSmpId']" maxlength="63">
<mat-hint align="end">SMP ID used for SML</mat-hint>
<div
......@@ -80,7 +84,8 @@
</div>
</mat-form-field>
<mat-form-field style="width:100%" matTooltip="Client Certificate used for SML authentication. The SML Client-Cert http Header is also generated from the certificate">
<mat-form-field style="width:100%"
matTooltip="Client Certificate used for SML authentication. The SML Client-Cert http Header is also generated from the certificate">
<mat-select [(value)]="selectedSMLCert"
placeholder="SML ClientCert Alias"
......@@ -94,7 +99,8 @@
</mat-select>
</mat-form-field>
<mat-form-field style="width:100%" matTooltip="SML Client-Cert http Header used for SML authentication. The header is generated from chosen SML ClientCert Alias">
<mat-form-field style="width:100%"
matTooltip="SML Client-Cert http Header used for SML authentication. The header is generated from chosen SML ClientCert Alias">
<input matInput placeholder="SML ClientCert Header" name="Client certificate" id="smlClientHeader_id"
[value]="selectedSMLCert?.blueCoatHeader" maxlength="2000" readonly="true">
</mat-form-field>
......
......@@ -133,8 +133,10 @@ public class ConfigurationService {
return (List<String>) configurationDAO.getCachedPropertyValue(CS_PARTICIPANTS);
}
public Boolean getParticipantSchemeMandatory() {
return (Boolean) configurationDAO.getCachedPropertyValue(PARTC_SCH_MANDATORY);
public boolean getParticipantSchemeMandatory() {
// not mandatory by default
Boolean value = (Boolean) configurationDAO.getCachedPropertyValue(PARTC_SCH_MANDATORY);
return value != null && value;
}
public boolean isProxyEnabled() {
......
......@@ -15,6 +15,8 @@ package eu.europa.ec.edelivery.smp.validation;
import eu.europa.ec.edelivery.smp.conversion.CaseSensitivityNormalizer;
import eu.europa.ec.edelivery.smp.error.exceptions.BadRequestException;
import eu.europa.ec.edelivery.smp.logging.SMPLogger;
import eu.europa.ec.edelivery.smp.logging.SMPLoggerFactory;
import eu.europa.ec.edelivery.smp.services.ConfigurationService;
import eu.europa.ec.smp.api.Identifiers;
import org.oasis_open.docs.bdxr.ns.smp._2016._05.ParticipantIdentifierType;
......@@ -33,7 +35,7 @@ import static org.springframework.util.CollectionUtils.isEmpty;
*/
@Component
public class ServiceGroupValidator {
private static final SMPLogger LOG = SMPLoggerFactory.getLogger(ServiceGroupValidator.class);
protected final ConfigurationService configurationService;
protected final CaseSensitivityNormalizer caseSensitivityNormalizer;
......@@ -45,9 +47,10 @@ public class ServiceGroupValidator {
}
public void validate(String serviceGroupId, ServiceGroup serviceGroup) {
boolean schemeMandatory = configurationService.getParticipantSchemeMandatory();
LOG.debug("Parse service group [{}] with [{}] scheme", serviceGroupId, (schemeMandatory?"mandatory":"optional"));
final ParticipantIdentifierType participantId = caseSensitivityNormalizer.normalize(
Identifiers.asParticipantId(serviceGroupId, configurationService.getParticipantSchemeMandatory()));
final ParticipantIdentifierType participantId = caseSensitivityNormalizer.normalize(Identifiers.asParticipantId(serviceGroupId, schemeMandatory));
final ParticipantIdentifierType serviceGroupParticipantId = caseSensitivityNormalizer.normalize(
serviceGroup.getParticipantIdentifier());
......
......@@ -98,7 +98,7 @@ public class ServiceGroupControllerTest {
public void setup() throws IOException {
forwardedHeaderTransformer.setRemoveOnly(false);
configurationDao.setPropertyToDatabase(SMPPropertyEnum.EXTERNAL_TLS_AUTHENTICATION_CLIENT_CERT_HEADER_ENABLED, "true", null);
configurationDao.setPropertyToDatabase(SMPPropertyEnum.PARTC_SCH_MANDATORY, "true", null);
configurationDao.setPropertyToDatabase(SMPPropertyEnum.PARTC_SCH_MANDATORY, "false", null);
X509CertificateTestUtils.reloadKeystores();
mvc = MockMvcUtils.initializeMockMvc(webAppContext);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment