@Test public void testMD5Sum() { URL resource = getClass().getClassLoader().getResource("test.zip"); String md5 = service.calculateMD5(resource); assertEquals("088947832487928ebbc994abe4e2ac33", md5); }
protected String calculateMD5(URL resource) { try (InputStream is = resource.openStream()) { return DigestUtils.md5Hex(is); } catch (Exception e) { throw new ImportExamplesException("Can't calculate md5 for playground.zip", e); } }
ExamplesServiceImpl extends BaseProjectImportService implements ExamplesService { protected String calculateMD5(URL resource) { try (InputStream is = resource.openStream()) { return DigestUtils.md5Hex(is); } catch (Exception e) { throw new ImportExamplesException("Can't calculate md5 for playground.zip", e); } } }
ExamplesServiceImpl extends BaseProjectImportService implements ExamplesService { protected String calculateMD5(URL resource) { try (InputStream is = resource.openStream()) { return DigestUtils.md5Hex(is); } catch (Exception e) { throw new ImportExamplesException("Can't calculate md5 for playground.zip", e); } } @Inject  ExamplesServiceImpl(final @Named("ioStrategy") IOService ioService,
                               final RepositoryFactory repositoryFactory,
                               final KieModuleService moduleService,
                               final OrganizationalUnitService ouService,
                               final WorkspaceProjectService projectService,
                               final MetadataService metadataService,
                               final Event<NewProjectEvent> newProjectEvent,
                               final ProjectScreenService projectScreenService,
                               final ImportProjectValidators validators,
                               final SpaceConfigStorageRegistry spaceConfigStorageRegistry,
                               final @Named("systemFS") FileSystem systemFS,
                               final PathUtil pathUtil,
                               final RepositoryService repoService); }
ExamplesServiceImpl extends BaseProjectImportService implements ExamplesService { protected String calculateMD5(URL resource) { try (InputStream is = resource.openStream()) { return DigestUtils.md5Hex(is); } catch (Exception e) { throw new ImportExamplesException("Can't calculate md5 for playground.zip", e); } } @Inject  ExamplesServiceImpl(final @Named("ioStrategy") IOService ioService,
                               final RepositoryFactory repositoryFactory,
                               final KieModuleService moduleService,
                               final OrganizationalUnitService ouService,
                               final WorkspaceProjectService projectService,
                               final MetadataService metadataService,
                               final Event<NewProjectEvent> newProjectEvent,
                               final ProjectScreenService projectScreenService,
                               final ImportProjectValidators validators,
                               final SpaceConfigStorageRegistry spaceConfigStorageRegistry,
                               final @Named("systemFS") FileSystem systemFS,
                               final PathUtil pathUtil,
                               final RepositoryService repoService); @PostConstruct void initPlaygroundRepository(); @Override ExamplesMetaData getMetaData(); @Override ExampleRepository getPlaygroundRepository(); @Override WorkspaceProjectContextChangeEvent setupExamples(final ExampleOrganizationalUnit exampleTargetOU,
                                                            final List<ImportProject> importProjects); @Override Set<ImportProject> getExampleProjects(OrganizationalUnit targetOu); @Override int priority(); @Override void dispose(); }
ExamplesServiceImpl extends BaseProjectImportService implements ExamplesService { protected String calculateMD5(URL resource) { try (InputStream is = resource.openStream()) { return DigestUtils.md5Hex(is); } catch (Exception e) { throw new ImportExamplesException("Can't calculate md5 for playground.zip", e); } } @Inject  ExamplesServiceImpl(final @Named("ioStrategy") IOService ioService,
                               final RepositoryFactory repositoryFactory,
                               final KieModuleService moduleService,
                               final OrganizationalUnitService ouService,
                               final WorkspaceProjectService projectService,
                               final MetadataService metadataService,
                               final Event<NewProjectEvent> newProjectEvent,
                               final ProjectScreenService projectScreenService,
                               final ImportProjectValidators validators,
                               final SpaceConfigStorageRegistry spaceConfigStorageRegistry,
                               final @Named("systemFS") FileSystem systemFS,
                               final PathUtil pathUtil,
                               final RepositoryService repoService); @PostConstruct void initPlaygroundRepository(); @Override ExamplesMetaData getMetaData(); @Override ExampleRepository getPlaygroundRepository(); @Override WorkspaceProjectContextChangeEvent setupExamples(final ExampleOrganizationalUnit exampleTargetOU,
                                                            final List<ImportProject> importProjects); @Override Set<ImportProject> getExampleProjects(OrganizationalUnit targetOu); @Override int priority(); @Override void dispose();  }