use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.
the class TrackingSystemProducerTest method testGetTeamTrackingSystem.
@Test
public void testGetTeamTrackingSystem() throws NoSuchFieldException {
Settings settings = createMock(Settings.class);
Instance instance = createMock(Instance.class);
trackingSystemProducer = createMockBuilder(TrackingSystemProducer.class).addMockedMethod("findImplementationByName", Instance.class, String.class).createMock();
setField(trackingSystemProducer, "teamTrackingSystems", instance);
setField(trackingSystemProducer, "settings", settings);
TeamTrackingSystem expectedImpl = createMock(TeamTrackingSystem.class);
expect(trackingSystemProducer.findImplementationByName(instance, "ExpectedImpl")).andReturn(expectedImpl);
expect(settings.getTeamTrackingSystemName()).andReturn("ExpectedImpl");
replayAll(instance, settings, expectedImpl, trackingSystemProducer);
TeamTrackingSystem actual = trackingSystemProducer.getTeamTrackingSystem();
PowerMock.verifyAll();
assertEquals(expectedImpl, actual);
}
use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.
the class TrackingSystemProducerTest method testGetEmployeeTrackingSystem.
@Test
public void testGetEmployeeTrackingSystem() throws NoSuchFieldException {
Settings settings = createMock(Settings.class);
Instance instance = createMock(Instance.class);
trackingSystemProducer = createMockBuilder(TrackingSystemProducer.class).addMockedMethod("findImplementationByName", Instance.class, String.class).createMock();
setField(trackingSystemProducer, "employeeTrackingSystems", instance);
setField(trackingSystemProducer, "settings", settings);
EmployeeTrackingSystem expectedImpl = createMock(EmployeeTrackingSystem.class);
expect(trackingSystemProducer.findImplementationByName(instance, "ExpectedImpl")).andReturn(expectedImpl);
expect(settings.getEmployeeTrackingSystemName()).andReturn("ExpectedImpl");
replayAll(instance, settings, expectedImpl, trackingSystemProducer);
EmployeeTrackingSystem actual = trackingSystemProducer.getEmployeeTrackingSystem();
PowerMock.verifyAll();
assertEquals(expectedImpl, actual);
}
use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.
the class KeycloakClientTest method setUp.
@Before
public void setUp() throws NoSuchFieldException {
environmentVariables.set(Setting.Name.KEYCLOAK_CLIENT_ID.name(), KEYCLOAK_CLIENT_ID);
settings = new Settings(new HashMap<>());
setField(keycloakClient, "settings", settings);
}
use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.
the class EmailSenderTest method testInitSession.
@Test
public void testInitSession() throws NoSuchFieldException, NoSuchMethodException {
Session session = PowerMock.createMock(Session.class);
Settings settings = new Settings(new EnumMap<>(Setting.Name.class));
settings.setSmtpHostName("smtp.host");
settings.setSmtpPortNumber("25");
settings.setSmtpUsername("TestUser");
settings.setSmtpPassword("123");
setField(emailSender, "session", session);
setField(emailSender, "settings", settings);
Properties properties = new Properties();
expect(session.getProperties()).andReturn(properties).anyTimes();
PowerMock.stub(Session.class.getMethod("setPasswordAuthentication", URLName.class, PasswordAuthentication.class));
session.setPasswordAuthentication(anyObject(), anyObject());
PowerMock.replay(session);
emailSender.initSession();
verify(session);
assertEquals(settings.getSmtpHostName(), properties.getProperty("mail.smtp.host"));
assertEquals(settings.getSmtpPortNumber(), properties.getProperty("mail.smtp.port"));
assertEquals(settings.getSmtpUsername(), properties.getProperty("mail.smtp.user"));
assertTrue(Boolean.parseBoolean(properties.getProperty("mail.smtp.auth")));
}
use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.
the class SynchronizerTest method setUp.
@Before
public void setUp() throws NoSuchFieldException {
synchronizer = new Synchronizer();
settings = new Settings(new EnumMap<>(Setting.Name.class));
mockControl = EasyMock.createControl();
employeeSynchronizer = mockControl.createMock(EmployeeSynchronizerLocal.class);
teamSynchronizer = mockControl.createMock(TeamSynchronizer.class);
projectService = mockControl.createMock(ProjectService.class);
settingsService = mockControl.createMock(SettingsService.class);
setField(synchronizer, "employeeSynchronizer", employeeSynchronizer);
setField(synchronizer, "teamSynchronizer", teamSynchronizer);
setField(synchronizer, "projectService", projectService);
setField(synchronizer, "settingsService", settingsService);
setField(synchronizer, "settings", settings);
}
Aggregations