SMPClientReadOnly extends AbstractGenericSMPClient <SMPClientReadOnly> implements
                               ISMPServiceGroupProvider,
                               ISMPServiceMetadataProvider { @Nullable public SignedServiceMetadataType getServiceMetadataOrNull (@Nonnull final IParticipantIdentifier aServiceGroupID, @Nonnull final IDocumentTypeIdentifier aDocumentTypeID) throws SMPClientException { try { return getServiceMetadata (aServiceGroupID, aDocumentTypeID); } catch (final SMPClientNotFoundException ex) { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Found no ServiceMetadata"); return null; } } SMPClientReadOnly(@Nonnull final ISMPURLProvider aURLProvider,
                            @Nonnull final IParticipantIdentifier aParticipantIdentifier,
                            @Nonnull final ISMLInfo aSMLInfo);  SMPClientReadOnly(@Nonnull final ISMPURLProvider aURLProvider,
                            @Nonnull final IParticipantIdentifier aParticipantIdentifier,
                            @Nonnull @Nonempty final String sSMLZoneName);  SMPClientReadOnly(@Nonnull final URI aSMPHost); @Nonnull ServiceGroupReferenceListType getServiceGroupReferenceList(@Nonnull final String sUserID,
                                                                     @Nonnull final BasicAuthClientCredentials aCredentials); @Nullable ServiceGroupReferenceListType getServiceGroupReferenceListOrNull(@Nonnull final String sUserID,
                                                                           @Nonnull final BasicAuthClientCredentials aCredentials); @Nonnull CompleteServiceGroupType getCompleteServiceGroup(@Nonnull final String sCompleteURI); @Nonnull CompleteServiceGroupType getCompleteServiceGroup(@Nonnull final IParticipantIdentifier aServiceGroupID); @Nullable CompleteServiceGroupType getCompleteServiceGroupOrNull(@Nonnull final IParticipantIdentifier aServiceGroupID); @Nonnull ServiceGroupType getServiceGroup(@Nonnull final IParticipantIdentifier aServiceGroupID); @Nullable ServiceGroupType getServiceGroupOrNull(@Nonnull final IParticipantIdentifier aServiceGroupID); @Nonnull static ICommonsList <IDocumentTypeIdentifier> getAllDocumentTypes(@Nullable final ServiceGroupType aSG); @Nonnull static ICommonsList <IDocumentTypeIdentifier> getAllDocumentTypes(@Nullable final ServiceGroupType aSG,
                                                                            @Nonnull final IIdentifierFactory aIdentifierFactory,
                                                                            @Nullable final Consumer <String> aUnhandledHrefHandler); @Nonnull SignedServiceMetadataType getServiceMetadata(@Nonnull final IParticipantIdentifier aServiceGroupID,
                                                       @Nonnull final IDocumentTypeIdentifier aDocumentTypeID); @Nullable SignedServiceMetadataType getServiceMetadataOrNull(@Nonnull final IParticipantIdentifier aServiceGroupID,
                                                             @Nonnull final IDocumentTypeIdentifier aDocumentTypeID); @Nullable static EndpointType getEndpoint(@Nonnull final SignedServiceMetadataType aSignedServiceMetadata,
                                          @Nonnull final IProcessIdentifier aProcessID,
                                          @Nonnull final ISMPTransportProfile aTransportProfile); @Nullable static String getEndpointAddress(@Nullable final EndpointType aEndpoint); @Nullable static String getEndpointCertificateString(@Nullable final EndpointType aEndpoint); @Nullable static X509Certificate getEndpointCertificate(@Nullable final EndpointType aEndpoint); @Nonnull static CompleteServiceGroupType getCompleteServiceGroupByDNS(@Nonnull final ISMPURLProvider aURLProvider,
                                                                       @Nonnull final ISMLInfo aSMLInfo,
                                                                       @Nonnull final IParticipantIdentifier aServiceGroupID); @Nonnull static ServiceGroupType getServiceGroupByDNS(@Nonnull final ISMPURLProvider aURLProvider,
                                                       @Nonnull final ISMLInfo aSMLInfo,
                                                       @Nonnull final IParticipantIdentifier aServiceGroupID); @Nonnull static SignedServiceMetadataType getServiceRegistrationByDNS(@Nonnull final ISMPURLProvider aURLProvider,
                                                                       @Nonnull final ISMLInfo aSMLInfo,
                                                                       @Nonnull final IParticipantIdentifier aServiceGroupID,
                                                                       @Nonnull final IDocumentTypeIdentifier aDocumentTypeID); static final String URL_PART_COMPLETE; static final String URL_PART_LIST; static final String URL_PART_SERVICES; }
@Test public void testInvalidTrustStore () throws SMPDNSResolutionException, SMPClientException, GeneralSecurityException, IOException { final IParticipantIdentifier aPI = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme ("9915:test"); final SMPClientReadOnly aSMPClient = new SMPClientReadOnly (PeppolURLProvider.INSTANCE, aPI, ESML.DIGIT_TEST); { final KeyStore aTS = KeyStoreHelper.loadKeyStoreDirect (EKeyStoreType.JKS, "truststore-outdated.jks", "peppol"); assertNotNull (aTS); aSMPClient.setTrustStore (aTS); } try { aSMPClient.getServiceMetadataOrNull (aPI, EPredefinedDocumentTypeIdentifier.INVOICE_EN16931_PEPPOL_V30); fail (); } catch (final SMPClientBadResponseException ex) { assertNotNull (ex.getCause ()); assertTrue (ex.getCause () instanceof XMLSignatureException); } }
@Test public void test2303 () throws Exception { final IParticipantIdentifier aPI = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme ("9925:be0887290276"); final SMPClientReadOnly aSMPClient = new SMPClientReadOnly (PeppolURLProvider.INSTANCE, aPI, ESML.DIGIT_PRODUCTION); assertEquals ("http: aSMPClient.getSMPHostURI ()); aSMPClient.setXMLSchemaValidation (true); final SignedServiceMetadataType aSM = aSMPClient.getServiceMetadataOrNull (aPI, EPredefinedDocumentTypeIdentifier.INVOICE_EN16931_PEPPOL_V30); assertNotNull (aSM); }