package com.smartlogic.classificationserver.client.operations;

import java.io.File;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;

import org.testng.annotations.Test;

import com.smartlogic.classificationserver.client.ClassificationException;
import com.smartlogic.classificationserver.client.ClassificationTestCase;
import com.smartlogic.classificationserver.client.MetaNode;
import com.smartlogic.classificationserver.client.Result;

public class TestPublishPakFiles extends ClassificationTestCase {

	@Test
	public void publishPakFiles() throws ClassificationException {
		classificationClient.clearPublishSet("TestPublishSet");
		
		Collection<File> pakFiles = new HashSet<File>();
		pakFiles.add(new File("src/test/resources/pakfiles/NamedEntityRules.pak"));
		classificationClient.sendPakfiles("TestPublishSet", pakFiles);
		
		classificationClient.commitPublishSet("TestPublishSet");

		classificationClient.deactivatePublishSet("TestPublishSet");
		
	}
	
	@Test
	public void publishFactsExtractPakFiles() throws ClassificationException {
		classificationClient.clearPublishSet("FactsExtraction");
		
		Collection<File> pakFiles = new HashSet<File>();
		for (File file: new File("src/test/resources/Facts/PakFiles").listFiles()) 
			pakFiles.add(file);
		classificationClient.sendPakfiles("FactsExtraction", pakFiles);
		
		classificationClient.commitPublishSet("FactsExtraction");
		
		for (File file: new File("src/test/resources/Facts/Documents").listFiles()) {
			Result result = classificationClient.getClassifiedDocument(file, "text");
			for (Map.Entry<String, Collection<MetaNode>> entry: result.getMetaNodes().entrySet()) {
				System.out.println(entry.getKey());
				for (MetaNode metaNode: entry.getValue()) System.out.println(metaNode);
			}
		}

		classificationClient.deactivatePublishSet("FactsExtraction");
	}

}

@@ -141,31 +141,8 @@
 et;%0D
-%0Aimport java.util.Map;%0D
 %0A%0D%0Ai
@@ -333,128 +333,8 @@
 se;%0D
-%0Aimport com.smartlogic.classificationserver.client.MetaNode;%0D%0Aimport com.smartlogic.classificationserver.client.Result;%0D
 %0A%0D%0Ap
@@ -876,903 +876,10 @@
 %09%7D%0D%0A
+
 %09%0D%0A
-%09@Test%0D%0A%09public void publishFactsExtractPakFiles() throws ClassificationException %7B%0D%0A%09%09classificationClient.clearPublishSet(%22FactsExtraction%22);%0D%0A%09%09%0D%0A%09%09Collection%3CFile%3E pakFiles = new HashSet%3CFile%3E();%0D%0A%09%09for (File file: new File(%22src/test/resources/Facts/PakFiles%22).listFiles()) %0D%0A%09%09%09pakFiles.add(file);%0D%0A%09%09classificationClient.sendPakfiles(%22FactsExtraction%22, pakFiles);%0D%0A%09%09%0D%0A%09%09classificationClient.commitPublishSet(%22FactsExtraction%22);%0D%0A%09%09%0D%0A%09%09for (File file: new File(%22src/test/resources/Facts/Documents%22).listFiles()) %7B%0D%0A%09%09%09Result result = classificationClient.getClassifiedDocument(file, %22text%22);%0D%0A%09%09%09for (Map.Entry%3CString, Collection%3CMetaNode%3E%3E entry: result.getMetaNodes().entrySet()) %7B%0D%0A%09%09%09%09System.out.println(entry.getKey());%0D%0A%09%09%09%09for (MetaNode metaNode: entry.getValue()) System.out.println(metaNode);%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%0D%0A%09%09classificationClient.deactivatePublishSet(%22FactsExtraction%22);%0D%0A%09%7D%0D%0A%0D%0A
 %7D%0D%0A

Remove local only test