package at.gv.egovernment.moa.id.auth.modules.sl20_auth; import java.io.IOException; import java.io.InputStreamReader; import org.apache.commons.io.IOUtils; import org.junit.Before; import org.junit.runner.RunWith; import org.opensaml.xml.ConfigurationException; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import at.gv.egovernment.moa.id.auth.modules.sl20_auth.exceptions.SLCommandoParserException; import at.gv.egovernment.moa.id.auth.modules.sl20_auth.sl20.SL20JSONExtractorUtils; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration({ "/SpringTest-context.xml" }) public class EIDDataVerifier_OwnTest extends eIDDataVerifierTest { @Before public void init() throws SLCommandoParserException, IOException, ConfigurationException, at.gv.egovernment.moa.id.commons.api.exceptions.ConfigurationException { String eIDDataString = IOUtils.toString(new InputStreamReader(this.getClass().getResourceAsStream("/tests/eIDdata_own_test.json"))); JsonParser jsonParser = new JsonParser(); JsonElement payLoad = jsonParser.parse(eIDDataString).getAsJsonObject(); JsonObject result = SL20JSONExtractorUtils.getJSONObjectValue(payLoad.getAsJsonObject(), "result", true); eIDData = SL20JSONExtractorUtils.getMapOfStringElements(result); if (eIDData == null || eIDData.isEmpty()) throw new SLCommandoParserException("Can not load eID data"); } @Override protected String getSl20ReqId() { return "_57010b7fcc93cc4cf3f2b764389137c2"; } }