GoYamlUserDataProvider extends SimpleUserDataProvider { @Override public UserData getUserDataPerEMail(final String email) { List<Md5UserData> data = loadUserData(gitYamlFile.getYamlFile()); final String emailMd5 = Md5Tool.md5(email); for (Md5UserData userData : data) { List<String> md5s = userData.getMd5s(); if (md5s != null) { for (String md5 : md5s) { if (emailMd5.equalsIgnoreCase(md5)) { userData.setEmail(email); userData.setGuid(email); if (userData.getScreenname() == null) { userData.setScreenname(getNameFromEMail(email)); } if (userData.getScmAlias() == null) { userData.setScmAlias(extractSCMAlias(userData.getXref(), email)); } return userData; } } } } logger.warn("Could not retrieve user data for email: " + email); return super.getUserDataPerEMail(email); } @Inject  GoYamlUserDataProvider(GitYaml gitYamlFile); @Override UserData getUserDataPerGithubLogin(final String login); @Override UserData getUserDataPerEMail(final String email); @Override List<XrefUserData> getXrefUserData(); @Override Set<String> getAdditionalXrefs(); @Override List<OrcidUserData> getOrcIdUserData();  }
@Test public void test() throws Exception { GoYamlUserDataProvider p = new GoYamlUserDataProvider(new GitYaml() { @Override public File getYamlFile() { return new File("src/test/resources/user.yaml").getAbsoluteFile(); } @Override public void update() { } }); UserData data = p.getUserDataPerEMail("foo@fake.fake"); assertNotNull(data); assertEquals("Foo User", data.getScreenname()); assertEquals("GOC:foo", data.getXref()); assertEquals("http: assertEquals("foo@fake.fake", data.getEmail()); assertEquals("foo@fake.fake", data.getGuid()); assertEquals("foo", data.getScmAlias()); }