Search in sources :

Example 6 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 7 with SMLInfo

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

the class BDXRClientReadOnlyTest method testReadTOOP.

@Test
@Ignore("Because it may take long to execute")
@IgnoredNaptrTest
public void testReadTOOP() throws SMPDNSResolutionException, SMPClientException {
    final IParticipantIdentifier aPI = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme("9930:167064991");
    final IDocumentTypeIdentifier aDocTypeID = SimpleIdentifierFactory.INSTANCE.createDocumentTypeIdentifier("toop-doctypeid-qns", "urn:eu:toop:ns:dataexchange-1p40::Response##urn:eu.toop.response.registeredorganization::1.40");
    // TOOP SML
    final ISMLInfo aSMLInfo = new SMLInfo("toop", "SMK", "toop.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);
    aBDXRClient.setVerifySignature(false);
    assertEquals("http://smp.toop.egov.iwvi.uni-koblenz.de/", aBDXRClient.getSMPHostURI());
    if (false) {
        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 8 with SMLInfo

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

the class BDXRClientReadOnlyTest method testReadDE4A.

@Test
@Ignore("Because it may take long to execute")
@IgnoredNaptrTest
public void testReadDE4A() throws Exception {
    final IParticipantIdentifier aPI = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme("9999:at000000271");
    final IDocumentTypeIdentifier aDocTypeID = SimpleIdentifierFactory.INSTANCE.createDocumentTypeIdentifier("urn:de4a-eu:CanonicalEvidenceType", "CompanyRegistration");
    final KeyStore aTS = KeyStoreHelper.loadKeyStoreDirect(EKeyStoreType.JKS, "truststores/de4a-truststore-test-smp-pw-de4a.jks", "de4a");
    assertNotNull(aTS);
    // TOOP SML
    final ISMLInfo aSMLInfo = new SMLInfo("dea4", "SMK", "de4a.acc.edelivery.tech.ec.europa.eu.", "https://acc.edelivery.tech.ec.europa.eu/edelivery-sml", true);
    // BDXL URL provider
    final BDXRClientReadOnly aBDXRClient = new BDXRClientReadOnly(BDXLURLProvider.INSTANCE, aPI, aSMLInfo);
    // Custom truststore is needed atm
    aBDXRClient.setTrustStore(aTS);
    assertEquals("https://de4a-smp.egovlab.eu/", 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) KeyStore(java.security.KeyStore) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) Ignore(org.junit.Ignore) IgnoredNaptrTest(com.helger.smpclient.IgnoredNaptrTest) IgnoredNaptrTest(com.helger.smpclient.IgnoredNaptrTest) Test(org.junit.Test)

Example 9 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)

Example 10 with SMLInfo

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

the class SMLInfoManagerMongoDB 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);
    if (!getCollection().insertOne(toBson(aSMLInfo)).wasAcknowledged())
        throw new IllegalStateException("Failed to insert into MongoDB Collection");
    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)

Aggregations

SMLInfo (com.helger.peppol.sml.SMLInfo)14 ISMLInfo (com.helger.peppol.sml.ISMLInfo)11 Nonnull (javax.annotation.Nonnull)8 Test (org.junit.Test)4 EChange (com.helger.commons.state.EChange)3 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 ISMLConfiguration (com.helger.peppol.domain.ISMLConfiguration)2 SMLConfiguration (com.helger.peppol.domain.SMLConfiguration)2 Nullable (javax.annotation.Nullable)2 ESMPAPIType (com.helger.peppol.sml.ESMPAPIType)1 ESMPIdentifierType (com.helger.peppolid.factory.ESMPIdentifierType)1 IMicroElement (com.helger.xml.microdom.IMicroElement)1 KeyStore (java.security.KeyStore)1 Document (org.bson.Document)1