@Test public void createAndFailedToAccessMappingResource() throws TermLookupServiceException, IOException { ResourceService resourceService = Mockito.mock(ResourceService.class); when(resourceService.retrieve(URI.create("interaction_types_ignored.csv"))) .thenReturn(IOUtils.toInputStream("interaction_type_ignored\nshouldBeIgnored", StandardCharsets.UTF_8)) .thenReturn(IOUtils.toInputStream("interaction_type_ignored\nshouldBeIgnored", StandardCharsets.UTF_8)); when(resourceService.retrieve(URI.create("interaction_types_mapping.csv"))) .thenReturn(null); InteractTypeMapperFactory interactTypeMapperFactory = new InteractTypeMapperFactoryImpl(resourceService); InteractTypeMapper interactTypeMapper = interactTypeMapperFactory.create(); assertTrue(interactTypeMapper.shouldIgnoreInteractionType("shouldBeIgnored")); }
@Override public InteractTypeMapper create() throws TermLookupServiceException { final InteractTypeMapper mapperCustom = mapperForResourceService(resourceService); final InteractTypeMapper mapperDefault = mapperForResourceService(getResourceServiceForDefaultInteractionTypeMapping()); final InteractTypeMapper mapperRO = new InteractTypeMapperFactoryForRO().create(); return new InteractTypeMapperWithFallbackImpl( mapperCustom, mapperDefault, mapperRO); }
InteractTypeMapperFactoryImpl implements InteractTypeMapperFactory { @Override public InteractTypeMapper create() throws TermLookupServiceException { final InteractTypeMapper mapperCustom = mapperForResourceService(resourceService); final InteractTypeMapper mapperDefault = mapperForResourceService(getResourceServiceForDefaultInteractionTypeMapping()); final InteractTypeMapper mapperRO = new InteractTypeMapperFactoryForRO().create(); return new InteractTypeMapperWithFallbackImpl( mapperCustom, mapperDefault, mapperRO); } }
InteractTypeMapperFactoryImpl implements InteractTypeMapperFactory { @Override public InteractTypeMapper create() throws TermLookupServiceException { final InteractTypeMapper mapperCustom = mapperForResourceService(resourceService); final InteractTypeMapper mapperDefault = mapperForResourceService(getResourceServiceForDefaultInteractionTypeMapping()); final InteractTypeMapper mapperRO = new InteractTypeMapperFactoryForRO().create(); return new InteractTypeMapperWithFallbackImpl( mapperCustom, mapperDefault, mapperRO); } InteractTypeMapperFactoryImpl();  InteractTypeMapperFactoryImpl(ResourceService resourceService); }
InteractTypeMapperFactoryImpl implements InteractTypeMapperFactory { @Override public InteractTypeMapper create() throws TermLookupServiceException { final InteractTypeMapper mapperCustom = mapperForResourceService(resourceService); final InteractTypeMapper mapperDefault = mapperForResourceService(getResourceServiceForDefaultInteractionTypeMapping()); final InteractTypeMapper mapperRO = new InteractTypeMapperFactoryForRO().create(); return new InteractTypeMapperWithFallbackImpl( mapperCustom, mapperDefault, mapperRO); } InteractTypeMapperFactoryImpl();  InteractTypeMapperFactoryImpl(ResourceService resourceService); static TermLookupService getIgnoredTermService(ResourceService resourceService, String ignoredInteractionTypeColumnName, URI ignoredTypeListURI); @Override InteractTypeMapper create(); InteractTypeMapperImpl mapperForResourceService(ResourceService resourceService); static Map<String, InteractType> buildTypeMap(LabeledCSVParser labeledCSVParser,
                                                         String providedInteractionTypeIdColumnName,
                                                         String providedInteractionTypeNameColumnName,
                                                         String mappedInteractionTypeIdColumnName); static List<String> buildTypesIgnored(LabeledCSVParser labeledCSVParser, String ignoredInteractionTypeColumnName); static TermLookupService getTermLookupService(ResourceService resourceService,
                                                         String ignoredInteractionTypeColumnName,
                                                         String providedInteractionTypeIdColumnName,
                                                         String providedInteractionTypeNameColumnName,
                                                         String resolvedInteractionTypeIdColumnName,
                                                         URI ignoredTypeListURI,
                                                         URI interactionTypeMapURI); static Map<String, InteractType> getAndParseTypeMap(ResourceService resourceService,
                                                               String providedInteractionTypeIdColumnName,
                                                               String providedInteractionTypeNameColumnName,
                                                               String resolvedInteractionTypeIdColumnName, URI interactionTypeMapURI); static TermLookupService getTermLookupService(List<String> typesIgnored, Map<String, InteractType> typeMap); }
InteractTypeMapperFactoryImpl implements InteractTypeMapperFactory { @Override public InteractTypeMapper create() throws TermLookupServiceException { final InteractTypeMapper mapperCustom = mapperForResourceService(resourceService); final InteractTypeMapper mapperDefault = mapperForResourceService(getResourceServiceForDefaultInteractionTypeMapping()); final InteractTypeMapper mapperRO = new InteractTypeMapperFactoryForRO().create(); return new InteractTypeMapperWithFallbackImpl( mapperCustom, mapperDefault, mapperRO); } InteractTypeMapperFactoryImpl();  InteractTypeMapperFactoryImpl(ResourceService resourceService); static TermLookupService getIgnoredTermService(ResourceService resourceService, String ignoredInteractionTypeColumnName, URI ignoredTypeListURI); @Override InteractTypeMapper create(); InteractTypeMapperImpl mapperForResourceService(ResourceService resourceService); static Map<String, InteractType> buildTypeMap(LabeledCSVParser labeledCSVParser,
                                                         String providedInteractionTypeIdColumnName,
                                                         String providedInteractionTypeNameColumnName,
                                                         String mappedInteractionTypeIdColumnName); static List<String> buildTypesIgnored(LabeledCSVParser labeledCSVParser, String ignoredInteractionTypeColumnName); static TermLookupService getTermLookupService(ResourceService resourceService,
                                                         String ignoredInteractionTypeColumnName,
                                                         String providedInteractionTypeIdColumnName,
                                                         String providedInteractionTypeNameColumnName,
                                                         String resolvedInteractionTypeIdColumnName,
                                                         URI ignoredTypeListURI,
                                                         URI interactionTypeMapURI); static Map<String, InteractType> getAndParseTypeMap(ResourceService resourceService,
                                                               String providedInteractionTypeIdColumnName,
                                                               String providedInteractionTypeNameColumnName,
                                                               String resolvedInteractionTypeIdColumnName, URI interactionTypeMapURI); static TermLookupService getTermLookupService(List<String> typesIgnored, Map<String, InteractType> typeMap); static final URI TYPE_IGNORED_URI_DEFAULT; static final URI TYPE_MAP_URI_DEFAULT; }