@Test public void simpleServiceGroup() throws Exception { ServiceGroup serviceGroup = ServiceGroupBuilder.newInstance(ParticipantIdentifier.of("9908:999999999")) .add(ServiceReference.of(DTI_INVOICE)) .build(); Mockito.when(serviceGroupProvider.get(Mockito.any(ParticipantIdentifier.class))) .thenReturn(serviceGroup); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); publisherService.serviceGroup(byteArrayOutputStream, null, URI.create("http: ParticipantIdentifier.of("9908:999999999")); List<ServiceReference> result = metadataReader.parseServiceGroup( new FetcherResponse(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()), null)); Assert.assertEquals(result.size(), 1); Assert.assertEquals(result.get(0).getDocumentTypeIdentifier().toString(), DTI_INVOICE.toString()); }
public void serviceGroup(OutputStream outputStream, String syntax, URI rootUri, ParticipantIdentifier participantIdentifier) throws JAXBException, PublisherException { ServiceGroup serviceGroup = serviceGroupProvider.get(participantIdentifier); PublisherSyntax publisherSyntax = publisherSyntaxProvider.getSyntax(syntax); Marshaller marshaller = publisherSyntax.getMarshaller(); marshaller.marshal(publisherSyntax.of(serviceGroup, rootUri), outputStream); }
PublisherService extends HttpServlet { public void serviceGroup(OutputStream outputStream, String syntax, URI rootUri, ParticipantIdentifier participantIdentifier) throws JAXBException, PublisherException { ServiceGroup serviceGroup = serviceGroupProvider.get(participantIdentifier); PublisherSyntax publisherSyntax = publisherSyntaxProvider.getSyntax(syntax); Marshaller marshaller = publisherSyntax.getMarshaller(); marshaller.marshal(publisherSyntax.of(serviceGroup, rootUri), outputStream); } }
PublisherService extends HttpServlet { public void serviceGroup(OutputStream outputStream, String syntax, URI rootUri, ParticipantIdentifier participantIdentifier) throws JAXBException, PublisherException { ServiceGroup serviceGroup = serviceGroupProvider.get(participantIdentifier); PublisherSyntax publisherSyntax = publisherSyntaxProvider.getSyntax(syntax); Marshaller marshaller = publisherSyntax.getMarshaller(); marshaller.marshal(publisherSyntax.of(serviceGroup, rootUri), outputStream); } PublisherService(ServiceGroupProvider serviceGroupProvider,
                            ServiceMetadataProvider serviceMetadataProvider,
                            PublisherSyntaxProvider publisherSyntaxProvider,
                            Signer signer); }
PublisherService extends HttpServlet { public void serviceGroup(OutputStream outputStream, String syntax, URI rootUri, ParticipantIdentifier participantIdentifier) throws JAXBException, PublisherException { ServiceGroup serviceGroup = serviceGroupProvider.get(participantIdentifier); PublisherSyntax publisherSyntax = publisherSyntaxProvider.getSyntax(syntax); Marshaller marshaller = publisherSyntax.getMarshaller(); marshaller.marshal(publisherSyntax.of(serviceGroup, rootUri), outputStream); } PublisherService(ServiceGroupProvider serviceGroupProvider,
                            ServiceMetadataProvider serviceMetadataProvider,
                            PublisherSyntaxProvider publisherSyntaxProvider,
                            Signer signer); void serviceGroup(OutputStream outputStream, String syntax, URI rootUri,
                             ParticipantIdentifier participantIdentifier); void metadataProvider(OutputStream outputStream, String syntax, ParticipantIdentifier participantIdentifier,
                                 DocumentTypeIdentifier documentTypeIdentifier); }
PublisherService extends HttpServlet { public void serviceGroup(OutputStream outputStream, String syntax, URI rootUri, ParticipantIdentifier participantIdentifier) throws JAXBException, PublisherException { ServiceGroup serviceGroup = serviceGroupProvider.get(participantIdentifier); PublisherSyntax publisherSyntax = publisherSyntaxProvider.getSyntax(syntax); Marshaller marshaller = publisherSyntax.getMarshaller(); marshaller.marshal(publisherSyntax.of(serviceGroup, rootUri), outputStream); } PublisherService(ServiceGroupProvider serviceGroupProvider,
                            ServiceMetadataProvider serviceMetadataProvider,
                            PublisherSyntaxProvider publisherSyntaxProvider,
                            Signer signer); void serviceGroup(OutputStream outputStream, String syntax, URI rootUri,
                             ParticipantIdentifier participantIdentifier); void metadataProvider(OutputStream outputStream, String syntax, ParticipantIdentifier participantIdentifier,
                                 DocumentTypeIdentifier documentTypeIdentifier);  }