@Test public void testIsAlreadyPresent() throws Throwable { myLog.debug( "Testing a non present person" ); addTestUser(); provideNewEntityManager(); Properties props = new Properties(); props.put( PersonKey.PERSON_EMAIL.getKeyName(), "bla" + USER_EMAIL ); PropertiesPerson person = new PropertiesPerson( USER_EMAIL, props ); boolean received = myClassUnderTest.isAlreadyPresent( person ); Assert.assertFalse( received ); myLog.debug( "Testing a present person" ); person.setEMail( USER_EMAIL ); received = myClassUnderTest.isAlreadyPresent( person ); Assert.assertTrue( received ); }
@Override public boolean isAlreadyPresent( Person<?> aPerson ) throws SdiException { if ( myDryRun && !myCheckDuplicateOnDryRun ) { myLog.debug( "DryRun is active. Not checking for duplicate person" ); return false; } OxUser oxUser = findPersonByEmail( aPerson.getEMail() ); if ( oxUser != null ) { myLog.debug( "given Person is already present: " + oxUser ); return true; } return false; }
OxSqlJob implements SqlJob { @Override public boolean isAlreadyPresent( Person<?> aPerson ) throws SdiException { if ( myDryRun && !myCheckDuplicateOnDryRun ) { myLog.debug( "DryRun is active. Not checking for duplicate person" ); return false; } OxUser oxUser = findPersonByEmail( aPerson.getEMail() ); if ( oxUser != null ) { myLog.debug( "given Person is already present: " + oxUser ); return true; } return false; } }
OxSqlJob implements SqlJob { @Override public boolean isAlreadyPresent( Person<?> aPerson ) throws SdiException { if ( myDryRun && !myCheckDuplicateOnDryRun ) { myLog.debug( "DryRun is active. Not checking for duplicate person" ); return false; } OxUser oxUser = findPersonByEmail( aPerson.getEMail() ); if ( oxUser != null ) { myLog.debug( "given Person is already present: " + oxUser ); return true; } return false; } OxSqlJob(); }
OxSqlJob implements SqlJob { @Override public boolean isAlreadyPresent( Person<?> aPerson ) throws SdiException { if ( myDryRun && !myCheckDuplicateOnDryRun ) { myLog.debug( "DryRun is active. Not checking for duplicate person" ); return false; } OxUser oxUser = findPersonByEmail( aPerson.getEMail() ); if ( oxUser != null ) { myLog.debug( "given Person is already present: " + oxUser ); return true; } return false; } OxSqlJob(); @Override void execute( Person<?> aPerson ); @Override boolean isAlreadyPresent( Person<?> aPerson ); OxUser findPersonByEmail( String aEmail ); OxUserUnapproved findUnapprovedUser( Long aUserId ); boolean isAvatarHashPresent( Long aHash ); @Override void init(); @Override void close(); @Override void startTransaction(); @Override void commitTransaction(); @Override void rollbackTransaction(); }
OxSqlJob implements SqlJob { @Override public boolean isAlreadyPresent( Person<?> aPerson ) throws SdiException { if ( myDryRun && !myCheckDuplicateOnDryRun ) { myLog.debug( "DryRun is active. Not checking for duplicate person" ); return false; } OxUser oxUser = findPersonByEmail( aPerson.getEMail() ); if ( oxUser != null ) { myLog.debug( "given Person is already present: " + oxUser ); return true; } return false; } OxSqlJob(); @Override void execute( Person<?> aPerson ); @Override boolean isAlreadyPresent( Person<?> aPerson ); OxUser findPersonByEmail( String aEmail ); OxUserUnapproved findUnapprovedUser( Long aUserId ); boolean isAvatarHashPresent( Long aHash ); @Override void init(); @Override void close(); @Override void startTransaction(); @Override void commitTransaction(); @Override void rollbackTransaction(); static final String KEY_PREFIX_PROFILE_QUESTION; static final String KEY_DEFAULT_GROUPS; static final String KEY_DEFAULT_ROLES; static final String KEY_GROUP_PRIVACY; }