diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/SmlIdentifierConverter.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/SmlIdentifierConverter.java
index e65e73ef1feec070de0adeaef461dc4286e76dff..67e76057b5c64ce162e1a3f1ec15f0292a2d9e4e 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/SmlIdentifierConverter.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/SmlIdentifierConverter.java
@@ -19,9 +19,11 @@
 
 package eu.europa.ec.edelivery.smp.conversion;
 
+import ec.services.wsdl.bdmsl.data._1.ParticipantsType;
 import ec.services.wsdl.bdmsl.data._1.SMPAdvancedServiceForParticipantType;
 import eu.europa.ec.edelivery.smp.identifiers.Identifier;
 import org.busdox.servicemetadata.locator._1.ServiceMetadataPublisherServiceForParticipantType;
+import org.busdox.transport.identifiers._1.ParticipantIdentifierType;
 
 import static org.apache.commons.lang3.StringUtils.isBlank;
 
@@ -31,36 +33,53 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
 public class SmlIdentifierConverter {
 
     public static ServiceMetadataPublisherServiceForParticipantType toBusdoxParticipantId(Identifier participantId, String smpId) {
-        if (isBlank(smpId)) {
-            throw new IllegalStateException("SMP ID is null or empty");
-        }
-        if (participantId == null || isBlank(participantId.getValue())) {
-            throw new IllegalStateException("Participant Scheme or Id is null or empty");
-        }
+        validate(participantId, smpId);
+
+        ParticipantIdentifierType parId = toParticipantIdentifierType(participantId);
 
         ServiceMetadataPublisherServiceForParticipantType busdoxIdentifier = new ServiceMetadataPublisherServiceForParticipantType();
         busdoxIdentifier.setServiceMetadataPublisherID(smpId);
-        org.busdox.transport.identifiers._1.ParticipantIdentifierType parId = new org.busdox.transport.identifiers._1.ParticipantIdentifierType();
-        parId.setScheme(participantId.getScheme());
-        parId.setValue(participantId.getValue());
         busdoxIdentifier.setParticipantIdentifier(parId);
         return busdoxIdentifier;
     }
 
+    public static ParticipantsType toParticipantsType(Identifier participantId, String smpId) {
+        validate(participantId, smpId);
+
+        ParticipantIdentifierType parId = toParticipantIdentifierType(participantId);
+
+        ParticipantsType participantsType = new ParticipantsType();
+        participantsType.setParticipantIdentifier(parId);
+        participantsType.setServiceMetadataPublisherID(smpId);
+        return participantsType;
+    }
+
 
     public static SMPAdvancedServiceForParticipantType toBDMSLAdvancedParticipantId(Identifier participantId, String smpId, String serviceMetadata) {
+        validate(participantId, smpId);
+
+        ServiceMetadataPublisherServiceForParticipantType busdoxIdentifier = toBusdoxParticipantId(participantId, smpId);
+
+        SMPAdvancedServiceForParticipantType bdmslRequest = new SMPAdvancedServiceForParticipantType();
+        bdmslRequest.setServiceName(serviceMetadata);
+        bdmslRequest.setCreateParticipantIdentifier(busdoxIdentifier);
+
+        return bdmslRequest;
+    }
+
+    protected static void validate(Identifier participantId, String smpId) {
         if (isBlank(smpId)) {
             throw new IllegalStateException("SMP ID is null or empty");
         }
         if (participantId == null || isBlank(participantId.getValue())) {
             throw new IllegalStateException("Participant Scheme or Id is null or empty");
         }
+    }
 
-        SMPAdvancedServiceForParticipantType bdmslRequest = new SMPAdvancedServiceForParticipantType();
-        bdmslRequest.setServiceName(serviceMetadata);
-
-        ServiceMetadataPublisherServiceForParticipantType bdxlRequest = toBusdoxParticipantId(participantId, smpId);
-        bdmslRequest.setCreateParticipantIdentifier(bdxlRequest);
-        return bdmslRequest;
+    private static ParticipantIdentifierType toParticipantIdentifierType(Identifier participantId) {
+        ParticipantIdentifierType parId = new ParticipantIdentifierType();
+        parId.setScheme(participantId.getScheme());
+        parId.setValue(participantId.getValue());
+        return parId;
     }
 }
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/exceptions/ErrorCode.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/exceptions/ErrorCode.java
index 776116f9ca171559919eb5cc300fd99f86866303..6efe2bb616bb7ce01f185f0c67398ceb794f7fe5 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/exceptions/ErrorCode.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/exceptions/ErrorCode.java
@@ -75,7 +75,7 @@ public enum ErrorCode {
     ILLEGAL_STATE_SMD_ON_MULTIPLE_SGD (500,"SMP:144",ErrorBusinessCode.TECHNICAL,"Found than one service group domain for metadata id [%s] and user id [%s]!"),
 
     // SML integration
-    SML_INTEGRATION_EXCEPTION (500,"SMP:150",ErrorBusinessCode.TECHNICAL,"Could not create new DNS entry through SML! Error: %s "),
+    SML_INTEGRATION_EXCEPTION (500,"SMP:150",ErrorBusinessCode.TECHNICAL,"SML integration error! Error: %s "),
     //
     XML_SIGNING_EXCEPTION (500,"SMP:500",ErrorBusinessCode.TECHNICAL,"Error occurred while signing response!"),
     JAXB_INITIALIZATION (500,"SMP:511",ErrorBusinessCode.TECHNICAL, "Could not create Unmarshaller for class [%s]!"),
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/DomainService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/DomainService.java
index b36bafe1ea4c39527b17fadd26593400324421eb..19d2900c97232ccacfd59aa6587b5a54e4483b87 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/DomainService.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/DomainService.java
@@ -94,8 +94,8 @@ public class DomainService {
     }
 
     /**
-     * If domain is not yet registered and sml integration is on. Than it tries to register domain and  all participants
-     * on that domain. If integration is off it return an configuration exception.
+     * If domain is not yet registered and SML integration is on, it tries to register a domain and all participants
+     * on that domain. If integration is off, it returns a configuration exception.
      * <p>
      * Method is not in transaction - but sub-methods are. if registering domain or particular serviceGroup succeed
      * then the database flag (SML_REGISTERED) is turned on ( if method fails
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/SMLIntegrationService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/SMLIntegrationService.java
index c97bfb50a1bab120fb966934ae3f40a216a5c68b..a3bf40b54c157e124fd353efc99d936056872434 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/SMLIntegrationService.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/SMLIntegrationService.java
@@ -65,6 +65,22 @@ public class SMLIntegrationService {
     @Autowired
     private IdentifierService identifierService;
 
+    /**
+     * Checks whether the participant exists in SML or not.
+     *
+     * @param resource the resource entity
+     * @param domain the domain entity
+     * @return {@code true} if the participant exists in SML; otherwise, {@code false} (also when SML integration is disabled).
+     */
+    public boolean participantExists(DBResource resource, DBDomain domain) {
+        if (!isSMLIntegrationEnabled()) {
+            throw new SMPRuntimeException(CONFIGURATION_ERROR, ERROR_MESSAGE_DNS_NOT_ENABLED);
+        }
+        Identifier normalizedParticipantId = identifierService
+                .normalizeParticipant(resource.getIdentifierScheme(), resource.getIdentifierValue());
+
+        return smlConnector.participantExists(normalizedParticipantId, domain);
+    }
 
     /**
      * Method in transaction update domain status and registers domain to SML.
@@ -82,6 +98,19 @@ public class SMLIntegrationService {
         smlConnector.registerDomain(domain);
     }
 
+    /**
+     * Checks whether the domain is valid by trying to read it from SML.
+     *
+     * @param domain the domain entity to verify whether it's valid or not.
+     *
+     * @return {@code true} if the domain can be successfully read from SML; otherwise, {@code false} (also when SML integration is disabled).
+     */
+    public boolean isDomainValid(DBDomain domain) {
+        if (!isSMLIntegrationEnabled()) {
+            throw new SMPRuntimeException(CONFIGURATION_ERROR, ERROR_MESSAGE_DNS_NOT_ENABLED);
+        }
+        return smlConnector.isDomainValid(domain);
+    }
 
     /**
      * Method in transaction update domain status and registers domain to SML.
@@ -171,7 +200,7 @@ public class SMLIntegrationService {
             return;
         }
 
-        // unregister only  registered participants
+        // unregister only registered participants
         if (resource.isSmlRegistered()) {
             // update value
             resource.setSmlRegistered(false);
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainService.java
index 699aa2afbfb7503413ee2ef1a21a713bdc17053e..2ea8bf73d9f016fcf17623c0536b41612947e7ea 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainService.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainService.java
@@ -35,6 +35,7 @@ import eu.europa.ec.edelivery.smp.exceptions.ErrorCode;
 import eu.europa.ec.edelivery.smp.exceptions.SMPRuntimeException;
 import eu.europa.ec.edelivery.smp.logging.SMPLogger;
 import eu.europa.ec.edelivery.smp.logging.SMPLoggerFactory;
+import eu.europa.ec.edelivery.smp.services.SMLIntegrationService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.core.convert.ConversionService;
 import org.springframework.stereotype.Service;
@@ -64,7 +65,7 @@ public class UIDomainService extends UIServiceBase<DBDomain, DomainRO> {
     private final ConversionService conversionService;
     private final GroupDao groupDao;
     private final GroupMemberDao groupMemberDao;
-
+    private final SMLIntegrationService smlIntegrationService;
 
     public UIDomainService(ConversionService conversionService,
                            DomainDao domainDao,
@@ -73,7 +74,8 @@ public class UIDomainService extends UIServiceBase<DBDomain, DomainRO> {
                            ResourceDefDao resourceDefDao,
                            DomainResourceDefDao domainResourceDefDao,
                            GroupDao groupDao,
-                           GroupMemberDao groupMemberDao) {
+                           GroupMemberDao groupMemberDao,
+                           SMLIntegrationService smlIntegrationService) {
         this.conversionService = conversionService;
         this.domainDao = domainDao;
         this.resourceDao = resourceDao;
@@ -82,6 +84,7 @@ public class UIDomainService extends UIServiceBase<DBDomain, DomainRO> {
         this.domainMemberDao = domainMemberDao;
         this.groupDao = groupDao;
         this.groupMemberDao = groupMemberDao;
+        this.smlIntegrationService = smlIntegrationService;
     }
 
     @Override
@@ -175,6 +178,12 @@ public class UIDomainService extends UIServiceBase<DBDomain, DomainRO> {
         domain.setSmlSmpId(StringUtils.trim(data.getSmlSmpId()));
         domain.setSmlClientKeyAlias(data.getSmlClientKeyAlias());
         domain.setSmlClientCertAuth(data.isSmlClientCertAuth());
+
+        // if registered, validate the updated domain to ensure its SML integration certificate is valid
+        if(domain.isSmlRegistered() && !smlIntegrationService.isDomainValid(domain)) {
+            String msg = "The SML-SMP certificate for domain [" + domain.getDomainCode() + "] is not valid!";
+            throw new BadRequestException(ErrorBusinessCode.NOT_FOUND, msg);
+        }
     }
 
     @Transactional
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/sml/SmlConnector.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/sml/SmlConnector.java
index 269fdc29cbb5ba34a78377e997c00e435b6b3a1d..fbcdd429a374afb02efa1968e2b50199c5d7c852 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/sml/SmlConnector.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/sml/SmlConnector.java
@@ -19,6 +19,8 @@
 
 package eu.europa.ec.edelivery.smp.sml;
 
+import ec.services.wsdl.bdmsl.data._1.ExistsParticipantResponseType;
+import ec.services.wsdl.bdmsl.data._1.ParticipantsType;
 import ec.services.wsdl.bdmsl.data._1.SMPAdvancedServiceForParticipantType;
 import eu.europa.ec.bdmsl.ws.soap.*;
 import eu.europa.ec.edelivery.smp.config.enums.SMPPropertyEnum;
@@ -61,8 +63,7 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.*;
 
-import static eu.europa.ec.edelivery.smp.conversion.SmlIdentifierConverter.toBDMSLAdvancedParticipantId;
-import static eu.europa.ec.edelivery.smp.conversion.SmlIdentifierConverter.toBusdoxParticipantId;
+import static eu.europa.ec.edelivery.smp.conversion.SmlIdentifierConverter.*;
 import static eu.europa.ec.edelivery.smp.exceptions.SMLErrorMessages.*;
 
 /**
@@ -97,10 +98,7 @@ public class SmlConnector implements ApplicationContextAware {
 
     private ApplicationContext ctx;
 
-
     public boolean registerInDns(Identifier normalizedParticipantId, DBDomain domain, String customNaptrService) {
-
-
         if (!configurationService.isSMLIntegrationEnabled()) {
             return false;
         }
@@ -131,27 +129,52 @@ public class SmlConnector implements ApplicationContextAware {
         }
     }
 
+    /**
+     * Checks whether the participant identified by the provided ID exists or not. In case the integration with SML is
+     * disabled, it returns {@code false}.
+     *
+     * @param normalizedParticipantId the participant ID
+     * @param domain the domain entity
+     * @return {@code true} if the participant exists; otherwise, {@code false} (also when SML integration is disabled).
+     */
+    public boolean participantExists(Identifier normalizedParticipantId, DBDomain domain) {
+        if (!configurationService.isSMLIntegrationEnabled()) {
+            return false;
+        }
+
+        String normalizedParticipantString = identifierService.formatParticipant(normalizedParticipantId);
+        if (!domain.isSmlRegistered()) {
+            LOG.info("Cannot check if Participant {} exists when domain {} is not registered!",
+                    normalizedParticipantString, domain.getDomainCode());
+            return false;
+        }
+
+        LOG.debug("Checking if Participant: {} exists in domain: {}.", normalizedParticipantString, domain.getDomainCode());
+        try {
+            ParticipantsType smlRequest = toParticipantsType(normalizedParticipantId, domain.getSmlSmpId());
+            ExistsParticipantResponseType existsParticipantResponseType = getBDMSLWSClient(domain).existsParticipantIdentifier(smlRequest);
+            return existsParticipantResponseType.isExist();
+        } catch (BadRequestFault | NotFoundFault e) {
+            return processSMLErrorMessage(e, normalizedParticipantId);
+        } catch (Exception e) {
+            LOG.error(e.getClass().getName() + e.getMessage(), e);
+            throw new SMPRuntimeException(ErrorCode.SML_INTEGRATION_EXCEPTION, e, ExceptionUtils.getRootCauseMessage(e));
+        }
+    }
+
     protected void createRegularDNSRecord(Identifier normalizedParticipantId, DBDomain domain) throws UnauthorizedFault, BadRequestFault, NotFoundFault, InternalErrorFault {
         LOG.debug("Set regular DNS record for Participant: [{}] and domain: [{}].", normalizedParticipantId, domain.getDomainCode());
         ServiceMetadataPublisherServiceForParticipantType smlRequest = toBusdoxParticipantId(normalizedParticipantId, domain.getSmlSmpId());
         getParticipantWSClient(domain).create(smlRequest);
     }
+
     protected void createCustomServiceNaptrDNSRecord(Identifier normalizedParticipantId, DBDomain domain, String customNaptrService) throws UnauthorizedFault, BadRequestFault, NotFoundFault, InternalErrorFault {
         LOG.debug("Set custom naptr service [{}] DNS record for Participant: [{}] and domain: [{}].", customNaptrService, normalizedParticipantId, domain.getDomainCode());
         SMPAdvancedServiceForParticipantType smlRequest = toBDMSLAdvancedParticipantId(normalizedParticipantId, domain.getSmlSmpId(), customNaptrService);
         getBDMSLWSClient(domain).createParticipantIdentifier(smlRequest);
     }
 
-    protected boolean processSMLErrorMessage(BadRequestFault e, Identifier participantIdentifierType) {
-        if (!isOkMessage(participantIdentifierType, e.getMessage())) {
-            LOG.error(e.getMessage(), e);
-            throw new SMPRuntimeException(ErrorCode.SML_INTEGRATION_EXCEPTION, e, ExceptionUtils.getRootCauseMessage(e));
-        }
-        LOG.warn(e.getMessage(), e);
-        return true;
-    }
-
-    protected boolean processSMLErrorMessage(NotFoundFault e, Identifier participantIdentifierType) {
+    protected boolean processSMLErrorMessage(Exception e, Identifier participantIdentifierType) {
         if (!isOkMessage(participantIdentifierType, e.getMessage())) {
             LOG.error(e.getMessage(), e);
             throw new SMPRuntimeException(ErrorCode.SML_INTEGRATION_EXCEPTION, e, ExceptionUtils.getRootCauseMessage(e));
@@ -182,19 +205,13 @@ public class SmlConnector implements ApplicationContextAware {
      * @return
      */
     public boolean registerDomain(DBDomain domain) {
-
         if (!configurationService.isSMLIntegrationEnabled()) {
             return false;
         }
-        String smpLogicalAddress = configurationService.getSMLIntegrationSMPLogicalAddress();
-        String smpPhysicalAddress = configurationService.getSMLIntegrationSMPPhysicalAddress();
-        LOG.info("Registering new Domain  to SML: (smpCode {} smp-smp-id {}) ", domain.getDomainCode(), domain.getSmlSmpId());
+        String smlSmpId = domain.getSmlSmpId();
+        LOG.info("Registering new Domain to SML: (smpCode {} smp-smp-id {}) ", domain.getDomainCode(), smlSmpId);
         try {
-            ServiceMetadataPublisherServiceType smlSmpRequest = new ServiceMetadataPublisherServiceType();
-            smlSmpRequest.setPublisherEndpoint(new PublisherEndpointType());
-            smlSmpRequest.getPublisherEndpoint().setLogicalAddress(smpLogicalAddress);
-            smlSmpRequest.getPublisherEndpoint().setPhysicalAddress(smpPhysicalAddress);
-            smlSmpRequest.setServiceMetadataPublisherID(domain.getSmlSmpId());
+            ServiceMetadataPublisherServiceType smlSmpRequest = getServiceMetadataPublisherServiceType(smlSmpId);
             getSMPManagerWSClient(domain).create(smlSmpRequest);
         } catch (BadRequestFault e) {
             processSMLErrorMessage(e, domain);
@@ -206,15 +223,45 @@ public class SmlConnector implements ApplicationContextAware {
         return true;
     }
 
-    private void processSMLErrorMessage(BadRequestFault e, DBDomain domain) {
-        if (!isOkMessage(domain, e.getMessage())) {
-            LOG.error(e.getMessage(), e);
+    /**
+     * Checks whether a domain is valid or not. In case the integration with SML is disabled, it returns {@code false}.
+     *
+     * @param domain the domain entity
+     * @return {@code true} if the domain exists and is valid; otherwise, {@code false} (also when SML integration is disabled).
+     */
+    public boolean isDomainValid(DBDomain domain) {
+        if (!configurationService.isSMLIntegrationEnabled()) {
+            return false;
+        }
+        String smlSmpId = domain.getSmlSmpId();
+        LOG.info("Validating Domain to SML: (smpCode {} smp-smp-id {}) ", domain.getDomainCode(), smlSmpId);
+        try {
+            ServiceMetadataPublisherServiceType smlSmpRequest = getServiceMetadataPublisherServiceType(smlSmpId);
+            getSMPManagerWSClient(domain).read(smlSmpRequest);
+        } catch (BadRequestFault | NotFoundFault e) {
+            processSMLErrorMessage(e, domain);
+        } catch (Exception e) {
+            LOG.error(e.getClass().getName() + e.getMessage(), e);
             throw new SMPRuntimeException(ErrorCode.SML_INTEGRATION_EXCEPTION, e, ExceptionUtils.getRootCauseMessage(e));
         }
-        LOG.warn(e.getMessage(), e);
+        // if not error is thrown - the domain exists and is valid
+        return true;
     }
 
-    private void processSMLErrorMessage(NotFoundFault e, DBDomain domain) {
+    private ServiceMetadataPublisherServiceType getServiceMetadataPublisherServiceType(String smlSmpId) {
+        String smpLogicalAddress = configurationService.getSMLIntegrationSMPLogicalAddress();
+        String smpPhysicalAddress = configurationService.getSMLIntegrationSMPPhysicalAddress();
+
+        ServiceMetadataPublisherServiceType smlSmpRequest = new ServiceMetadataPublisherServiceType();
+        smlSmpRequest.setPublisherEndpoint(new PublisherEndpointType());
+        smlSmpRequest.getPublisherEndpoint().setLogicalAddress(smpLogicalAddress);
+        smlSmpRequest.getPublisherEndpoint().setPhysicalAddress(smpPhysicalAddress);
+        smlSmpRequest.setServiceMetadataPublisherID(smlSmpId);
+
+        return smlSmpRequest;
+    }
+
+    private void processSMLErrorMessage(Exception e, DBDomain domain) {
         if (!isOkMessage(domain, e.getMessage())) {
             LOG.error(e.getMessage(), e);
             throw new SMPRuntimeException(ErrorCode.SML_INTEGRATION_EXCEPTION, e, ExceptionUtils.getRootCauseMessage(e));
@@ -303,13 +350,10 @@ public class SmlConnector implements ApplicationContextAware {
     }
 
     private IManageServiceMetadataWS getSMPManagerWSClient(DBDomain domain) {
-
-
         IManageServiceMetadataWS iManageServiceMetadataWS = ctx.getBean(IManageServiceMetadataWS.class);
         // configure value connection
         configureClient(SERVICE_METADATA_CONTEXT, iManageServiceMetadataWS, domain);
 
-
         return iManageServiceMetadataWS;
     }
 
@@ -330,9 +374,7 @@ public class SmlConnector implements ApplicationContextAware {
         return alias;
     }
 
-
     public void configureClient(String serviceEndpoint, Object smlPort, DBDomain domain) {
-
         String clientKeyAlias = getSmlClientKeyAliasForDomain(domain);
         boolean clientCertAuthentication = domain.isSmlClientCertAuth();
         Client client = ClientProxy.getClient(smlPort);
@@ -383,7 +425,6 @@ public class SmlConnector implements ApplicationContextAware {
 
     }
 
-
     public void configureClientAuthentication(HTTPConduit httpConduit, Map<String, Object> requestContext, CertificateRO certificateRO, boolean clientCertAuthentication, boolean useTLS) {
         LOG.info("Connect to SML (smlClientAuthentication: [{}] use Client-CertHeader: [{}])", certificateRO, clientCertAuthentication);
 
diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/config/SmlIntegrationConfiguration.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/config/SmlIntegrationConfiguration.java
deleted file mode 100644
index 317469bc5082d0560420dde0ba66794f477a540c..0000000000000000000000000000000000000000
--- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/config/SmlIntegrationConfiguration.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*-
- * #START_LICENSE#
- * smp-server-library
- * %%
- * Copyright (C) 2017 - 2023 European Commission | eDelivery | DomiSMP
- * %%
- * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European Commission - subsequent
- * versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * 
- * [PROJECT_HOME]\license\eupl-1.2\license.txt or https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
- * 
- * Unless required by applicable law or agreed to in writing, software distributed under the Licence is
- * distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and limitations under the Licence.
- * #END_LICENSE#
- */
-package eu.europa.ec.edelivery.smp.config;
-
-import eu.europa.ec.bdmsl.ws.soap.*;
-import eu.europa.ec.edelivery.smp.data.model.DBDomain;
-import org.mockito.Mockito;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Primary;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import javax.xml.ws.http.HTTPException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.BDDMockito.willThrow;
-import static org.springframework.beans.factory.config.ConfigurableBeanFactory.SCOPE_PROTOTYPE;
-
-
-@Component
-public class SmlIntegrationConfiguration {
-
-    protected DBDomain defaultDomain;
-
-
-    protected List<IManageServiceMetadataWS> smpManagerClientMocks = new ArrayList<>();
-    protected Map<IManageServiceMetadataWS, AuthenticationTestDataHolder> smpManagerClientMocksData = new HashMap<>();
-
-    protected List<IManageParticipantIdentifierWS> smlClientMocks = new ArrayList<>();
-    protected Map<IManageParticipantIdentifierWS, AuthenticationTestDataHolder> smlClientMocksData = new HashMap<>();
-    protected int throwExceptionAfterParticipantCallCount = -1;
-
-    protected Throwable throwException;
-
-    public void reset() {
-        smpManagerClientMocks.clear();
-        smpManagerClientMocksData.clear();
-        smlClientMocks.clear();
-        smlClientMocksData.clear();
-
-
-        defaultDomain = new DBDomain();
-        defaultDomain.setDomainCode("default_domain_id");
-        defaultDomain.setSmlSmpId("SAMPLE-SMP-ID");
-        defaultDomain.setSmlRegistered(false);
-        defaultDomain.setSmlClientCertAuth(false);
-        defaultDomain.setSmlClientKeyAlias("clientAlias");
-        setThrowExceptionAfterParticipantCallCount(-1);
-        setThrowException(null);
-    }
-
-    @Bean("MockIManageServiceMetadataWS")
-    @Primary
-    @Scope(SCOPE_PROTOTYPE)
-    public IManageServiceMetadataWS smpManagerClient() throws BadRequestFault, UnauthorizedFault, InternalErrorFault, NotFoundFault {
-
-
-
-        IManageServiceMetadataWS clientMock = Mockito.mock(IManageServiceMetadataWS.class);
-        if (throwException!= null) {
-            willThrow(throwException).given(clientMock).create(any());
-            willThrow(throwException).given(clientMock).delete(any());
-            willThrow(throwException).given(clientMock).read(any());
-            willThrow(throwException).given(clientMock).update(any());
-        }
-
-        AuthenticationTestDataHolder dh = new AuthenticationTestDataHolder();
-        smpManagerClientMocks.add(clientMock);
-        smpManagerClientMocksData.put(clientMock, dh);
-        return clientMock;
-    }
-
-    @Bean("MockIManageParticipantIdentifierWS")
-    @Scope(SCOPE_PROTOTYPE)
-    @Primary
-    public IManageParticipantIdentifierWS smpParticipantClient() throws UnauthorizedFault, NotFoundFault, InternalErrorFault, BadRequestFault {
-
-
-        if (throwExceptionAfterParticipantCallCount >0 &&  throwExceptionAfterParticipantCallCount  <= smlClientMocks.size()){
-            throw new HTTPException(400);
-        }
-        IManageParticipantIdentifierWS clientMock = Mockito.mock(IManageParticipantIdentifierWS.class);
-        if (throwException!= null) {
-            willThrow(throwException).given(clientMock).create(any());
-            willThrow(throwException).given(clientMock).delete(any());
-            willThrow(throwException).given(clientMock).list(any());
-            willThrow(throwException).given(clientMock).createList(any());
-            willThrow(throwException).given(clientMock).deleteList(any());
-            willThrow(throwException).given(clientMock).migrate(any());
-            willThrow(throwException).given(clientMock).prepareToMigrate(any());
-        }
-
-
-        AuthenticationTestDataHolder dh = new AuthenticationTestDataHolder();
-        smlClientMocks.add(clientMock);
-        smlClientMocksData.put(clientMock, dh);
-        return clientMock;
-    }
-
-    public List<IManageServiceMetadataWS> getSmpManagerClientMocks() {
-        return smpManagerClientMocks;
-    }
-
-    public Map<IManageServiceMetadataWS, AuthenticationTestDataHolder> getSmpManagerClientMocksData() {
-        return smpManagerClientMocksData;
-    }
-
-    public List<IManageParticipantIdentifierWS> getParticipantManagmentClientMocks() {
-        return smlClientMocks;
-    }
-
-    public Map<IManageParticipantIdentifierWS, AuthenticationTestDataHolder> getParticipantManagmentClientMocksData() {
-        return smlClientMocksData;
-    }
-
-    public int getThrowExceptionAfterParticipantCallCount() {
-        return throwExceptionAfterParticipantCallCount;
-    }
-
-    public void setThrowExceptionAfterParticipantCallCount(int throwExceptionAfterParticipantCallCount) {
-        this.throwExceptionAfterParticipantCallCount = throwExceptionAfterParticipantCallCount;
-    }
-
-    public Throwable getThrowException() {
-        return throwException;
-    }
-
-    public void setThrowException(Throwable throwException) {
-        this.throwException = throwException;
-    }
-}
diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/conversion/SmlIdentifierConverterTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/conversion/SmlIdentifierConverterTest.java
index 01d89a775388d08e38f25c5c1ea0c1a5c8dee996..0a6b0663031c65649c52cede9b2b4cee87acd548 100644
--- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/conversion/SmlIdentifierConverterTest.java
+++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/conversion/SmlIdentifierConverterTest.java
@@ -19,6 +19,8 @@
 
 package eu.europa.ec.edelivery.smp.conversion;
 
+import ec.services.wsdl.bdmsl.data._1.ParticipantsType;
+import ec.services.wsdl.bdmsl.data._1.SMPAdvancedServiceForParticipantType;
 import eu.europa.ec.edelivery.smp.identifiers.Identifier;
 import org.busdox.servicemetadata.locator._1.ServiceMetadataPublisherServiceForParticipantType;
 import org.junit.Test;
@@ -31,12 +33,13 @@ import static org.junit.Assert.assertNull;
  */
 public class SmlIdentifierConverterTest {
 
-    public static final String SMP_ID = "SMP-ID";
-    public static final String ID_VALUE = "sample:value";
-    public static final String ID_SCHEME = "sample:scheme";
+    private static final String SMP_ID = "SMP-ID";
+    private static final String ID_VALUE = "sample:value";
+    private static final String ID_SCHEME = "sample:scheme";
+    private static final String SERVICE_NAME = "naptrService";
 
     @Test
-    public void positiveCase() {
+    public void toBusdoxParticipantId() {
         //given
         Identifier participantId = new Identifier(ID_VALUE, ID_SCHEME);
 
@@ -49,22 +52,67 @@ public class SmlIdentifierConverterTest {
         assertEquals(ID_VALUE, result.getParticipantIdentifier().getValue());
     }
 
-    @Test(expected = IllegalStateException.class)
-    public void negativeCaseMissingSmpId() {
+    @Test
+    public void toBusdoxParticipantId_NullScheme() {
+        //given
+        Identifier participantId = new Identifier(ID_VALUE, null);
+
+        //when
+        ServiceMetadataPublisherServiceForParticipantType result = SmlIdentifierConverter.toBusdoxParticipantId(participantId, SMP_ID);
+        //then
+        assertEquals(SMP_ID, result.getServiceMetadataPublisherID());
+        assertNull(result.getParticipantIdentifier().getScheme());
+        assertEquals(ID_VALUE, result.getParticipantIdentifier().getValue());
+    }
+
+    @Test
+    public void toBDMSLAdvancedParticipantId() {
         //given
         Identifier participantId = new Identifier(ID_VALUE, ID_SCHEME);
 
         //when
-        SmlIdentifierConverter.toBusdoxParticipantId(participantId, null);
+        SMPAdvancedServiceForParticipantType result = SmlIdentifierConverter.toBDMSLAdvancedParticipantId(participantId, SMP_ID, SERVICE_NAME);
+
+        //then
+        assertEquals(SERVICE_NAME, result.getServiceName());
+        assertEquals(ID_SCHEME, result.getCreateParticipantIdentifier().getParticipantIdentifier().getScheme());
+        assertEquals(ID_VALUE, result.getCreateParticipantIdentifier().getParticipantIdentifier().getValue());
     }
 
     @Test
-    public void positiveCaseWithNullScheme() {
+    public void toBDMSLAdvancedParticipantId_NullScheme() {
         //given
         Identifier participantId = new Identifier(ID_VALUE, null);
 
         //when
-        ServiceMetadataPublisherServiceForParticipantType result = SmlIdentifierConverter.toBusdoxParticipantId(participantId, SMP_ID);
+        SMPAdvancedServiceForParticipantType result = SmlIdentifierConverter.toBDMSLAdvancedParticipantId(participantId, SMP_ID, SERVICE_NAME);
+        //then
+        assertEquals(SERVICE_NAME, result.getServiceName());
+        assertNull(result.getCreateParticipantIdentifier().getParticipantIdentifier().getScheme());
+        assertEquals(ID_VALUE, result.getCreateParticipantIdentifier().getParticipantIdentifier().getValue());
+    }
+
+    @Test
+    public void toParticipantsType() {
+        //given
+        Identifier participantId = new Identifier(ID_VALUE, ID_SCHEME);
+
+        //when
+        ParticipantsType result = SmlIdentifierConverter.toParticipantsType(participantId, SMP_ID);
+
+        //then
+        assertEquals(SMP_ID, result.getServiceMetadataPublisherID());
+        assertEquals(ID_SCHEME, result.getParticipantIdentifier().getScheme());
+        assertEquals(ID_VALUE, result.getParticipantIdentifier().getValue());
+    }
+
+    @Test
+    public void toParticipantsType_NullScheme() {
+        //given
+        Identifier participantId = new Identifier(ID_VALUE, null);
+
+        //when
+        ParticipantsType result = SmlIdentifierConverter.toParticipantsType(participantId, SMP_ID);
         //then
         assertEquals(SMP_ID, result.getServiceMetadataPublisherID());
         assertNull(result.getParticipantIdentifier().getScheme());
@@ -72,11 +120,20 @@ public class SmlIdentifierConverterTest {
     }
 
     @Test(expected = IllegalStateException.class)
-    public void negativeCaseMissingValue() {
+    public void validate_negativeCaseMissingSmpId() {
+        //given
+        Identifier participantId = new Identifier(ID_VALUE, ID_SCHEME);
+
+        //when
+        SmlIdentifierConverter.validate(participantId, null);
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void validate_negativeCaseMissingValue() {
         //given
         Identifier participantId = new Identifier(null, ID_SCHEME);
 
         //when
-        SmlIdentifierConverter.toBusdoxParticipantId(participantId, SMP_ID);
+        SmlIdentifierConverter.validate(participantId, SMP_ID);
     }
 }
diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/TestUtilsDao.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/TestUtilsDao.java
index 98089cdb48849296299a93a9f6100fe0f4852d58..d03e2d626e239680307cc1120f320426eddb2f4b 100644
--- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/TestUtilsDao.java
+++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/TestUtilsDao.java
@@ -68,6 +68,7 @@ public class TestUtilsDao {
 
     DBDomain d1;
     DBDomain d2;
+    DBDomain d3;
     DBResourceDef resourceDefSmp;
     DBSubresourceDef subresourceDefSmp;
     DBResourceDef resourceDefCpp;
@@ -115,9 +116,10 @@ public class TestUtilsDao {
     /**
      * Database can be cleaned by script before the next test; clean also the objects
      */
-    public void clearData(){
+    public void clearData() {
         d1 = null;
         d2 = null;
+        d3 = null;
         resourceDefSmp = null;
         subresourceDefSmp = null;
         resourceDefCpp = null;
@@ -223,9 +225,11 @@ public class TestUtilsDao {
         }
         d1 = createDomain(TEST_DOMAIN_CODE_1);
         d2 = createDomain(TEST_DOMAIN_CODE_2);
+        d3 = createRegisteredDomain(TEST_DOMAIN_CODE_3);
 
         assertNotNull(d1.getId());
-        assertNotNull(d1.getId());
+        assertNotNull(d2.getId());
+        assertNotNull(d3.getId());
     }
 
     @Transactional
@@ -587,6 +591,14 @@ public class TestUtilsDao {
      return createDomain(domainCode, VisibilityType.PUBLIC);
     }
 
+    @Transactional
+    public DBDomain createRegisteredDomain(String domainCode) {
+        DBDomain d = TestDBUtils.createDBDomain(domainCode);
+        d.setSmlRegistered(true);
+        persistFlushDetach(d);
+        return d;
+    }
+
     @Transactional
     public DBDomain createDomain(String domainCode, VisibilityType visibility) {
         DBDomain d = TestDBUtils.createDBDomain(domainCode);
@@ -654,6 +666,10 @@ public class TestUtilsDao {
         return d2;
     }
 
+    public DBDomain getD3() {
+        return d3;
+    }
+
     public DBResourceDef getResourceDefSmp() {
         return resourceDefSmp;
     }
diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/DomainServiceTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/DomainServiceTest.java
index 391cfa7ca85c2625e3daf4cb55dfb7baf4442641..80989dbefc02ce9d7460cbb181fc243f766c14c0 100644
--- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/DomainServiceTest.java
+++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/DomainServiceTest.java
@@ -19,7 +19,8 @@
 
 package eu.europa.ec.edelivery.smp.services;
 
-import eu.europa.ec.edelivery.smp.config.SmlIntegrationConfiguration;
+import eu.europa.ec.bdmsl.ws.soap.IManageParticipantIdentifierWS;
+import eu.europa.ec.bdmsl.ws.soap.IManageServiceMetadataWS;
 import eu.europa.ec.edelivery.smp.config.enums.SMPPropertyEnum;
 import eu.europa.ec.edelivery.smp.conversion.IdentifierService;
 import eu.europa.ec.edelivery.smp.data.dao.AbstractJunit5BaseDao;
@@ -39,6 +40,7 @@ import org.junit.jupiter.params.provider.NullSource;
 import org.junit.jupiter.params.provider.ValueSource;
 import org.mockito.Mockito;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.mock.mockito.MockBean;
 import org.springframework.test.util.ReflectionTestUtils;
 
 import java.io.IOException;
@@ -59,21 +61,19 @@ import static org.mockito.ArgumentMatchers.any;
 public class DomainServiceTest extends AbstractJunit5BaseDao {
 
     @Autowired
-    IdentifierService identifierService;
+    private IdentifierService identifierService;
     @Autowired
-    SmlIntegrationConfiguration integrationMock;
-    @Autowired
-    SmlConnector smlConnector;
+    private SmlConnector smlConnector;
     @Autowired
     private SMLIntegrationService smlIntegrationService;
-
-
     @Autowired
-    protected DomainDao domainDao;
-
+    private DomainDao domainDao;
     @Autowired
-    protected DomainService testInstance;
-
+    private DomainService testInstance;
+    @MockBean
+    private IManageParticipantIdentifierWS iManageParticipantIdentifierWS;
+    @MockBean
+    private IManageServiceMetadataWS iManageServiceMetadataWS;
 
     @BeforeEach
     public void prepareDatabase() throws IOException {
@@ -91,17 +91,12 @@ public class DomainServiceTest extends AbstractJunit5BaseDao {
         setDatabaseProperty(SMPPropertyEnum.SML_LOGICAL_ADDRESS, "http://localhost/smp");
         setDatabaseProperty(SMPPropertyEnum.SML_URL, "http://localhost/edelivery-sml");
         setDatabaseProperty(SMPPropertyEnum.SML_ENABLED, "true");
-
-        integrationMock.reset();
-
-
     }
 
     @ParameterizedTest
     @NullSource
     @ValueSource(strings = {"", " "})
     public void getDomainForBlankCodeForSingleDomain(String searchCode) {
-
         // given
         DBDomain testDomain01 = testUtilsDao.createDomain(TEST_DOMAIN_CODE_1);
         assertEquals(1, domainDao.getAllDomains().size());
diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/SMLIntegrationServiceNoSMLIntegrationTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/SMLIntegrationServiceNoSMLIntegrationTest.java
deleted file mode 100644
index eb00da8384716268fcbaf8693f0eeb8cf28373c2..0000000000000000000000000000000000000000
--- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/SMLIntegrationServiceNoSMLIntegrationTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*-
- * #START_LICENSE#
- * smp-webapp
- * %%
- * Copyright (C) 2017 - 2023 European Commission | eDelivery | DomiSMP
- * %%
- * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European Commission - subsequent
- * versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * 
- * [PROJECT_HOME]\license\eupl-1.2\license.txt or https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
- * 
- * Unless required by applicable law or agreed to in writing, software distributed under the Licence is
- * distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and limitations under the Licence.
- * #END_LICENSE#
- */
-
-package eu.europa.ec.edelivery.smp.services;
-
-import eu.europa.ec.edelivery.smp.config.enums.SMPPropertyEnum;
-import eu.europa.ec.edelivery.smp.data.model.DBDomain;
-import eu.europa.ec.edelivery.smp.data.model.doc.DBResource;
-import eu.europa.ec.edelivery.smp.exceptions.SMPRuntimeException;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * Purpose of class is to test ServiceGroupService base methods
- *
- * @author Joze Rihtarsic
- * @since 4.1
- */
-@ContextConfiguration(classes = {SMLIntegrationService.class})
-public class SMLIntegrationServiceNoSMLIntegrationTest extends AbstractServiceIntegrationTest {
-
-
-    @Autowired
-    protected SMLIntegrationService testInstance;
-
-    @Before
-    @Transactional
-    public void prepareDatabase() {
-        configurationDao.setPropertyToDatabase(SMPPropertyEnum.SML_ENABLED, "false", "");
-        configurationDao.refreshProperties();
-
-
-        testUtilsDao.clearData();
-        testUtilsDao.createResources();
-    }
-
-    @Test
-    public void registerOnlyDomainToSml() {
-
-        // given
-        DBDomain testDomain01 = testUtilsDao.getD1();
-        testDomain01.setSmlRegistered(false);
-
-        // when
-        SMPRuntimeException result = Assert.assertThrows(SMPRuntimeException.class, () -> testInstance.registerDomain(testDomain01));
-        Assert.assertEquals("Configuration error: [SML integration is not enabled!]!", result.getMessage());
-    }
-
-    @Test
-    public void unregisterOnlyDomainToSml() {
-
-        // given
-        DBDomain testDomain01 = testUtilsDao.getD1();
-        testDomain01.setSmlRegistered(true);
-
-        // when
-        SMPRuntimeException result = Assert.assertThrows(SMPRuntimeException.class, () -> testInstance.unRegisterDomain(testDomain01));
-        Assert.assertEquals("Configuration error: [SML integration is not enabled!]!", result.getMessage());
-    }
-
-    @Test
-    public void registerParticipant() {
-
-        DBDomain testDomain01 = testUtilsDao.getD1();
-        DBResource resource = testUtilsDao.getResourceD1G1RD1();
-        // nothing is expected to be thrown
-        testInstance.registerParticipant(resource, testDomain01);
-    }
-
-    @Test
-    public void unregisterParticipant() {
-
-        DBDomain testDomain01 = testUtilsDao.getD1();
-        DBResource resource = testUtilsDao.getResourceD1G1RD1();
-        // nothing is expected to be thrown
-        testInstance.unregisterParticipant(resource, testDomain01);
-    }
-
-
-}
diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/SMLIntegrationServiceTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/SMLIntegrationServiceTest.java
index cf8d2caa0c87c2f769436acb59b31d2de0ffb8b0..d94d518a6b23ff456556142a91b849959a6ee5e3 100644
--- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/SMLIntegrationServiceTest.java
+++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/SMLIntegrationServiceTest.java
@@ -19,29 +19,31 @@
 
 package eu.europa.ec.edelivery.smp.services;
 
-import eu.europa.ec.bdmsl.ws.soap.BadRequestFault;
-import eu.europa.ec.bdmsl.ws.soap.InternalErrorFault;
-import eu.europa.ec.bdmsl.ws.soap.NotFoundFault;
-import eu.europa.ec.bdmsl.ws.soap.UnauthorizedFault;
-import eu.europa.ec.edelivery.smp.config.SmlIntegrationConfiguration;
+import eu.europa.ec.bdmsl.ws.soap.*;
 import eu.europa.ec.edelivery.smp.conversion.IdentifierService;
 import eu.europa.ec.edelivery.smp.data.model.DBDomain;
 import eu.europa.ec.edelivery.smp.data.model.doc.DBResource;
+import eu.europa.ec.edelivery.smp.exceptions.SMPRuntimeException;
+import eu.europa.ec.edelivery.smp.identifiers.Identifier;
 import eu.europa.ec.edelivery.smp.sml.SmlConnector;
+import org.busdox.servicemetadata.locator._1.ServiceMetadataPublisherServiceForParticipantType;
+import org.busdox.servicemetadata.locator._1.ServiceMetadataPublisherServiceType;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
 import org.mockito.Mockito;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.boot.test.mock.mockito.SpyBean;
 import org.springframework.test.util.ReflectionTestUtils;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.regex.Pattern;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
 /**
@@ -50,40 +52,33 @@ import static org.mockito.Mockito.verify;
  * @author Joze Rihtarsic
  * @since 4.1
  */
-@RunWith(SpringRunner.class)
-@ContextConfiguration(classes = {SmlIntegrationConfiguration.class,
-        SMLIntegrationService.class})
 public class SMLIntegrationServiceTest extends AbstractServiceIntegrationTest {
 
     @Autowired
     IdentifierService identifierService;
-    @Autowired
-    SmlIntegrationConfiguration integrationMock;
-    @Autowired
+    @MockBean
+    private IManageServiceMetadataWS iManageServiceMetadataWS;
+    @MockBean
+    private IManageParticipantIdentifierWS iManageParticipantIdentifierWS;
+    @SpyBean
     protected SmlConnector smlConnector;
     @Autowired
     protected SMLIntegrationService testInstance;
-    @Autowired
+    @SpyBean
     ConfigurationService configurationService;
 
     @Before
     @Transactional
     public void prepareDatabase() {
-        ReflectionTestUtils.setField(testInstance, "identifierService", identifierService);
-
         identifierService.configureParticipantIdentifierFormatter(null, false, Pattern.compile(".*"));
 
-        configurationService = Mockito.spy(configurationService);
-        smlConnector = Mockito.spy(smlConnector);
-        Mockito.doNothing().when(smlConnector).configureClient(any(), any(), any());
-
-        ReflectionTestUtils.setField(testInstance, "configurationService", configurationService);
         ReflectionTestUtils.setField(smlConnector, "configurationService", configurationService);
+        ReflectionTestUtils.setField(testInstance, "configurationService", configurationService);
         ReflectionTestUtils.setField(testInstance, "smlConnector", smlConnector);
+        ReflectionTestUtils.setField(testInstance, "identifierService", identifierService);
 
-        Mockito.doReturn(true).when(configurationService).isSMLIntegrationEnabled();
-
-        integrationMock.reset();
+        Mockito.reset(smlConnector);
+        Mockito.doNothing().when(smlConnector).configureClient(any(), any(), any());
 
         testUtilsDao.clearData();
         testUtilsDao.createResources();
@@ -91,52 +86,136 @@ public class SMLIntegrationServiceTest extends AbstractServiceIntegrationTest {
 
     @Test
     public void registerDomainToSml() throws UnauthorizedFault, InternalErrorFault, BadRequestFault {
-
         // given
         DBDomain testDomain01 = testUtilsDao.getD1();
         testDomain01.setSmlRegistered(false);
         testUtilsDao.merge(testDomain01);
+        givenSmlIntegrationEnabled(true);
 
         // when
         testInstance.registerDomain(testDomain01);
 
         assertTrue(testDomain01.isSmlRegistered());
-        assertEquals(1, integrationMock.getSmpManagerClientMocks().size());
-        verify(integrationMock.getSmpManagerClientMocks().get(0)).create(any());
-        Mockito.verifyNoMoreInteractions(integrationMock.getSmpManagerClientMocks().toArray());
-
+        verify(iManageServiceMetadataWS, times(1)).create(any(ServiceMetadataPublisherServiceType.class));
     }
 
     @Test
     public void unregisterDomainToSml() throws UnauthorizedFault, InternalErrorFault, BadRequestFault, NotFoundFault {
-
         // given
         DBDomain testDomain01 = testUtilsDao.getD1();
         testDomain01.setSmlRegistered(true);
+        givenSmlIntegrationEnabled(true);
 
         // when
         testInstance.unRegisterDomain(testDomain01);
 
         assertFalse(testDomain01.isSmlRegistered());
-        assertEquals(1, integrationMock.getSmpManagerClientMocks().size());
-        verify(integrationMock.getSmpManagerClientMocks().get(0)).delete(testDomain01.getSmlSmpId());
-        Mockito.verifyNoMoreInteractions(integrationMock.getSmpManagerClientMocks().toArray());
+        verify(iManageServiceMetadataWS, times(1)).delete(testDomain01.getSmlSmpId());
 
     }
 
     @Test
-    public void registerParticipant() throws NotFoundFault, UnauthorizedFault, InternalErrorFault, BadRequestFault {
+    public void registerParticipant() throws Exception {
         DBDomain testDomain01 = testUtilsDao.getD1();
         testDomain01.setSmlRegistered(true);
         DBResource resource = testUtilsDao.getResourceD1G1RD1();
         resource.setSmlRegistered(false);
+        givenSmlIntegrationEnabled(true);
+
+        // when
+        testInstance.registerParticipant(resource, testDomain01);
+
+        //then
+        verify(iManageParticipantIdentifierWS, times(1)).create(any(ServiceMetadataPublisherServiceForParticipantType.class));
+    }
+
+    @Test
+    public void participantExists() {
+        // given
+        DBDomain domain = testUtilsDao.getD1();
+        DBResource resource = testUtilsDao.getResourceD1G1RD1();
+        givenSmlIntegrationEnabled(true);
+
+        Identifier identifier = identifierService.normalizeParticipant(resource.getIdentifierScheme(), resource.getIdentifierValue());
+        Mockito.doReturn(true).when(smlConnector).participantExists(identifier, domain);
+
+        // when
+        boolean participantExists = testInstance.participantExists(resource, domain);
+
+        // then
+        Assert.assertTrue(participantExists);
+    }
+
+    @Test
+    public void registerOnlyDomainToSml_smlIntegrationDisabled() {
+        // given
+        DBDomain testDomain01 = testUtilsDao.getD1();
+        testDomain01.setSmlRegistered(false);
+
+        givenSmlIntegrationEnabled(false);
+
+        // when
+        SMPRuntimeException result = Assert.assertThrows(SMPRuntimeException.class, () -> testInstance.registerDomain(testDomain01));
+        Assert.assertEquals("Configuration error: [SML integration is not enabled!]!", result.getMessage());
+    }
+
+    @Test
+    public void unregisterOnlyDomainToSml_smlIntegrationDisabled() {
+        // given
+        DBDomain testDomain01 = testUtilsDao.getD1();
+        testDomain01.setSmlRegistered(true);
+
+        givenSmlIntegrationEnabled(false);
+
         // when
+        SMPRuntimeException result = Assert.assertThrows(SMPRuntimeException.class, () -> testInstance.unRegisterDomain(testDomain01));
+        Assert.assertEquals("Configuration error: [SML integration is not enabled!]!", result.getMessage());
+    }
+
+    @Test
+    public void registerParticipant_smlIntegrationDisabled() {
+        DBDomain testDomain01 = testUtilsDao.getD1();
+        DBResource resource = testUtilsDao.getResourceD1G1RD1();
+
+        givenSmlIntegrationEnabled(false);
+
+        // nothing is expected to be thrown
         testInstance.registerParticipant(resource, testDomain01);
+    }
 
-        //then -- expect on call
-        assertEquals(1, integrationMock.getParticipantManagmentClientMocks().size());
-        verify(integrationMock.getParticipantManagmentClientMocks().get(0)).create(any());
-        Mockito.verifyNoMoreInteractions(integrationMock.getParticipantManagmentClientMocks().toArray());
+    @Test
+    public void unregisterParticipant_smlIntegrationDisabled() {
+        DBDomain testDomain01 = testUtilsDao.getD1();
+        DBResource resource = testUtilsDao.getResourceD1G1RD1();
+
+        givenSmlIntegrationEnabled(false);
+
+        // nothing is expected to be thrown
+        testInstance.unregisterParticipant(resource, testDomain01);
+    }
+
+    @Test
+    public void participantExists_smlIntegrationDisabled() {
+        DBDomain domain = testUtilsDao.getD1();
+        DBResource resource = testUtilsDao.getResourceD1G1RD1();
+
+        givenSmlIntegrationEnabled(false);
+
+        SMPRuntimeException result = Assert.assertThrows(SMPRuntimeException.class, () -> testInstance.participantExists(resource, domain));
+        Assert.assertEquals("Configuration error: [SML integration is not enabled!]!", result.getMessage());
+    }
+
+    @Test
+    public void isDomainValid_smlIntegrationDisabled() {
+        DBDomain domain = testUtilsDao.getD1();
+
+        givenSmlIntegrationEnabled(false);
+
+        SMPRuntimeException result = Assert.assertThrows(SMPRuntimeException.class, () -> testInstance.isDomainValid(domain));
+        Assert.assertEquals("Configuration error: [SML integration is not enabled!]!", result.getMessage());
+    }
 
+    private void givenSmlIntegrationEnabled(boolean enabled) {
+        Mockito.doReturn(enabled).when(configurationService).isSMLIntegrationEnabled();
     }
 }
diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainPublicServiceTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainPublicServiceTest.java
index 45257b8f38fa9a7319331bf30d2fdbe7d8cde256..f306e7cb55a33ec62199978c04f2e0a18fcba87e 100644
--- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainPublicServiceTest.java
+++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainPublicServiceTest.java
@@ -50,7 +50,7 @@ class UIDomainPublicServiceTest   extends AbstractJunit5BaseDao {
     @Test
     public void testGetTableList() {
         ServiceResult<DomainPublicRO>  result = testInstance.getTableList(-1, -1, null, null, null);
-        assertEquals(2, result.getCount().intValue());
+        assertEquals(3, result.getCount().intValue());
     }
 
     @Test
diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainServiceTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainServiceTest.java
index 974cd4e9140340361f44c66c7db45f9e11159d56..9d6eed1ced0ecba72f8becac03238c7cd3c0c343 100644
--- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainServiceTest.java
+++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainServiceTest.java
@@ -22,10 +22,17 @@ import eu.europa.ec.edelivery.smp.data.dao.DomainDao;
 import eu.europa.ec.edelivery.smp.data.enums.VisibilityType;
 import eu.europa.ec.edelivery.smp.data.model.DBDomain;
 import eu.europa.ec.edelivery.smp.data.ui.DomainRO;
+import eu.europa.ec.edelivery.smp.exceptions.BadRequestException;
 import eu.europa.ec.edelivery.smp.services.AbstractServiceTest;
+import eu.europa.ec.edelivery.smp.services.SMLIntegrationService;
+import org.apache.commons.lang3.StringUtils;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
+import org.mockito.Mockito;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.mock.mockito.SpyBean;
+import org.springframework.test.util.ReflectionTestUtils;
 
 import java.util.Collections;
 import java.util.List;
@@ -35,25 +42,30 @@ import static org.junit.Assert.*;
 public class UIDomainServiceTest extends AbstractServiceTest {
 
     @Autowired
-    UIDomainService testInstance;
+    private UIDomainService testInstance;
     @Autowired
-    DomainDao domainDao;
+    private DomainDao domainDao;
+//     @Autowired
+    @SpyBean
+    private SMLIntegrationService smlIntegrationService;
 
     @Before
     public void prepareDatabase() {
         testUtilsDao.clearData();
         testUtilsDao.createResourceDefinitionsForDomains();
+
+//        smlIntegrationService = Mockito.spy(smlIntegrationService);
+        ReflectionTestUtils.setField(testInstance, "smlIntegrationService", smlIntegrationService);
     }
 
     @Test
     public void getAllDomains() {
         List<DomainRO> domainROS = testInstance.getAllDomains();
-        assertEquals(2, domainROS.size());
+        assertEquals(3, domainROS.size());
     }
 
     @Test
     public void updateDomainData() {
-
         DomainRO domainRO = new DomainRO();
         domainRO.setDomainCode("NewCode");
         domainRO.setVisibility(VisibilityType.INTERNAL);
@@ -71,22 +83,60 @@ public class UIDomainServiceTest extends AbstractServiceTest {
 
     @Test
     public void updateSMLDomainData() {
-
         DomainRO domainRO = new DomainRO();
         domainRO.setSmlSubdomain("New SmlSubdomain");
         domainRO.setSmlSmpId("NewSmlSmpId");
         domainRO.setSmlClientKeyAlias("NewClientKeyAlias");
         domainRO.setSmlClientCertAuth(false);
         DBDomain domain = testUtilsDao.getD1();
+
         testInstance.updateDomainSmlIntegrationData(domain.getId(), domainRO);
-        DBDomain result = domainDao.find(domain.getId());
 
+        DBDomain result = domainDao.find(domain.getId());
         assertEquals(domainRO.getSmlSubdomain(), result.getSmlSubdomain());
         assertEquals(domainRO.getSmlSmpId(), result.getSmlSmpId());
         assertEquals(domainRO.getSmlClientKeyAlias(), result.getSmlClientKeyAlias());
         assertEquals(domainRO.isSmlClientCertAuth(), result.isSmlClientCertAuth());
     }
 
+    @Test
+    public void updateSMLDomainData_domainNotFound() {
+        BadRequestException result = Assert.assertThrows(BadRequestException.class, () ->
+                testInstance.updateDomainSmlIntegrationData(-1l, new DomainRO()));
+        Assert.assertEquals("Domain does not exist in database!", result.getMessage());
+    }
+
+    @Test
+    public void updateSMLDomainData_registeredDomainSmpIdChangeNotAllowed() {
+        DBDomain domain = testUtilsDao.getD3();
+
+        DomainRO domainRO = new DomainRO();
+        domainRO.setSmlSmpId("utestRegistered03");
+
+        BadRequestException result = Assert.assertThrows(BadRequestException.class, () ->
+                    testInstance.updateDomainSmlIntegrationData(domain.getId(), domainRO));
+        Assert.assertEquals("SMP-SML identifier must not change for registered domain [utestRegistered03]!", result.getMessage());
+    }
+
+    @Test
+    public void updateSMLDomainData_invalidSmlIntegrationCertificate() {
+        DBDomain domain = testUtilsDao.getD3();
+
+        // Ensure domain DTO doesn't update domain existing values or #isDomainValid(domain) below won't match
+        // As a workaround, we can use #isDomainValid(Mockito.any()) but this would be less clean
+        DomainRO domainRO = new DomainRO();
+        domainRO.setSmlSmpId(StringUtils.trim(domain.getSmlSmpId()));
+        domainRO.setSmlSubdomain(domain.getSmlSubdomain());
+        domainRO.setSmlClientKeyAlias(domain.getSmlClientKeyAlias());
+        domainRO.setSmlClientCertAuth(domain.isSmlClientCertAuth());
+
+        Mockito.doReturn(false).when(smlIntegrationService).isDomainValid(domain);
+
+        BadRequestException result = Assert.assertThrows(BadRequestException.class, () ->
+                testInstance.updateDomainSmlIntegrationData(domain.getId(), domainRO));
+        Assert.assertEquals("The SML-SMP certificate for domain [utestRegistered03] is not valid!", result.getMessage());
+    }
+
     @Test
     public void updateDomainResourceListClear() {
         DBDomain testDomain = testUtilsDao.getD1();
diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/sml/SmlConnectorDomainTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/sml/SmlConnectorDomainTest.java
index d507add2aa780228b05bb136383e547784695986..0b21fa6956a4b5832d3a5b3d85072017c7d21e08 100644
--- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/sml/SmlConnectorDomainTest.java
+++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/sml/SmlConnectorDomainTest.java
@@ -21,22 +21,23 @@
 package eu.europa.ec.edelivery.smp.sml;
 
 import eu.europa.ec.bdmsl.ws.soap.BadRequestFault;
+import eu.europa.ec.bdmsl.ws.soap.IManageServiceMetadataWS;
 import eu.europa.ec.bdmsl.ws.soap.InternalErrorFault;
 import eu.europa.ec.bdmsl.ws.soap.NotFoundFault;
-import eu.europa.ec.bdmsl.ws.soap.UnauthorizedFault;
-import eu.europa.ec.edelivery.smp.config.SmlIntegrationConfiguration;
 import eu.europa.ec.edelivery.smp.data.model.DBDomain;
 import eu.europa.ec.edelivery.smp.exceptions.SMPRuntimeException;
 import eu.europa.ec.edelivery.smp.services.AbstractServiceTest;
 import eu.europa.ec.edelivery.smp.services.ConfigurationService;
+import org.busdox.servicemetadata.locator._1.ServiceMetadataPublisherServiceType;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Ignore;
-import org.junit.Rule;
 import org.junit.Test;
 import org.junit.jupiter.api.Assertions;
-import org.junit.rules.ExpectedException;
+import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.boot.test.mock.mockito.SpyBean;
 import org.springframework.test.util.ReflectionTestUtils;
 
 import java.util.UUID;
@@ -44,6 +45,8 @@ import java.util.UUID;
 import static eu.europa.ec.edelivery.smp.sml.SmlConnectorTestConstants.*;
 import static org.junit.Assert.*;
 import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
 /**
@@ -52,174 +55,251 @@ import static org.mockito.Mockito.verify;
  */
 public class SmlConnectorDomainTest extends AbstractServiceTest {
 
-    @Autowired
-    protected ConfigurationService configurationService;
+    // Beans
+    @SpyBean
+    private ConfigurationService configurationService;
+    @MockBean
+    private IManageServiceMetadataWS iManageServiceMetadataWS;
+    @SpyBean
+    private SmlConnector testInstance;
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
-    @Autowired
-    protected SmlConnector testInstance;
-    @Autowired
-    SmlIntegrationConfiguration mockSml;
+    // Mocks
+    @Mock
+    private DBDomain domain;
 
     @Before
     public void setup() {
-
-        configurationService = Mockito.spy(configurationService);
-        testInstance = Mockito.spy(testInstance);
         // default behaviour
         Mockito.doNothing().when(testInstance).configureClient(any(), any(), any());
-        ReflectionTestUtils.setField(testInstance, "configurationService", configurationService);
         Mockito.doReturn(true).when(configurationService).isSMLIntegrationEnabled();
-        mockSml.reset();
+
+        ReflectionTestUtils.setField(testInstance, "configurationService", configurationService);
     }
 
     @Test
-    public void testRegisterDomainInDns() throws UnauthorizedFault, InternalErrorFault, BadRequestFault {
+    public void testRegisterDomainInDns() throws Exception {
         //when
-
         boolean result = testInstance.registerDomain(DEFAULT_DOMAIN);
 
         //then
         assertTrue(result);
-        assertEquals(1, mockSml.getSmpManagerClientMocks().size());
-        verify(mockSml.getSmpManagerClientMocks().get(0)).create(any());
-        Mockito.verifyNoMoreInteractions(mockSml.getSmpManagerClientMocks().toArray());
+        verify(iManageServiceMetadataWS, times(1)).create(any(ServiceMetadataPublisherServiceType.class));
     }
 
     @Test
-    public void testRegisterDomainInDnsAlreadyExists() throws UnauthorizedFault, InternalErrorFault, BadRequestFault {
+    public void testRegisterDomainInDnsAlreadyExists() throws Exception {
+        //given
+        Mockito.doThrow(new BadRequestFault(ERROR_SMP_ALREADY_EXISTS)).when(iManageServiceMetadataWS).create(any(ServiceMetadataPublisherServiceType.class));
+
         //when
-        BadRequestFault ex = new BadRequestFault(ERROR_SMP_ALREADY_EXISTS);
-        mockSml.setThrowException(ex);
         boolean result = testInstance.registerDomain(DEFAULT_DOMAIN);
 
         //then
         assertTrue(result);
-        assertEquals(1, mockSml.getSmpManagerClientMocks().size());
-        verify(mockSml.getSmpManagerClientMocks().get(0)).create(any());
-        Mockito.verifyNoMoreInteractions(mockSml.getSmpManagerClientMocks().toArray());
+        verify(iManageServiceMetadataWS, times(1)).create(any(ServiceMetadataPublisherServiceType.class));
     }
 
     @Test
-    public void testRegisterDomainInDnsUnknownException() {
-        //when
+    public void testRegisterDomainInDnsUnknownException() throws Exception {
+        //given
         String message = "something unexpected";
-        Exception ex = new Exception(message);
-        mockSml.setThrowException(ex);
-        expectedException.expectMessage(message);
-        expectedException.expect(SMPRuntimeException.class);
+        Mockito.doThrow(new InternalErrorFault(message)).when(iManageServiceMetadataWS).create(any(ServiceMetadataPublisherServiceType.class));
 
-        testInstance.registerDomain(DEFAULT_DOMAIN);
+        //when
+        SMPRuntimeException smpRuntimeException = assertThrows(SMPRuntimeException.class, () ->
+                testInstance.registerDomain(DEFAULT_DOMAIN));
+
+        //then
+        Assert.assertEquals("SML integration error! Error: InternalErrorFault: " + message, smpRuntimeException.getMessage().trim());
+        verify(iManageServiceMetadataWS, times(1)).create(any(ServiceMetadataPublisherServiceType.class));
     }
 
     @Test
-    public void testRegisterDomainInDnsNewClientIsAlwaysCreated() throws UnauthorizedFault, NotFoundFault, InternalErrorFault, BadRequestFault {
+    public void testRegisterDomainInDnsNewClientIsAlwaysCreated() throws Exception {
         //when
         testInstance.registerDomain(DEFAULT_DOMAIN);
         testInstance.registerDomain(DEFAULT_DOMAIN);
 
         //then
-        assertEquals(2, mockSml.getSmpManagerClientMocks().size());
-        verify(mockSml.getSmpManagerClientMocks().get(0)).create(any());
-        verify(mockSml.getSmpManagerClientMocks().get(1)).create(any());
-        Mockito.verifyNoMoreInteractions(mockSml.getSmpManagerClientMocks().toArray());
+        verify(iManageServiceMetadataWS, times(2)).create(any(ServiceMetadataPublisherServiceType.class));
     }
 
     @Test
-    public void testDomainUnregisterFromDns() throws UnauthorizedFault, NotFoundFault, InternalErrorFault, BadRequestFault {
+    public void testDomainUnregisterFromDns() throws Exception {
         //when
         testInstance.unregisterDomain(DEFAULT_DOMAIN);
 
         //then
-        assertEquals(1, mockSml.getSmpManagerClientMocks().size());
-        verify(mockSml.getSmpManagerClientMocks().get(0)).delete(any());
-        Mockito.verifyNoMoreInteractions(mockSml.getSmpManagerClientMocks().toArray());
+        verify(iManageServiceMetadataWS, times(1)).delete(anyString());
     }
 
     @Test
-    public void testUnregisterDomainFromDnsNewClientIsAlwaysCreated() throws UnauthorizedFault, NotFoundFault, InternalErrorFault, BadRequestFault {
+    public void testUnregisterDomainFromDnsNewClientIsAlwaysCreated() throws Exception {
         //when
         testInstance.unregisterDomain(DEFAULT_DOMAIN);
         testInstance.unregisterDomain(DEFAULT_DOMAIN);
 
         //then
-        assertEquals(2, mockSml.getSmpManagerClientMocks().size());
-        verify(mockSml.getSmpManagerClientMocks().get(0)).delete(any());
-        verify(mockSml.getSmpManagerClientMocks().get(1)).delete(any());
-        Mockito.verifyNoMoreInteractions(mockSml.getSmpManagerClientMocks().toArray());
+        verify(iManageServiceMetadataWS, times(2)).delete(anyString());
     }
 
     @Test
-    public void testUnregisterDomainFromDnsThrowUnknownBadRequestFault() {
+    public void testUnregisterDomainFromDnsThrowUnknownBadRequestFault() throws Exception {
+        // given
+        Mockito.doThrow(new BadRequestFault(ERROR_UNEXPECTED_MESSAGE)).when(iManageServiceMetadataWS).delete(anyString());
+
         //when
-        BadRequestFault ex = new BadRequestFault(ERROR_UNEXPECTED_MESSAGE);
-        mockSml.setThrowException(ex);
-        expectedException.expectMessage(ERROR_UNEXPECTED_MESSAGE);
-        expectedException.expect(SMPRuntimeException.class);
+        SMPRuntimeException smpRuntimeException = assertThrows(SMPRuntimeException.class, () ->
+                testInstance.unregisterDomain(DEFAULT_DOMAIN));
+
+        //then
+        Assert.assertEquals("SML integration error! Error: BadRequestFault: " + ERROR_UNEXPECTED_MESSAGE, smpRuntimeException.getMessage().trim());
+        verify(iManageServiceMetadataWS, times(1)).delete(anyString());
 
-        testInstance.unregisterDomain(DEFAULT_DOMAIN);
     }
 
     @Test
-    public void testUnregisterDomainFromDnsThrowUnknownException() {
+    public void testUnregisterDomainFromDnsThrowUnknownException() throws Exception {
+        //given
+        Mockito.doThrow(new InternalErrorFault("something unexpected")).when(iManageServiceMetadataWS).delete(anyString());
+
         //when
-        String message = "something unexpected";
-        Exception ex = new Exception(message);
-        mockSml.setThrowException(ex);
-        expectedException.expectMessage(message);
-        expectedException.expect(SMPRuntimeException.class);
+        SMPRuntimeException smpRuntimeException = assertThrows(SMPRuntimeException.class, () ->
+                testInstance.unregisterDomain(DEFAULT_DOMAIN));
 
-        testInstance.unregisterDomain(DEFAULT_DOMAIN);
+        //then
+        Assert.assertEquals("SML integration error! Error: InternalErrorFault: something unexpected", smpRuntimeException.getMessage().trim());
+        verify(iManageServiceMetadataWS, times(1)).delete(anyString());
     }
 
     @Test
-    public void testUnregisterDomainFromDnsNotExists() {
-        //when
-        BadRequestFault ex = new BadRequestFault(ERROR_SMP_NOT_EXISTS);
-        mockSml.setThrowException(ex);
+    public void testUnregisterDomainFromDnsNotExists() throws Exception {
+        //given
+        Mockito.doThrow(new BadRequestFault(ERROR_SMP_NOT_EXISTS)).when(iManageServiceMetadataWS).delete(anyString());
 
+        //when
         Assertions.assertDoesNotThrow(() -> testInstance.unregisterDomain(DEFAULT_DOMAIN));
     }
 
     @Test
     public void testIsOkMessageForDomainNull() {
+        //when
         boolean suc = testInstance.isOkMessage(DEFAULT_DOMAIN, null);
 
+        //then
         assertFalse(suc);
     }
 
     @Test
     public void testIsOkMessageForDomainFalse() {
-
+        //when
         boolean suc = testInstance.isOkMessage(DEFAULT_DOMAIN, ERROR_UNEXPECTED_MESSAGE);
 
+        //then
         assertFalse(suc);
     }
 
     @Test
     public void testGetSmlClientKeyAliasForDomain() {
-
+        //given
         DBDomain domain = new DBDomain();
         domain.setSmlClientKeyAlias(UUID.randomUUID().toString());
         domain.setSmlClientCertAuth(false);
 
+        //when
         String alias = testInstance.getSmlClientKeyAliasForDomain(domain);
 
+        //then
         assertEquals(domain.getSmlClientKeyAlias(), alias);
     }
 
     @Test
     @Ignore("Randomly fails on bamboo ")
     public void testGetSmlClientKeyAliasForDomainNulForSingleKey() {
-
+        //given
         DBDomain domain = new DBDomain();
         domain.setSmlClientKeyAlias(null);
         domain.setSmlClientCertAuth(false);
 
+        //when
         String alias = testInstance.getSmlClientKeyAliasForDomain(domain);
 
+        //then
         assertEquals("single_domain_key", alias);
     }
+
+    @Test
+    public void isDomainValid() throws Exception {
+        //given
+        ServiceMetadataPublisherServiceType existingDomain = new ServiceMetadataPublisherServiceType();
+        Mockito.when(iManageServiceMetadataWS.read(any(ServiceMetadataPublisherServiceType.class))).thenReturn(existingDomain);
+
+        //when
+        boolean result = testInstance.isDomainValid(domain);
+
+        //then
+        Assert.assertTrue("Should have returned true when the participant exists", result);
+    }
+
+    @Test
+    public void isDomainValid_wrapsBadRequestFaultIntoSmpRuntimeException() throws Exception {
+        //given
+        String errorMessage = UUID.randomUUID().toString();
+        Mockito.when(iManageServiceMetadataWS.read(any(ServiceMetadataPublisherServiceType.class))).thenThrow(new BadRequestFault(errorMessage));
+
+        //when
+        SMPRuntimeException smpRuntimeException = assertThrows(SMPRuntimeException.class, () ->
+                testInstance.isDomainValid(domain));
+
+        //then
+        Assert.assertEquals("Should have returned an SMPRuntimeException wrapping the original BadRequestFault when thrown while reading a domain",
+                "SML integration error! Error: BadRequestFault: " + errorMessage,
+                smpRuntimeException.getMessage().trim());
+    }
+
+    @Test
+    public void isDomainValid_wrapsNotFoundFaultIntoSmpRuntimeException() throws Exception {
+        //given
+        String errorMessage = UUID.randomUUID().toString();
+        Mockito.when(iManageServiceMetadataWS.read(any(ServiceMetadataPublisherServiceType.class))).thenThrow(new NotFoundFault(errorMessage));
+
+        //when
+        SMPRuntimeException smpRuntimeException = assertThrows(SMPRuntimeException.class, () ->
+                testInstance.isDomainValid(domain));
+
+        //then
+        Assert.assertEquals("Should have returned an SMPRuntimeException wrapping the original NotFoundFault when thrown while reading a domain",
+                "SML integration error! Error: NotFoundFault: " + errorMessage,
+                smpRuntimeException.getMessage().trim());
+    }
+
+    @Test
+    public void isDomainValid_wrapsCheckedExceptionsIntoSmpRuntimeException() throws Exception {
+        //given
+        String errorMessage = UUID.randomUUID().toString();
+        // We need to match one of the checked exceptions present in the method signature, so we throw InternalErrorFault which will be handled aside
+        Mockito.when(iManageServiceMetadataWS.read(any(ServiceMetadataPublisherServiceType.class))).thenThrow(new InternalErrorFault(errorMessage));
+
+        //when
+        SMPRuntimeException smpRuntimeException = assertThrows(SMPRuntimeException.class, () ->
+                testInstance.isDomainValid(domain));
+
+        //then
+        Assert.assertEquals("Should have returned an SMPRuntimeException wrapping the original Exception when thrown while reading a domain",
+                "SML integration error! Error: InternalErrorFault: " + errorMessage,
+                smpRuntimeException.getMessage().trim());
+    }
+
+    @Test
+    public void isDomainValid_smlIntegrationDisabled() {
+        //given
+        Mockito.doReturn(false).when(configurationService).isSMLIntegrationEnabled();
+
+        //when
+        boolean result = testInstance.isDomainValid(domain);
+
+        //then
+        Assert.assertFalse("Should have returned the domain as not valid when the SML integration is not enabled", result);
+        Mockito.verifyNoMoreInteractions(iManageServiceMetadataWS);
+    }
 }
diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/sml/SmlConnectorParticipantTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/sml/SmlConnectorParticipantTest.java
index a871e2ef25f934575834f5b45f0f4c1762b1788e..8c0a8aaeaacb859832ca6753c3e2a79893bb562d 100644
--- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/sml/SmlConnectorParticipantTest.java
+++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/sml/SmlConnectorParticipantTest.java
@@ -8,9 +8,9 @@
  * versions of the EUPL (the "Licence");
  * You may not use this work except in compliance with the Licence.
  * You may obtain a copy of the Licence at:
- * 
+ *
  * [PROJECT_HOME]\license\eupl-1.2\license.txt or https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software distributed under the Licence is
  * distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the Licence for the specific language governing permissions and limitations under the Licence.
@@ -19,230 +19,348 @@
 
 package eu.europa.ec.edelivery.smp.sml;
 
-import eu.europa.ec.bdmsl.ws.soap.BadRequestFault;
-import eu.europa.ec.bdmsl.ws.soap.InternalErrorFault;
-import eu.europa.ec.bdmsl.ws.soap.NotFoundFault;
-import eu.europa.ec.bdmsl.ws.soap.UnauthorizedFault;
-import eu.europa.ec.edelivery.smp.config.SmlIntegrationConfiguration;
+import ec.services.wsdl.bdmsl.data._1.ExistsParticipantResponseType;
+import ec.services.wsdl.bdmsl.data._1.ParticipantsType;
+import eu.europa.ec.bdmsl.ws.soap.*;
+import eu.europa.ec.edelivery.smp.data.model.DBDomain;
 import eu.europa.ec.edelivery.smp.exceptions.SMPRuntimeException;
+import eu.europa.ec.edelivery.smp.identifiers.Identifier;
 import eu.europa.ec.edelivery.smp.services.AbstractServiceIntegrationTest;
 import eu.europa.ec.edelivery.smp.services.ConfigurationService;
+import org.busdox.servicemetadata.locator._1.ServiceMetadataPublisherServiceForParticipantType;
 import org.hamcrest.CoreMatchers;
 import org.hamcrest.MatcherAssert;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.boot.test.mock.mockito.SpyBean;
 import org.springframework.test.util.ReflectionTestUtils;
 
+import java.util.UUID;
+
 import static eu.europa.ec.edelivery.smp.sml.SmlConnectorTestConstants.*;
 import static org.junit.Assert.*;
 import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.verify;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.*;
 
 /**
  * Created by JRC
  * since 4.1.
  */
-@RunWith(SpringRunner.class)
-@ContextConfiguration(classes = {SmlConnector.class, SmlIntegrationConfiguration.class})
 public class SmlConnectorParticipantTest extends AbstractServiceIntegrationTest {
 
-
-    @Autowired
-    protected ConfigurationService configurationService;
-
-    @Autowired
-    protected SmlConnector testInstance;
-
-    @Autowired
-    SmlIntegrationConfiguration mockSml;
+    // Beans
+    @SpyBean
+    private ConfigurationService configurationService;
+    @MockBean
+    private IBDMSLServiceWS ibdmslServiceWS;
+    @MockBean
+    private IManageParticipantIdentifierWS iManageParticipantIdentifierWS;
+    @SpyBean
+    private SmlConnector testInstance;
+
+    // Mocks
+    @Mock
+    private DBDomain domain;
+    @Mock
+    private Identifier identifier;
 
     @Before
     public void setup() {
-        testInstance = Mockito.spy(testInstance);
         // default behaviour
         Mockito.doNothing().when(testInstance).configureClient(any(), any(), any());
+        Mockito.doReturn(true).when(configurationService).isSMLIntegrationEnabled();
 
-
-        configurationService = Mockito.spy(configurationService);
         ReflectionTestUtils.setField(testInstance, "configurationService", configurationService);
-        Mockito.doReturn(true).when(configurationService).isSMLIntegrationEnabled();
         DEFAULT_DOMAIN.setSmlRegistered(true);
-        mockSml.reset();
     }
 
     @Test
-    public void testRegisterInDns() throws UnauthorizedFault, NotFoundFault, InternalErrorFault, BadRequestFault {
+    public void testRegisterInDns() throws Exception {
         //when
         boolean result = testInstance.registerInDns(PARTICIPANT_ID, DEFAULT_DOMAIN, null);
 
         //then
         assertTrue(result);
-        assertEquals(1, mockSml.getParticipantManagmentClientMocks().size());
-        verify(mockSml.getParticipantManagmentClientMocks().get(0)).create(any());
-        Mockito.verifyNoMoreInteractions(mockSml.getParticipantManagmentClientMocks().toArray());
+        verify(iManageParticipantIdentifierWS, times(1)).create(any(ServiceMetadataPublisherServiceForParticipantType.class));
+        Mockito.verifyNoMoreInteractions(iManageParticipantIdentifierWS);
     }
 
     @Test
-    public void testRegisterInDnsAlreadyExists() throws UnauthorizedFault, NotFoundFault, InternalErrorFault, BadRequestFault {
+    public void testRegisterInDnsAlreadyExists() throws Exception {
+        //given
+        Mockito.doThrow(new BadRequestFault(ERROR_PI_ALREADY_EXISTS)).when(iManageParticipantIdentifierWS).create(any(ServiceMetadataPublisherServiceForParticipantType.class));
+
         //when
-        BadRequestFault ex = new BadRequestFault(ERROR_PI_ALREADY_EXISTS);
-        mockSml.setThrowException(ex);
         boolean result = testInstance.registerInDns(PARTICIPANT_ID, DEFAULT_DOMAIN, null);
 
         //then
         assertTrue(result);
-        assertEquals(1, mockSml.getParticipantManagmentClientMocks().size());
-        verify(mockSml.getParticipantManagmentClientMocks().get(0)).create(any());
-        Mockito.verifyNoMoreInteractions(mockSml.getParticipantManagmentClientMocks().toArray());
+        verify(iManageParticipantIdentifierWS, times(1)).create(any(ServiceMetadataPublisherServiceForParticipantType.class));
+        Mockito.verifyNoMoreInteractions(iManageParticipantIdentifierWS);
     }
 
     @Test
-    public void testRegisterInDnsUnknownException() {
-        //when
+    public void testRegisterInDnsUnknownException() throws Exception {
+        //given
         String message = "something unexpected";
-        Exception ex = new Exception(message);
-        mockSml.setThrowException(ex);
+        Mockito.doThrow(new InternalErrorFault(message)).when(iManageParticipantIdentifierWS).create(any(ServiceMetadataPublisherServiceForParticipantType.class));
 
+        //when
         SMPRuntimeException result = assertThrows(SMPRuntimeException.class, () -> testInstance.registerInDns(PARTICIPANT_ID, DEFAULT_DOMAIN, null));
-        MatcherAssert.assertThat(result.getMessage(), CoreMatchers.containsString(message));
+
+        //then
+        MatcherAssert.assertThat(result.getMessage(), CoreMatchers.containsStringIgnoringCase(message));
     }
 
     @Test
-    public void testRegisterInDnsNewClientIsAlwaysCreated() throws UnauthorizedFault, NotFoundFault, InternalErrorFault, BadRequestFault {
+    public void testRegisterInDnsNewClientIsAlwaysCreated() throws Exception {
         //when
         testInstance.registerInDns(PARTICIPANT_ID, DEFAULT_DOMAIN, null);
         testInstance.registerInDns(PARTICIPANT_ID, DEFAULT_DOMAIN, null);
 
         //then
-        assertEquals(2, mockSml.getParticipantManagmentClientMocks().size());
-        verify(mockSml.getParticipantManagmentClientMocks().get(0)).create(any());
-        verify(mockSml.getParticipantManagmentClientMocks().get(1)).create(any());
-        Mockito.verifyNoMoreInteractions(mockSml.getParticipantManagmentClientMocks().toArray());
+        verify(iManageParticipantIdentifierWS, times(2)).create(any(ServiceMetadataPublisherServiceForParticipantType.class));
+        Mockito.verifyNoMoreInteractions(iManageParticipantIdentifierWS);
     }
 
     @Test
-    public void testUnregisterFromDns() throws UnauthorizedFault, NotFoundFault, InternalErrorFault, BadRequestFault {
+    public void testUnregisterFromDns() throws Exception {
         //when
         boolean result = testInstance.unregisterFromDns(PARTICIPANT_ID, DEFAULT_DOMAIN);
 
         //then
         assertTrue(result);
-        assertEquals(1, mockSml.getParticipantManagmentClientMocks().size());
-        verify(mockSml.getParticipantManagmentClientMocks().get(0)).delete(any());
-        Mockito.verifyNoMoreInteractions(mockSml.getParticipantManagmentClientMocks().toArray());
+        verify(iManageParticipantIdentifierWS, times(1)).delete(any(ServiceMetadataPublisherServiceForParticipantType.class));
+        Mockito.verifyNoMoreInteractions(iManageParticipantIdentifierWS);
     }
 
     @Test
-    public void testUnregisterFromDnsNewClientIsAlwaysCreated() throws UnauthorizedFault, NotFoundFault, InternalErrorFault, BadRequestFault {
+    public void testUnregisterFromDnsNewClientIsAlwaysCreated() throws Exception {
         //when
         testInstance.unregisterFromDns(PARTICIPANT_ID, DEFAULT_DOMAIN);
         testInstance.unregisterFromDns(PARTICIPANT_ID, DEFAULT_DOMAIN);
 
         //then
-        assertEquals(2, mockSml.getParticipantManagmentClientMocks().size());
-        verify(mockSml.getParticipantManagmentClientMocks().get(0)).delete(any());
-        verify(mockSml.getParticipantManagmentClientMocks().get(1)).delete(any());
-        Mockito.verifyNoMoreInteractions(mockSml.getParticipantManagmentClientMocks().toArray());
+        verify(iManageParticipantIdentifierWS, times(2)).delete(any(ServiceMetadataPublisherServiceForParticipantType.class));
+        Mockito.verifyNoMoreInteractions(iManageParticipantIdentifierWS);
     }
 
     @Test
-    public void testUnregisterFromDnsThrowUnknownBadRequestFault() {
-        //when
-        BadRequestFault ex = new BadRequestFault(ERROR_UNEXPECTED_MESSAGE);
-        mockSml.setThrowException(ex);
+    public void testUnregisterFromDnsThrowUnknownBadRequestFault() throws Exception {
+        doThrow(new BadRequestFault(ERROR_UNEXPECTED_MESSAGE)).when(iManageParticipantIdentifierWS).delete(any(ServiceMetadataPublisherServiceForParticipantType.class));
 
+        //when
         SMPRuntimeException result = assertThrows(SMPRuntimeException.class, () -> testInstance.unregisterFromDns(PARTICIPANT_ID, DEFAULT_DOMAIN));
-        MatcherAssert.assertThat(result.getMessage(), CoreMatchers.containsString(ERROR_UNEXPECTED_MESSAGE));
-
+        MatcherAssert.assertThat(result.getMessage(), CoreMatchers.containsStringIgnoringCase(ERROR_UNEXPECTED_MESSAGE));
     }
 
     @Test
-    public void testUnregisterFromDnsThrowUnknownException() {
-        //when
+    public void testUnregisterFromDnsThrowUnknownException() throws Exception {
         String message = "something unexpected";
-        Exception ex = new Exception(message);
-        mockSml.setThrowException(ex);
+        doThrow(new InternalErrorFault(ERROR_UNEXPECTED_MESSAGE)).when(iManageParticipantIdentifierWS).delete(any(ServiceMetadataPublisherServiceForParticipantType.class));
 
+        //when
         SMPRuntimeException result = assertThrows(SMPRuntimeException.class, () -> testInstance.unregisterFromDns(PARTICIPANT_ID, DEFAULT_DOMAIN));
-        MatcherAssert.assertThat(result.getMessage(), CoreMatchers.containsString(message));
+        MatcherAssert.assertThat(result.getMessage(), CoreMatchers.containsStringIgnoringCase(message));
     }
 
     @Test
-    public void testUnregisterFromDnsNotExists() {
+    public void testUnregisterFromDnsNotExists() throws Exception {
+        //given
+        Mockito.doThrow(new BadRequestFault(ERROR_PI_NO_EXISTS)).when(iManageParticipantIdentifierWS).delete(any(ServiceMetadataPublisherServiceForParticipantType.class));
+
         //when
-        BadRequestFault ex = new BadRequestFault(ERROR_PI_NO_EXISTS);
-        mockSml.setThrowException(ex);
         boolean suc = testInstance.unregisterFromDns(PARTICIPANT_ID, DEFAULT_DOMAIN);
 
+        //then
         assertTrue(suc);
     }
 
-
     @Test
     public void testIsOkMessageForParticipantNull() {
-
+        //when
         boolean suc = testInstance.isOkMessage(PARTICIPANT_ID, null);
 
+        //then
         assertFalse(suc);
     }
 
     @Test
     public void testIsOkMessageForParticipantOk() {
+        //when
         boolean suc = testInstance.isOkMessage(PARTICIPANT_ID, ERROR_PI_ALREADY_EXISTS);
 
+        //then
         assertTrue(suc);
     }
 
     @Test
     public void testIsOkMessageForParticipantFalse() {
+        //when
         boolean suc = testInstance.isOkMessage(PARTICIPANT_ID, ERROR_UNEXPECTED_MESSAGE);
 
+        //then
         assertFalse(suc);
     }
 
-
     @Test
     public void testProcessSMLErrorMessageBadRequestFaultIgnore() {
-
+        //given
         BadRequestFault ex = new BadRequestFault(ERROR_PI_ALREADY_EXISTS);
+
+        //when
         boolean suc = testInstance.processSMLErrorMessage(ex, PARTICIPANT_ID);
 
+        //then
         assertTrue(suc);
     }
 
     @Test
     public void testProcessSMLErrorMessageBadRequestFaultFailed() {
-
+        //given
         BadRequestFault ex = new BadRequestFault(ERROR_UNEXPECTED_MESSAGE);
 
+        //when
         SMPRuntimeException result = assertThrows(SMPRuntimeException.class, () -> testInstance.processSMLErrorMessage(ex, PARTICIPANT_ID));
-        MatcherAssert.assertThat(result.getMessage(), CoreMatchers.containsString(ERROR_UNEXPECTED_MESSAGE));
-    }
 
+        //then
+        MatcherAssert.assertThat(result.getMessage(), CoreMatchers.containsStringIgnoringCase(ERROR_UNEXPECTED_MESSAGE));
+    }
 
     @Test
     public void testProcessSMLErrorMessageNoFoundFaultFailed() {
-
+        //given
         NotFoundFault ex = new NotFoundFault(ERROR_UNEXPECTED_MESSAGE);
 
+        //when
         SMPRuntimeException result = assertThrows(SMPRuntimeException.class, () -> testInstance.processSMLErrorMessage(ex, PARTICIPANT_ID));
-        MatcherAssert.assertThat(result.getMessage(), CoreMatchers.containsString(ERROR_UNEXPECTED_MESSAGE));
-
 
+        //then
+        MatcherAssert.assertThat(result.getMessage(), CoreMatchers.containsStringIgnoringCase(ERROR_UNEXPECTED_MESSAGE));
     }
 
     @Test
     public void testProcessSMLErrorMessageNoFoundFaultOk() {
-
+        //given
         NotFoundFault ex = new NotFoundFault(ERROR_PI_NO_EXISTS);
 
+        //when
         testInstance.processSMLErrorMessage(ex, PARTICIPANT_ID);
     }
 
+    @Test
+    public void participantExists() throws Exception {
+        // given
+        ExistsParticipantResponseType existingParticipant = new ExistsParticipantResponseType();
+        existingParticipant.setExist(true);
+        Mockito.when(domain.isSmlRegistered()).thenReturn(true);
+        Mockito.when(domain.getSmlSmpId()).thenReturn("smlSmpId");
+        Mockito.when(identifier.getValue()).thenReturn("identifierValue");
+        Mockito.when(identifier.getScheme()).thenReturn("identifierScheme");
+        Mockito.when(ibdmslServiceWS.existsParticipantIdentifier(any(ParticipantsType.class))).thenReturn(existingParticipant);
+
+        Mockito.doNothing().when(testInstance).configureClient(anyString(), any(), any(DBDomain.class));
+
+        // when
+        boolean result = testInstance.participantExists(identifier, domain);
+
+        // then
+        Assert.assertTrue("Should have returned true when the participant exists", result);
+    }
+
+    @Test
+    public void participantExists_wrapsBadRequestFaultIntoSmpRuntimeException() throws Exception {
+        // given
+        String errorMessage = UUID.randomUUID().toString();
+        Mockito.when(domain.isSmlRegistered()).thenReturn(true);
+        Mockito.when(domain.getSmlSmpId()).thenReturn("smlSmpId");
+        Mockito.when(identifier.getValue()).thenReturn("identifierValue");
+        Mockito.when(identifier.getScheme()).thenReturn("identifierScheme");
+        Mockito.when(ibdmslServiceWS.existsParticipantIdentifier(any(ParticipantsType.class))).thenThrow(new BadRequestFault(errorMessage));
+
+        Mockito.doNothing().when(testInstance).configureClient(anyString(), any(), any(DBDomain.class));
+
+        // when
+        SMPRuntimeException smpRuntimeException = assertThrows(SMPRuntimeException.class, () ->
+                testInstance.participantExists(identifier, domain));
+
+        // then
+        Assert.assertEquals("Should have returned an SMPRuntimeException wrapping the original BadRequestFault when thrown while looking up whether a participant exists or not",
+                "SML integration error! Error: BadRequestFault: " + errorMessage,
+                smpRuntimeException.getMessage().trim());
+    }
+
+    @Test
+    public void participantExists_wrapsNotFoundFaultIntoSmpRuntimeException() throws Exception {
+        // given
+        String errorMessage = UUID.randomUUID().toString();
+        Mockito.when(domain.isSmlRegistered()).thenReturn(true);
+        Mockito.when(domain.getSmlSmpId()).thenReturn("smlSmpId");
+        Mockito.when(identifier.getValue()).thenReturn("identifierValue");
+        Mockito.when(identifier.getScheme()).thenReturn("identifierScheme");
+        Mockito.when(ibdmslServiceWS.existsParticipantIdentifier(any(ParticipantsType.class))).thenThrow(new NotFoundFault(errorMessage));
+
+        Mockito.doNothing().when(testInstance).configureClient(anyString(), any(), any(DBDomain.class));
+
+        // when
+        SMPRuntimeException smpRuntimeException = assertThrows(SMPRuntimeException.class, () ->
+                testInstance.participantExists(identifier, domain));
+
+        // then
+        Assert.assertEquals("Should have returned an SMPRuntimeException wrapping the original NotFoundFault when thrown while looking up whether a participant exists or not",
+                "SML integration error! Error: NotFoundFault: " + errorMessage,
+                smpRuntimeException.getMessage().trim());
+    }
+
+    @Test
+    public void participantExists_wrapsCheckedExceptionsIntoSmpRuntimeException() throws Exception {
+        // given
+        String errorMessage = UUID.randomUUID().toString();
+        Mockito.when(domain.isSmlRegistered()).thenReturn(true);
+        Mockito.when(domain.getSmlSmpId()).thenReturn("smlSmpId");
+        Mockito.when(identifier.getValue()).thenReturn("identifierValue");
+        Mockito.when(identifier.getScheme()).thenReturn("identifierScheme");
+        // We need to match one of the checked exceptions present in the method signature, so we throw InternalErrorFault which will be handled aside
+        Mockito.when(ibdmslServiceWS.existsParticipantIdentifier(any(ParticipantsType.class))).thenThrow(new InternalErrorFault(errorMessage));
+
+        Mockito.doNothing().when(testInstance).configureClient(anyString(), any(), any(DBDomain.class));
+
+        // when
+        SMPRuntimeException smpRuntimeException = assertThrows(SMPRuntimeException.class, () ->
+                testInstance.participantExists(identifier, domain));
+
+        // then
+        Assert.assertEquals("Should have returned an SMPRuntimeException wrapping the original Exception when thrown while looking up whether a participant exists or not",
+                "SML integration error! Error: InternalErrorFault: " + errorMessage,
+                smpRuntimeException.getMessage().trim());
+    }
+
+    @Test
+    public void participantExists_smlIntegrationDisabled() {
+        // given
+        Mockito.doReturn(false).when(configurationService).isSMLIntegrationEnabled();
+
+        // when
+        boolean result = testInstance.participantExists(identifier, domain);
+
+        // then
+        Assert.assertFalse("The participant should have been returned as non-existing when the SML integration is not enabled", result);
+    }
 
+    @Test
+    public void participantExists_unregisteredDomain() {
+        // given
+        Mockito.when(domain.isSmlRegistered()).thenReturn(false);
+
+        // when
+        boolean result = testInstance.participantExists(identifier, domain);
+
+        // then
+        Assert.assertFalse("The participant should have been returned as non-existing when the domain is not registered in SML", result);
+    }
 }
diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/testutil/TestConstants.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/testutil/TestConstants.java
index 0177ef7eb9ec970acabf35d6c6924f3b77ae5165..c93a83fee0af1ea3a5123b18e597b9a4638bb6f0 100644
--- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/testutil/TestConstants.java
+++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/testutil/TestConstants.java
@@ -36,6 +36,7 @@ public class TestConstants {
 
     public static final String TEST_DOMAIN_CODE_1 = "utestPeppol01";
     public static final String TEST_DOMAIN_CODE_2 = "utestEHhealth02";
+    public static final String TEST_DOMAIN_CODE_3 = "utestRegistered03";
 
     public static final String TEST_SML_SUBDOMAIN_CODE_1 = ""; // peppol subdomain is empty string
     public static final String TEST_SML_SUBDOMAIN_CODE_2 = "ehealth";