Search in sources :

Example 1 with SMLInfo

use of com.helger.peppol.sml.SMLInfo in project phoss-directory by phax.

the class SMLInfoManager method removeSMLInfo.

@Nullable
public EChange removeSMLInfo(@Nullable final String sSMLInfoID) {
    if (StringHelper.hasNoText(sSMLInfoID))
        return EChange.UNCHANGED;
    m_aRWLock.writeLock().lock();
    try {
        final SMLInfo aSMLInfo = internalDeleteItem(sSMLInfoID);
        if (aSMLInfo == null) {
            AuditHelper.onAuditDeleteFailure(SMLInfo.OT, "no-such-id", sSMLInfoID);
            return EChange.UNCHANGED;
        }
    } finally {
        m_aRWLock.writeLock().unlock();
    }
    AuditHelper.onAuditDeleteSuccess(SMLInfo.OT, sSMLInfoID);
    return EChange.CHANGED;
}
Also used : SMLInfo(com.helger.peppol.sml.SMLInfo) ISMLInfo(com.helger.peppol.sml.ISMLInfo) Nullable(javax.annotation.Nullable)

Example 2 with SMLInfo

use of com.helger.peppol.sml.SMLInfo in project phoss-directory by phax.

the class SMLInfoManager method createSMLInfo.

@Nonnull
public ISMLInfo createSMLInfo(@Nonnull @Nonempty final String sDisplayName, @Nonnull @Nonempty final String sDNSZone, @Nonnull @Nonempty final String sManagementServiceURL, final boolean bClientCertificateRequired) {
    final SMLInfo aSMLInfo = new SMLInfo(sDisplayName, sDNSZone, sManagementServiceURL, bClientCertificateRequired);
    m_aRWLock.writeLocked(() -> {
        internalCreateItem(aSMLInfo);
    });
    AuditHelper.onAuditCreateSuccess(SMLInfo.OT, aSMLInfo.getID(), sDisplayName, sDNSZone, sManagementServiceURL, Boolean.valueOf(bClientCertificateRequired));
    return aSMLInfo;
}
Also used : SMLInfo(com.helger.peppol.sml.SMLInfo) ISMLInfo(com.helger.peppol.sml.ISMLInfo) Nonnull(javax.annotation.Nonnull)

Example 3 with SMLInfo

use of com.helger.peppol.sml.SMLInfo in project peppol-commons by phax.

the class BDXRClientReadOnlyTest method testReadConnectivityTest.

@Test
@Ignore("Because it may take long to execute")
@IgnoredNaptrTest
public void testReadConnectivityTest() throws SMPDNSResolutionException, SMPClientException {
    final IParticipantIdentifier aPI = SimpleIdentifierFactory.INSTANCE.createParticipantIdentifier("connectivity-partid-qns", "dynceftest1party59gw");
    final IDocumentTypeIdentifier aDocTypeID = SimpleIdentifierFactory.INSTANCE.createDocumentTypeIdentifier("connectivity-docid-qns", "doc_id1");
    // TOOP SML
    final ISMLInfo aSMLInfo = new SMLInfo("cef-connectivity", "CEF ConnectivityTest", "connectivitytest.acc.edelivery.tech.ec.europa.eu.", "https://acc.edelivery.tech.ec.europa.eu/edelivery-sml", true);
    // PEPPOL URL provider
    final BDXRClientReadOnly aBDXRClient = new BDXRClientReadOnly(BDXLURLProvider.INSTANCE, aPI, aSMLInfo);
    // We don't have the truststore at hand - ignore it
    aBDXRClient.setVerifySignature(false);
    assertEquals("https://gateway-edelivery.westeurope.cloudapp.azure.com:444/", aBDXRClient.getSMPHostURI());
    final SignedServiceMetadataType aMetadata = aBDXRClient.getServiceMetadata(aPI, aDocTypeID);
    assertNotNull(aMetadata);
}
Also used : ISMLInfo(com.helger.peppol.sml.ISMLInfo) IDocumentTypeIdentifier(com.helger.peppolid.IDocumentTypeIdentifier) SignedServiceMetadataType(com.helger.xsds.bdxr.smp1.SignedServiceMetadataType) SMLInfo(com.helger.peppol.sml.SMLInfo) ISMLInfo(com.helger.peppol.sml.ISMLInfo) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) Ignore(org.junit.Ignore) IgnoredNaptrTest(com.helger.smpclient.IgnoredNaptrTest) IgnoredNaptrTest(com.helger.smpclient.IgnoredNaptrTest) Test(org.junit.Test)

Example 4 with SMLInfo

use of com.helger.peppol.sml.SMLInfo in project phoss-directory by phax.

the class SMLInfoManager method updateSMLInfo.

@Nonnull
public EChange updateSMLInfo(@Nullable final String sSMLInfoID, @Nonnull @Nonempty final String sDisplayName, @Nonnull @Nonempty final String sDNSZone, @Nonnull @Nonempty final String sManagementServiceURL, final boolean bClientCertificateRequired) {
    final SMLInfo aSMLInfo = getOfID(sSMLInfoID);
    if (aSMLInfo == null) {
        AuditHelper.onAuditModifyFailure(SMLInfo.OT, sSMLInfoID, "no-such-id");
        return EChange.UNCHANGED;
    }
    m_aRWLock.writeLock().lock();
    try {
        EChange eChange = EChange.UNCHANGED;
        eChange = eChange.or(aSMLInfo.setDisplayName(sDisplayName));
        eChange = eChange.or(aSMLInfo.setDNSZone(sDNSZone));
        eChange = eChange.or(aSMLInfo.setManagementServiceURL(sManagementServiceURL));
        eChange = eChange.or(aSMLInfo.setClientCertificateRequired(bClientCertificateRequired));
        if (eChange.isUnchanged())
            return EChange.UNCHANGED;
        internalUpdateItem(aSMLInfo);
    } finally {
        m_aRWLock.writeLock().unlock();
    }
    AuditHelper.onAuditModifySuccess(SMLInfo.OT, "all", sSMLInfoID, sDisplayName, sDNSZone, sManagementServiceURL, Boolean.valueOf(bClientCertificateRequired));
    return EChange.CHANGED;
}
Also used : SMLInfo(com.helger.peppol.sml.SMLInfo) ISMLInfo(com.helger.peppol.sml.ISMLInfo) EChange(com.helger.commons.state.EChange) Nonnull(javax.annotation.Nonnull)

Example 5 with SMLInfo

use of com.helger.peppol.sml.SMLInfo in project phoss-smp by phax.

the class SMLInfoManagerMongoDBTest method testConversion.

@Test
public void testConversion() {
    final ISMLInfo aInfo = new SMLInfo("displayName", "DNSZone", "https://url/url", true);
    final Document aSrc = SMLInfoManagerMongoDB.toBson(aInfo);
    assertNotNull(aSrc);
    final ISMLInfo aSrc2 = SMLInfoManagerMongoDB.toDomain(aSrc);
    assertNotNull(aSrc2);
    assertEquals(aInfo, aSrc2);
}
Also used : ISMLInfo(com.helger.peppol.sml.ISMLInfo) ISMLInfo(com.helger.peppol.sml.ISMLInfo) SMLInfo(com.helger.peppol.sml.SMLInfo) Document(org.bson.Document) Test(org.junit.Test)

Aggregations

ISMLInfo (com.helger.peppol.sml.ISMLInfo)11 SMLInfo (com.helger.peppol.sml.SMLInfo)11 Nonnull (javax.annotation.Nonnull)5 Test (org.junit.Test)4 IDocumentTypeIdentifier (com.helger.peppolid.IDocumentTypeIdentifier)3 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)3 IgnoredNaptrTest (com.helger.smpclient.IgnoredNaptrTest)3 SignedServiceMetadataType (com.helger.xsds.bdxr.smp1.SignedServiceMetadataType)3 Ignore (org.junit.Ignore)3 EChange (com.helger.commons.state.EChange)2 Nullable (javax.annotation.Nullable)2 KeyStore (java.security.KeyStore)1 Document (org.bson.Document)1