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;
}
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);
}
}
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);
}
}
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);
}
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;
}
Aggregations