<commit_before>package org.collectionspace.chain.csp.persistence.services.vocab;

import static org.junit.Assert.*;

import org.collectionspace.chain.csp.persistence.TestBase;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.AfterClass;
import org.junit.Test;
import org.mortbay.jetty.testing.HttpTester;
import org.mortbay.jetty.testing.ServletTester;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TestGenerateAuthorities {
	private static final Logger log = LoggerFactory
	.getLogger(TestGenerateAuthorities.class);
	private static TestBase tester = new TestBase();
	static ServletTester jetty;
	static {
		try{
			jetty=tester.setupJetty();
			}
		catch(Exception ex){
			
		}
	}
	
	@AfterClass public static  void testStop() throws Exception {
		tester.stopJetty(jetty);
	}
	

	
	@Test
	public void testSetUp() throws Exception {
		HttpTester out;
		log.info("initialize authorities");

		//String urltest = "/vocabularies/currency/refresh?datapath=/Users/csm22/Documents/collectionspace/test.txt";
		//out = tester.GETData(urltest, jetty);

		
		// repopulate the authorities with dummy data
		//DONOT RUN THIS TEST LOCALLY 
		out = tester.GETData("/reset/", jetty);
		

		//do we have any records
		out = tester.GETData("/authorities/organization/?pageSize=1", jetty);
		JSONArray resultsOrg = new JSONObject(out.getContent()).getJSONArray("items");
		assertTrue(resultsOrg.length() > 0);

		//do we have any records
		out = tester.GETData("/authorities/person/?pageSize=1", jetty);
		JSONArray resultsPerson = new JSONObject(out.getContent()).getJSONArray("items");
		assertTrue(resultsPerson.length() > 0);

		//do we have any records
		out = tester.GETData("/authorities/concept/?pageSize=1", jetty);
		JSONArray resultsContent = new JSONObject(out.getContent()).getJSONArray("items");
		assertTrue(resultsContent.length() > 0);

        //do we have any records
		out = tester.GETData("/authorities/place/?pageSize=1", jetty);
		JSONArray resultsPlace = new JSONObject(out.getContent()).getJSONArray("items");
		assertTrue(resultsPlace.length() > 0);
		
		//make sure all the vocabs are initialized
		out = tester.GETData("/authorities/vocab/initialize", jetty);
		// update and remove fields not in each list within an authority
		// /chain/vocabularies/person/initialize?datapath=/Users/csm22/Documents/collectionspace/svcapp/cspi-webui/src/main/resources/org/collectionspace/chain/csp/webui/misc/names.txt

	}
	
	
	
}<commit_msg>CODE-3: Fixed typo in variable name in app test.<commit_after>package org.collectionspace.chain.csp.persistence.services.vocab;

import static org.junit.Assert.*;

import org.collectionspace.chain.csp.persistence.TestBase;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.AfterClass;
import org.junit.Test;
import org.mortbay.jetty.testing.HttpTester;
import org.mortbay.jetty.testing.ServletTester;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TestGenerateAuthorities {
	private static final Logger log = LoggerFactory
	.getLogger(TestGenerateAuthorities.class);
	private static TestBase tester = new TestBase();
	static ServletTester jetty;
	static {
		try{
			jetty=tester.setupJetty();
			}
		catch(Exception ex){
			
		}
	}
	
	@AfterClass public static  void testStop() throws Exception {
		tester.stopJetty(jetty);
	}
	

	
	@Test
	public void testSetUp() throws Exception {
		HttpTester out;
		log.info("initialize authorities");

		//String urltest = "/vocabularies/currency/refresh?datapath=/Users/csm22/Documents/collectionspace/test.txt";
		//out = tester.GETData(urltest, jetty);

		
		// repopulate the authorities with dummy data
		//DONOT RUN THIS TEST LOCALLY 
		out = tester.GETData("/reset/", jetty);
		

		//do we have any records
		out = tester.GETData("/authorities/organization/?pageSize=1", jetty);
		JSONArray resultsOrg = new JSONObject(out.getContent()).getJSONArray("items");
		assertTrue(resultsOrg.length() > 0);

		//do we have any records
		out = tester.GETData("/authorities/person/?pageSize=1", jetty);
		JSONArray resultsPerson = new JSONObject(out.getContent()).getJSONArray("items");
		assertTrue(resultsPerson.length() > 0);

		//do we have any records
		out = tester.GETData("/authorities/concept/?pageSize=1", jetty);
		JSONArray resultsConcept = new JSONObject(out.getContent()).getJSONArray("items");
		assertTrue(resultsConcept.length() > 0);

        //do we have any records
		out = tester.GETData("/authorities/place/?pageSize=1", jetty);
		JSONArray resultsPlace = new JSONObject(out.getContent()).getJSONArray("items");
		assertTrue(resultsPlace.length() > 0);
		
		//make sure all the vocabs are initialized
		out = tester.GETData("/authorities/vocab/initialize", jetty);
		// update and remove fields not in each list within an authority
		// /chain/vocabularies/person/initialize?datapath=/Users/csm22/Documents/collectionspace/svcapp/cspi-webui/src/main/resources/org/collectionspace/chain/csp/webui/misc/names.txt

	}
	
	
	
}
{'fraction_non_alphanumeric': 0.125024925224327, 'fraction_numerical': 0.005782652043868395, 'mean_word_length': 4.579532814238043, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1897108', 'n_tokens_mistral': 1738, 'n_tokens_neox': 1565, 'n_words': 334}