From 5fa1ad5d3e341b79df37211a130994a9e1aa091f Mon Sep 17 00:00:00 2001 From: Andrea Ceccanti Date: Tue, 10 Nov 2020 18:45:03 +0100 Subject: [PATCH] More HR properties parsing tests --- .../integration/hr/HrDbPropertiesTest.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/voms-admin-server/src/test/java/integration/hr/HrDbPropertiesTest.java b/voms-admin-server/src/test/java/integration/hr/HrDbPropertiesTest.java index 3ce72f94..c8facff9 100644 --- a/voms-admin-server/src/test/java/integration/hr/HrDbPropertiesTest.java +++ b/voms-admin-server/src/test/java/integration/hr/HrDbPropertiesTest.java @@ -17,9 +17,13 @@ import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.fail; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; import java.util.Properties; import org.glite.security.voms.admin.integration.cern.HrDbError; @@ -73,7 +77,24 @@ public void testValueParsing() { @Test - public void testFileParsing() { + public void testFileParsing() throws FileNotFoundException, IOException { + + Properties props = new Properties(); + props + .load(new FileInputStream(new File("src/test/resources/cern/enabled-task/hr.properties"))); + + HrDbProperties hrDbProps = HrDbProperties.fromProperties(props); + + assertThat(hrDbProps.getExperimentName(), is("cms")); + assertThat(hrDbProps.getMembershipCheck().isEnabled(), is(true)); + assertThat(hrDbProps.getMembershipCheck().getStartHour(), is(4)); + assertThat(hrDbProps.getMembershipCheck().isRunAtStartup(), is(false)); + assertThat(hrDbProps.getApi().getEndpoint(), is("http://localhost:8080")); + assertThat(hrDbProps.getApi().getUsername(), is("user")); + assertThat(hrDbProps.getApi().getPassword(), is("password")); + assertThat(hrDbProps.getApi().getTimeoutInSeconds(), is(2L)); + + }