package org.ihtsdo.buildcloud.service.classifier;

import static org.junit.Assert.*;

import java.io.File;

import org.ihtsdo.buildcloud.service.classifier.ExternalRF2ClassifierRestClient;
import org.ihtsdo.otf.rest.exception.BusinessServiceException;
import org.junit.Before;
import org.junit.Test;

public class ExternalRF2ClassifierRestClientTestHarness {
	
	private ExternalRF2ClassifierRestClient client;
	
	private String classificationServiceUrl = "http://localhost:8081/classification-service";
	private String userName = "classification";
	private String password = "classification";
	
	@Before
	public void setUp() throws BusinessServiceException {
		client = new ExternalRF2ClassifierRestClient(classificationServiceUrl, userName, password);
		client.setTimeoutInSeconds(300);
	}
	
	@Test
	public void testClassification() throws Exception {
		assertTrue(client.getTimeoutInSeconds() > 0);
		//Put RF2Delta.zip in folder release under project data-service
		File rf2DeltaZipFile = new File("release/RF2Delta.zip");
		assertTrue(rf2DeltaZipFile.exists());
		File result = client.classify(rf2DeltaZipFile, "SnomedCT_InternationalRF2_PRODUCTION_20170731T150000Z.zip");
		assertNotNull(result);
		System.out.println("Classification result is saved at:" + result.getAbsolutePath().toString());
	}
}

@@ -79,114 +79,88 @@
 ert.
-*;%0A%0Aimport java.io.File;%0A%0Aimport org.ihtsdo.buildcloud.service.classifier.ExternalRF2ClassifierRestClient;
+assertNotNull;%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport java.io.File;%0A
 %0Aimp
@@ -1270,10 +1270,522 @@
 ());%0A%09%7D%0A
+%09%0A%09%0A%09@Test%0A%09public void testEmptyDelta() throws Exception %7B%0A%09%09assertTrue(client.getTimeoutInSeconds() %3E 0);%0A%09%09//Put RF2Delta.zip in folder release under project data-service%0A%09%09File rf2DeltaZipFile = new File(%22release/Empty_RF2Delta.zip%22);%0A%09%09assertTrue(rf2DeltaZipFile.exists());%0A%09%09File result = client.classify(rf2DeltaZipFile, %22xSnomedCT_InternationalRF2_ALPHA_20180731T120000Z.zip%22);%0A%09%09assertNotNull(result);%0A%09%09System.out.println(%22Classification result is saved at:%22 + result.getAbsolutePath().toString());%0A%09%7D%0A
 %7D%0A

Update test harness for empty delta