PersistenceProtoFilesLabeler implements Labeler { @Override public Map<String, String> generateLabels() { return encodedProtos; }  void processProto(final File file); @Override Map<String, String> generateLabels(); static final String PROTO_FILE_EXT; }
@Test void testGenerateLabels() throws URISyntaxException, IOException { final PersistenceProtoFilesLabeler labeler = new PersistenceProtoFilesLabeler(); final File protoFile = new File(this.getClass().getResource("/kogito-types.proto").toURI()); final File kogitoApplication = new File(this.getClass().getResource("/kogito-application.proto").toURI()); String originalContent = new String(Files.readAllBytes(protoFile.toPath())); assertThat(protoFile).isNotNull(); assertThat(kogitoApplication).isNotNull(); labeler.processProto(protoFile); labeler.processProto(kogitoApplication); final Map<String, String> labels = labeler.generateLabels(); assertThat(labels).size().isEqualTo(1); assertThat(labels).containsKey(labeler.generateKey(protoFile)); final byte[] bytes = Base64.getDecoder().decode(labels.get("org.kie/persistence/proto/kogito-types.proto")); byte[] decompresed = decompres(bytes); String roundTrip = new String(decompresed); assertThat(roundTrip).isEqualTo(originalContent); }