package eu.europa.esig.dss.client.ocsp;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

import java.io.File;

import org.junit.Before;
import org.junit.Test;

import eu.europa.esig.dss.DSSUtils;
import eu.europa.esig.dss.client.NonceSource;
import eu.europa.esig.dss.client.http.NativeHTTPDataLoader;
import eu.europa.esig.dss.x509.CertificateToken;
import eu.europa.esig.dss.x509.ocsp.OCSPToken;

public class OnlineOCSPSourceTest {

	private CertificateToken certificateToken;
	private CertificateToken rootToken;

	@Before
	public void init() {
		certificateToken = DSSUtils.loadCertificate(new File("src/test/resources/ec.europa.eu.crt"));
		rootToken = DSSUtils.loadCertificate(new File("src/test/resources/LTQCACA.crt"));
	}

	@Test
	public void getAccessLocation() {
		OnlineOCSPSource ocspSource = new OnlineOCSPSource();
		assertNull(ocspSource.getAccessLocation(rootToken));
		assertEquals("http://ocsp.luxtrust.lu", ocspSource.getAccessLocation(certificateToken));
	}

	@Test
	public void testOCSPWithoutNonce() {
		OnlineOCSPSource ocspSource = new OnlineOCSPSource();
		ocspSource.setDataLoader(new NativeHTTPDataLoader());
		OCSPToken ocspToken = ocspSource.getOCSPToken(certificateToken, rootToken);
		assertNotNull(ocspToken);
	}

	@Test
	public void testOCSPWithNonce() {
		OnlineOCSPSource ocspSource = new OnlineOCSPSource();
		ocspSource.setDataLoader(new NativeHTTPDataLoader());
		ocspSource.setNonceSource(new NonceSource());
		OCSPToken ocspToken = ocspSource.getOCSPToken(certificateToken, rootToken);
		assertNotNull(ocspToken);
	}

}

@@ -360,25 +360,27 @@
 nt.http.
-NativeHTT
+commons.OCS
 PDataLoa
@@ -913,16 +913,66 @@
 urce();%0A
+%09%09ocspSource.setDataLoader(new OCSPDataLoader());%0A
 %09%09assert
@@ -1241,33 +1241,27 @@
 aLoader(new 
-NativeHTT
+OCS
 PDataLoader(
@@ -1507,17 +1507,11 @@
 new 
-NativeHTT
+OCS
 PDat

Fix unit test