Search in sources :

Example 16 with InstallData

use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.

the class RoboZonkyInstallerListenerTest method emailEnabled.

@Test
void emailEnabled() {
    // prepare
    final InstallData localData = RoboZonkyInstallerListenerTest.mockData();
    when(localData.getVariable(Variables.IS_EMAIL_ENABLED.getKey())).thenReturn("true");
    RoboZonkyInstallerListener.setInstallData(localData);
    // execute SUT
    final CommandLinePart clp = new RoboZonkyInstallerListener().prepareEmailConfiguration();
    // test
    assertSoftly(softly -> {
        softly.assertThat(clp.getProperties()).isNotEmpty();
        softly.assertThat(RoboZonkyInstallerListener.EMAIL_CONFIG_FILE).canRead();
    });
}
Also used : InstallData(com.izforge.izpack.api.data.InstallData) Test(org.junit.jupiter.api.Test) AbstractRoboZonkyTest(com.github.robozonky.test.AbstractRoboZonkyTest)

Example 17 with InstallData

use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.

the class StrategySettingsValidatorTest method fileOk.

@Test
void fileOk() throws IOException {
    final File f = File.createTempFile("robozonky-", ".cfg");
    final InstallData d = StrategySettingsValidatorTest.mockInstallData(f);
    // execute sut
    final DataValidator validator = new StrategySettingsValidator();
    final DataValidator.Status result = validator.validateData(d);
    // execute test
    assertThat(result).isEqualTo(DataValidator.Status.OK);
    assertThat(RoboZonkyInstallerListener.INSTALL_PATH).isNotNull();
}
Also used : InstallData(com.izforge.izpack.api.data.InstallData) DataValidator(com.izforge.izpack.api.installer.DataValidator) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 18 with InstallData

use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.

the class StrategySettingsValidatorTest method fileMissing.

@Test
void fileMissing() throws IOException {
    final File f = File.createTempFile("robozonky-", ".cfg");
    Assumptions.assumeTrue(f.delete());
    final InstallData d = StrategySettingsValidatorTest.mockInstallData(f);
    // execute sut
    final DataValidator validator = new StrategySettingsValidator();
    final DataValidator.Status result = validator.validateData(d);
    // execute test
    assertThat(result).isEqualTo(DataValidator.Status.WARNING);
}
Also used : InstallData(com.izforge.izpack.api.data.InstallData) DataValidator(com.izforge.izpack.api.installer.DataValidator) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 19 with InstallData

use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.

the class StrategySettingsValidatorTest method urlWrong.

@Test
void urlWrong() throws IOException {
    final File f = File.createTempFile("robozonky-", ".cfg");
    Assumptions.assumeTrue(f.delete());
    final InstallData d = StrategySettingsValidatorTest.mockInstallData(f.toURI().toURL());
    // execute sut
    final DataValidator validator = new StrategySettingsValidator();
    final DataValidator.Status result = validator.validateData(d);
    // execute test
    assertThat(result).isEqualTo(DataValidator.Status.WARNING);
}
Also used : InstallData(com.izforge.izpack.api.data.InstallData) DataValidator(com.izforge.izpack.api.installer.DataValidator) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 20 with InstallData

use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.

the class StrategySettingsValidatorTest method mockInstallData.

private static InstallData mockInstallData() {
    final InstallData data = mock(InstallData.class);
    when(data.getVariable(eq(Variables.INSTALL_PATH.getKey()))).thenReturn(new File("target/").getAbsolutePath());
    return data;
}
Also used : InstallData(com.izforge.izpack.api.data.InstallData) File(java.io.File)

Aggregations

InstallData (com.izforge.izpack.api.data.InstallData)30 Test (org.junit.jupiter.api.Test)22 DataValidator (com.izforge.izpack.api.installer.DataValidator)12 File (java.io.File)10 AbstractRoboZonkyTest (com.github.robozonky.test.AbstractRoboZonkyTest)6 ApiProvider (com.github.robozonky.common.remote.ApiProvider)3 OAuth (com.github.robozonky.common.remote.OAuth)3 ConfirmationProvider (com.github.robozonky.api.confirmations.ConfirmationProvider)2 ServerSetupTest (com.icegreen.greenmail.util.ServerSetupTest)2 ZonkyApiToken (com.github.robozonky.api.remote.entities.ZonkyApiToken)1 Zonky (com.github.robozonky.common.remote.Zonky)1 InstallerListener (com.izforge.izpack.api.event.InstallerListener)1 ProgressListener (com.izforge.izpack.api.event.ProgressListener)1 ServerErrorException (javax.ws.rs.ServerErrorException)1