Search in sources :

Example 36 with Settings

use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.

the class LdapAdapterIntegrationTest method createLdapClient.

private LdapClient createLdapClient() {
    Settings settings = new Settings(new HashMap<>());
    settings.setLdapBindCredentials("");
    settings.setLdapPrincipalUsername("");
    settings.setLdapPrincipalSuffix("");
    settings.setLdapServerHost("localhost");
    settings.setLdapServerPort(10389);
    settings.setLdapMailAttribute("");
    settings.setLdapLastNameAttribute("sn");
    settings.setLdapFirstNameAttribute("givenName");
    settings.setLdapUserNameAttribute("sAMAccountName");
    settings.setLdapDepartmentAttribute("physicalDeliveryOfficeName");
    settings.setLdapUserContextDN("ou=users,dc=example,dc=com");
    settings.setLdapEmployeeFilter("(&(objectClass=person)(sn=*)(givenName=*))");
    settings.setLdapGroupMemberFilter("(memberOf=ou={0},ou=users,dc=example,dc=com)");
    settings.setLdapUserFilter("(&(objectclass=*)(sAMAccountName={0}))");
    settings.setLdapDepartmentFilterDepartmentAttribute("physicalDeliveryOfficeName");
    settings.setLdapDepartmentFilter("(&(physicalDeliveryOfficeName=*)(objectClass=person))");
    return new LdapClient(settings);
}
Also used : Settings(com.artezio.arttime.config.Settings)

Example 37 with Settings

use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.

the class SettingsServiceTest method testGetSettings_ifNoSettingsExist.

@Test
public void testGetSettings_ifNoSettingsExist() {
    Settings actual = settingsService.getSettings();
    assertNotNull(actual);
}
Also used : Settings(com.artezio.arttime.config.Settings) Test(org.junit.Test)

Example 38 with Settings

use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.

the class SettingsServiceTest method testUpdateSettings.

@Test
public void testUpdateSettings() {
    Setting setting1 = new Setting(Setting.Name.LDAP_BIND_CREDENTIALS, "old_value1");
    Setting setting2 = new Setting(Setting.Name.SMTP_HOST_NAME, "old_value2");
    entityManager.persist(setting1);
    entityManager.persist(setting2);
    entityManager.flush();
    Settings settings = settingsService.getSettings();
    settings.setLdapBindCredentials("new_value");
    settings.setSmtpHostName(null);
    settingsService.update(settings);
    Settings newSettings = settingsService.getSettings();
    assertTrue(newSettings.getLdapBindCredentials().equals("new_value"));
    assertNull(newSettings.getSmtpHostName());
}
Also used : Setting(com.artezio.arttime.config.Setting) Settings(com.artezio.arttime.config.Settings) Test(org.junit.Test)

Example 39 with Settings

use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.

the class LdapClientTest method setUp.

@Before
public void setUp() throws NoSuchFieldException {
    settings = new Settings(new HashMap<>());
    setField(ldapClient, "settings", settings);
}
Also used : HashMap(java.util.HashMap) Settings(com.artezio.arttime.config.Settings) Before(org.junit.Before)

Example 40 with Settings

use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.

the class SchedulerTest method setUp.

@Before
public void setUp() throws NoSuchFieldException {
    scheduler = new Scheduler();
    settings = new Settings(new EnumMap<>(Setting.Name.class));
    IMocksControl mockControl = EasyMock.createControl();
    synchronizer = mockControl.createMock(Synchronizer.class);
    setField(scheduler, "settings", settings);
    setField(scheduler, "synchronizer", synchronizer);
}
Also used : IMocksControl(org.easymock.IMocksControl) Setting(com.artezio.arttime.config.Setting) EnumMap(java.util.EnumMap) Settings(com.artezio.arttime.config.Settings) Before(org.junit.Before)

Aggregations

Settings (com.artezio.arttime.config.Settings)40 Test (org.junit.Test)31 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)21 Setting (com.artezio.arttime.config.Setting)9 EnumMap (java.util.EnumMap)5 Before (org.junit.Before)5 SimpleAccount (org.apache.shiro.authc.SimpleAccount)4 Instance (javax.enterprise.inject.Instance)3 Properties (java.util.Properties)2 URLName (javax.mail.URLName)2 ApplicationSettings (com.artezio.arttime.config.ApplicationSettings)1 Employee (com.artezio.arttime.datamodel.Employee)1 ProjectService (com.artezio.arttime.services.ProjectService)1 SettingsService (com.artezio.arttime.services.SettingsService)1 UserInfo (com.artezio.arttime.services.integration.spi.UserInfo)1 Duration (java.time.Duration)1 java.util (java.util)1 HashMap (java.util.HashMap)1 Timer (javax.ejb.Timer)1 TimerConfig (javax.ejb.TimerConfig)1