package org.n52.sir.harvest;

import java.io.File;

import org.junit.Test;
import org.n52.sir.datastructure.SirSensor;

public class JSHarvestTest {
	@Test
	public void harvestJSFile() {
		File harvestScript = new File(ClassLoader.getSystemResource(
				"Requests/harvestScript.js").getFile());
	
		

	}

}

@@ -36,91 +36,586 @@
 ort 
-java.io.File;%0D%0A%0D%0Aimport org.junit.Test;%0D%0Aimport org.n52.sir.datastructure.SirSensor
+static org.junit.Assert.assertNotNull;%0D%0Aimport static org.junit.Assert.assertNotEquals;%0D%0Aimport static org.junit.Assert.assertTrue;%0D%0A%0D%0Aimport java.io.File;%0D%0Aimport java.util.Collection;%0D%0A%0D%0Aimport org.junit.Test;%0D%0Aimport org.n52.sir.datastructure.SirSearchResultElement;%0D%0Aimport org.n52.sir.datastructure.SirSensor;%0D%0Aimport org.n52.sir.datastructure.detailed.SirDetailedSensorDescription;%0D%0Aimport org.n52.sir.ds.solr.SOLRSearchSensorDAO;%0D%0Aimport org.n52.sir.harvest.exec.IJSExecute;%0D%0Aimport org.n52.sir.harvest.exec.impl.RhinoJSExecute;%0D%0Aimport org.n52.sir.ows.OwsExceptionReport
 ;%0D%0A%0D
@@ -681,16 +681,42 @@
 JSFile()
+ throws OwsExceptionReport
  %7B%0D%0A%09%09Fi
@@ -825,15 +825,866 @@
 );%0D%0A
-%09%0D%0A%09%09%0D%0A
+%0D%0A%09%09IJSExecute execEngine = new RhinoJSExecute();%0D%0A%09%09String id = execEngine.execute(harvestScript);%0D%0A%0D%0A%09%09assertNotNull(id);%0D%0A%0D%0A%09%09SOLRSearchSensorDAO searchDAO = new SOLRSearchSensorDAO();%0D%0A%09%09Collection%3CSirSearchResultElement%3E elements = searchDAO.searchByID(id);%0D%0A%09%09assertNotEquals(elements.size(),0);%0D%0A%09%09%0D%0A%09%09SirSearchResultElement element = elements.iterator().next();%0D%0A%09%09SirDetailedSensorDescription description = (SirDetailedSensorDescription)element.getSensorDescription();%0D%0A%09%09Collection%3CObject%3E keywords = description.getKeywords();%0D%0A%09%09%0D%0A%09%09assertTrue(keywords.contains(%22javascript%22));%0D%0A%09%09assertTrue(keywords.contains(%22harvest%22));%0D%0A%09%09%0D%0A%09%09assertTrue(description.getLocation().equals(%223,1.5%22));%0D%0A%09%09%0D%0A%09%09Collection%3CString%3E contacts = description.getContacts();%0D%0A%09%09%0D%0A%0D%0A%09%09assertTrue(contacts.contains(%2252north%22));%0D%0A%09%09assertTrue(contacts.contains(%22rhino%22));%0D%0A%09%09
 %0D%0A%09%7D

Test sensor JS harvest unit test