<commit_before>
import static org.junit.Assert.*;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;

import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;


import org.fedorahosted.flies.LocaleId;
import org.fedorahosted.flies.adapter.po.PoReader;
import org.fedorahosted.flies.rest.FliesClient;
import org.fedorahosted.flies.rest.client.IDocumentResource;
import org.fedorahosted.flies.rest.client.IProjectResource;
import org.fedorahosted.flies.rest.dto.Document;
import org.fedorahosted.flies.rest.dto.Project;
import org.fedorahosted.flies.rest.dto.TextFlowTargets;
import org.fedorahosted.flies.rest.dto.po.PoHeader;
import org.fedorahosted.flies.rest.dto.po.PotEntriesData;
import org.fedorahosted.flies.rest.dto.po.PotEntryData;
import org.jboss.resteasy.client.ClientResponse;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.internal.runners.statements.Fail;
import org.xml.sax.InputSource;

public class PublishPoFileTest {
	
	@Test
	public void publishASinglePOfile() throws IOException, JAXBException, URISyntaxException {

		Document doc = new Document("mydoc.po","mydoc.po", "/", PoReader.PO_CONTENT_TYPE);
		
		InputSource inputSource = new InputSource(
				"http://svn.fedorahosted.org/svn/Deployment_Guide/community/fc10/de-DE/Apache.po"
		);
		inputSource.setEncoding("utf8");
		
		PoReader poReader = new PoReader();

		System.out.println("parsing template");
		poReader.extractTemplate(doc, inputSource);
		
		System.out.println("starting REST client");
		FliesClient client = new FliesClient("http://localhost:8080/flies/seam/resource/restv1", "admin", "apikeyvalue");
		IDocumentResource docResource = client.getProjectsResource().
		getProjectResource("sample-project").
		getIterationResource("1.0").
		getDocumentsResource().
		getDocumentResource(doc.getId());
<commit_msg>ignore unit test as it should really be run with a server<commit_after>
import static org.junit.Assert.*;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;

import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;


import org.fedorahosted.flies.LocaleId;
import org.fedorahosted.flies.adapter.po.PoReader;
import org.fedorahosted.flies.rest.FliesClient;
import org.fedorahosted.flies.rest.client.IDocumentResource;
import org.fedorahosted.flies.rest.client.IProjectResource;
import org.fedorahosted.flies.rest.dto.Document;
import org.fedorahosted.flies.rest.dto.Project;
import org.fedorahosted.flies.rest.dto.TextFlowTargets;
import org.fedorahosted.flies.rest.dto.po.PoHeader;
import org.fedorahosted.flies.rest.dto.po.PotEntriesData;
import org.fedorahosted.flies.rest.dto.po.PotEntryData;
import org.jboss.resteasy.client.ClientResponse;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.internal.runners.statements.Fail;
import org.xml.sax.InputSource;

public class PublishPoFileTest {
	
	@Test
	@Ignore("relies on a server and should really be an integration test...")
	public void publishASinglePOfile() throws IOException, JAXBException, URISyntaxException {

		Document doc = new Document("mydoc.po","mydoc.po", "/", PoReader.PO_CONTENT_TYPE);
		
		InputSource inputSource = new InputSource(
				"http://svn.fedorahosted.org/svn/Deployment_Guide/community/fc10/de-DE/Apache.po"
		);
		inputSource.setEncoding("utf8");
		
		PoReader poReader = new PoReader();

		System.out.println("parsing template");
		poReader.extractTemplate(doc, inputSource);
		
		System.out.println("starting REST client");
		FliesClient client = new FliesClient("http://localhost:8080/flies/seam/resource/restv1", "admin", "apikeyvalue");
		IDocumentResource docResource = client.getProjectsResource().
		getProjectResource("sample-project").
		getIterationResource("1.0").
		getDocumentsResource().
		getDocumentResource(doc.getId());

{'fraction_non_alphanumeric': 0.121875, 'fraction_numerical': 0.004807692307692308, 'mean_word_length': 5.6576, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1566960', 'n_tokens_mistral': 1487, 'n_tokens_neox': 1376, 'n_words': 224}