use of com.epam.pipeline.entity.preference.Preference in project cloud-pipeline by epam.
the class ParallelExecutorServiceTest method testGetExecutorService.
@Test
@Transactional(propagation = Propagation.REQUIRED)
public void testGetExecutorService() throws InterruptedException {
ExecutorService service1 = parallelExecutorService.getExecutorService();
Preference maxThreads = SystemPreferences.CLUSTER_NODEUP_MAX_THREADS.toPreference();
maxThreads.setValue("2");
preferenceManager.update(Collections.singletonList(maxThreads));
// Wait for a new executor to be created
Thread.sleep(TIMEOUT);
ExecutorService service2 = parallelExecutorService.getExecutorService();
Assert.assertNotEquals(service1, service2);
}
use of com.epam.pipeline.entity.preference.Preference in project cloud-pipeline by epam.
the class PreferenceManagerTest method storeAndLoadTest.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Throwable.class)
public void storeAndLoadTest() {
Preference preference = new Preference(NAME, VALUE, GROUP, "", PreferenceType.STRING, true);
preferenceManager.update(Collections.singletonList(preference));
String load = preferenceManager.getStringPreference(NAME);
Assert.assertEquals(VALUE, load);
}
use of com.epam.pipeline.entity.preference.Preference in project cloud-pipeline by epam.
the class PreferenceManagerTest method castTest.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Throwable.class)
public void castTest() {
Preference preference = new Preference(NAME, "1", GROUP, "", PreferenceType.INTEGER, true);
preferenceManager.update(Collections.singletonList(preference));
Integer load = preferenceManager.getIntPreference(NAME);
Assert.assertEquals(1, load.intValue());
}
use of com.epam.pipeline.entity.preference.Preference in project cloud-pipeline by epam.
the class PreferenceManagerTest method testGetObservablePreference.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Throwable.class)
public void testGetObservablePreference() {
Observable<Integer> commitTimeoutObservable = preferenceManager.getObservablePreference(SystemPreferences.COMMIT_TIMEOUT);
TestSubscriber<Integer> test1 = new TestSubscriber<>();
TestSubscriber<Integer> test2 = new TestSubscriber<>();
commitTimeoutObservable.subscribe(test1::onNext);
commitTimeoutObservable.subscribe(test2::onNext);
Preference commitTimeout = SystemPreferences.COMMIT_TIMEOUT.toPreference();
commitTimeout.setValue("1111");
preferenceManager.update(Collections.singletonList(commitTimeout));
test1.assertValueCount(1);
test2.assertValueCount(1);
preferenceManager.delete(commitTimeout.getName());
test1.assertValueCount(2);
test2.assertValueCount(2);
}
use of com.epam.pipeline.entity.preference.Preference in project cloud-pipeline by epam.
the class PreferenceManagerTest method updateTest.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Throwable.class)
public void updateTest() {
Preference preference = new Preference(NAME, VALUE, GROUP, "", PreferenceType.STRING, true);
preferenceManager.update(Collections.singletonList(preference));
String load = preferenceManager.getStringPreference(NAME);
Assert.assertEquals(VALUE, load);
preference.setValue(NEW_VALUE);
preferenceManager.update(Collections.singletonList(preference));
load = preferenceManager.getStringPreference(NAME);
Assert.assertEquals(NEW_VALUE, load);
}
Aggregations