Search in sources :

Example 1 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 URL u) {
    final InstallData data = StrategySettingsValidatorTest.mockInstallData();
    when(data.getVariable(eq(Variables.STRATEGY_TYPE.getKey()))).thenReturn("url");
    when(data.getVariable(eq(Variables.STRATEGY_SOURCE.getKey()))).thenReturn(u.toExternalForm());
    return data;
}
Also used : InstallData(com.izforge.izpack.api.data.InstallData)

Example 2 with InstallData

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

the class StrategySettingsValidatorTest method urlNoContent.

@Test
void urlNoContent() throws IOException {
    final File f = File.createTempFile("robozonky-", ".cfg");
    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 3 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 File f) {
    final InstallData data = StrategySettingsValidatorTest.mockInstallData();
    when(data.getVariable(eq(Variables.STRATEGY_TYPE.getKey()))).thenReturn("file");
    when(data.getVariable(eq(Variables.STRATEGY_SOURCE.getKey()))).thenReturn(f.getAbsolutePath());
    return data;
}
Also used : InstallData(com.izforge.izpack.api.data.InstallData)

Example 4 with InstallData

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

the class StrategySettingsValidatorTest method urlOk.

@Test
void urlOk() throws IOException {
    final File f = File.createTempFile("robozonky-", ".cfg");
    Files.write(f.toPath(), Collections.singleton("Content"), Defaults.CHARSET);
    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.OK);
}
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 5 with InstallData

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

the class VariablesTest method readValue.

@Test
void readValue() {
    for (final Variables variable : Variables.values()) {
        final String key = variable.getKey();
        final String value = UUID.randomUUID().toString();
        final InstallData data = mock(InstallData.class);
        when(data.getVariable(key)).thenReturn(value);
        assertThat(variable.getValue(data)).isSameAs(value);
    }
}
Also used : InstallData(com.izforge.izpack.api.data.InstallData) Test(org.junit.jupiter.api.Test)

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