Search in sources :

Example 26 with IParticipantIdentifier

use of com.helger.peppolid.IParticipantIdentifier in project peppol-commons by phax.

the class MainCheckBogusCertificateStrings method main.

public static void main(final String[] args) throws CertificateException, SMPClientException, SMPDNSResolutionException {
    final IParticipantIdentifier aPI = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme("9906:testconsip");
    final SMPClientReadOnly aSMPClient = new SMPClientReadOnly(URL_PROVIDER, aPI, ESML.DIGIT_TEST);
    final X509Certificate aCert = aSMPClient.getEndpointCertificate(aPI, PeppolIdentifierFactory.INSTANCE.createDocumentTypeIdentifierWithDefaultScheme("urn:oasis:names:specification:ubl:schema:xsd:Order-2::Order##urn:www.cenbii.eu:transaction:biitrns001:ver2.0:extended:urn:www.peppol.eu:bis:peppol3a:ver2.0::2.1"), PeppolIdentifierFactory.INSTANCE.createProcessIdentifierWithDefaultScheme("urn:www.cenbii.eu:profile:bii03:ver2.0"), ESMPTransportProfile.TRANSPORT_PROFILE_AS2);
    LOGGER.info(String.valueOf(aCert));
}
Also used : SMPClientReadOnly(com.helger.smpclient.peppol.SMPClientReadOnly) X509Certificate(java.security.cert.X509Certificate) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Example 27 with IParticipantIdentifier

use of com.helger.peppolid.IParticipantIdentifier in project peppol-commons by phax.

the class MainCheckIfSMPIsWorking method main.

public static void main(final String[] args) throws Exception {
    final URI SMP_URI = MockSMPClientConfig.getSMPURI();
    final BasicAuthClientCredentials SMP_CREDENTIALS = MockSMPClientConfig.getSMPCredentials();
    final IParticipantIdentifier PARTICIPANT_ID = MockSMPClientConfig.getParticipantID();
    // The main SMP client
    final SMPClient aClient = new SMPClient(SMP_URI);
    // Ensure that the service group does not exist
    LOGGER.info("Ensuring that the service group is not existing!");
    if (aClient.getServiceGroupOrNull(PARTICIPANT_ID) != null) {
        LOGGER.info("Deleting existing service group for init");
        aClient.deleteServiceGroup(PARTICIPANT_ID, SMP_CREDENTIALS);
        LOGGER.info("Finished deletion of service group");
    }
    // Create, read and delete the service group
    LOGGER.info("Creating the new service group");
    aClient.saveServiceGroup(PARTICIPANT_ID, SMP_CREDENTIALS);
    LOGGER.info("Retrieving the service group");
    final ServiceGroupType aSGT = aClient.getServiceGroup(PARTICIPANT_ID);
    if (!SimpleParticipantIdentifier.wrap(aSGT.getParticipantIdentifier()).equals(PARTICIPANT_ID))
        throw new IllegalStateException("Participant identifiers are not equal!");
    LOGGER.info("Deleting the service group again");
    aClient.deleteServiceGroup(PARTICIPANT_ID, SMP_CREDENTIALS);
    LOGGER.info("Checking if the service group is really deleted");
    if (aClient.getServiceGroupOrNull(PARTICIPANT_ID) != null)
        throw new IllegalStateException("Deletion of the service group failed!");
    LOGGER.info("Seems like the SMP is working as expected!");
}
Also used : BasicAuthClientCredentials(com.helger.http.basicauth.BasicAuthClientCredentials) SMPClient(com.helger.smpclient.peppol.SMPClient) URI(java.net.URI) ServiceGroupType(com.helger.xsds.peppol.smp1.ServiceGroupType) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Example 28 with IParticipantIdentifier

use of com.helger.peppolid.IParticipantIdentifier in project peppol-commons by phax.

the class MainSMPServiceGroupCompleteList method main.

public static void main(final String[] args) throws Exception {
    final URI SMP_URI = MockSMPClientConfig.getSMPURI();
    final IParticipantIdentifier PARTICIPANT_ID = MockSMPClientConfig.getParticipantID();
    // The main SMP client
    final SMPClient aClient = new SMPClient(SMP_URI);
    // Get the service group reference list
    final CompleteServiceGroupType aCompleteServiceGroup = aClient.getCompleteServiceGroupOrNull(PARTICIPANT_ID);
    if (aCompleteServiceGroup == null)
        LOGGER.error("Failed to get complete service group for " + PARTICIPANT_ID);
    else {
        LOGGER.info(SMPDebugHelper.getAsString(aCompleteServiceGroup.getServiceGroup()));
        for (final ServiceMetadataType aServiceMetadata : aCompleteServiceGroup.getServiceMetadata()) LOGGER.info(SMPDebugHelper.getAsString(aServiceMetadata));
    }
    LOGGER.info("Done");
}
Also used : CompleteServiceGroupType(com.helger.xsds.peppol.smp1.CompleteServiceGroupType) SMPClient(com.helger.smpclient.peppol.SMPClient) URI(java.net.URI) ServiceMetadataType(com.helger.xsds.peppol.smp1.ServiceMetadataType) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Example 29 with IParticipantIdentifier

use of com.helger.peppolid.IParticipantIdentifier in project peppol-commons by phax.

the class MainSMPServiceGroupDelete method main.

public static void main(final String[] args) throws Exception {
    final URI SMP_URI = MockSMPClientConfig.getSMPURI();
    final BasicAuthClientCredentials SMP_CREDENTIALS = MockSMPClientConfig.getSMPCredentials();
    final IParticipantIdentifier PARTICIPANT_ID = MockSMPClientConfig.getParticipantID();
    // The main SMP client
    final SMPClient aClient = new SMPClient(SMP_URI);
    // Delete the service group
    aClient.deleteServiceGroup(PARTICIPANT_ID, SMP_CREDENTIALS);
    LOGGER.info("Done");
}
Also used : BasicAuthClientCredentials(com.helger.http.basicauth.BasicAuthClientCredentials) SMPClient(com.helger.smpclient.peppol.SMPClient) URI(java.net.URI) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Example 30 with IParticipantIdentifier

use of com.helger.peppolid.IParticipantIdentifier 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)

Aggregations

IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)218 Test (org.junit.Test)70 IDocumentTypeIdentifier (com.helger.peppolid.IDocumentTypeIdentifier)58 IIdentifierFactory (com.helger.peppolid.factory.IIdentifierFactory)57 ISMPServiceGroupManager (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroupManager)51 ISMPServiceGroup (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup)47 File (java.io.File)46 Nonnull (javax.annotation.Nonnull)43 ESimpleUserMessageSendResult (com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult)42 Element (org.w3c.dom.Element)41 SMPClientReadOnly (com.helger.smpclient.peppol.SMPClientReadOnly)40 AS4RawResponseConsumerWriteToFile (com.helger.phase4.dump.AS4RawResponseConsumerWriteToFile)38 AS4IncomingDumperFileBased (com.helger.phase4.dump.AS4IncomingDumperFileBased)35 AS4OutgoingDumperFileBased (com.helger.phase4.dump.AS4OutgoingDumperFileBased)35 SimpleParticipantIdentifier (com.helger.peppolid.simple.participant.SimpleParticipantIdentifier)30 CommonsArrayList (com.helger.commons.collection.impl.CommonsArrayList)24 ISMPServiceInformationManager (com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformationManager)24 SMPServerException (com.helger.phoss.smp.exception.SMPServerException)24 ISMPServiceInformation (com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformation)19 ICommonsList (com.helger.commons.collection.impl.ICommonsList)18