<commit_before>package net.metadata.dataspace.app;

import net.metadata.dataspace.atom.util.ClientHelper;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import static junit.framework.Assert.assertEquals;

/**
 * Author: alabri
 * Date: 24/11/2010
 * Time: 10:21:04 AM
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = Constants.TEST_CONTEXT)
public class AppTest {

    @Test
    public void testCorrectLoginLogout() throws Exception {
        //create a client
        HttpClient client = new HttpClient();
        //correct username and password
        int status = ClientHelper.login(client, Constants.USERNAME, Constants.PASSWORD);
        assertEquals("Could not authenticate", 200, status);
<commit_msg>Added a very simple test to ensure the most important pages actually display something (which should catch future XSLT errors).<commit_after>package net.metadata.dataspace.app;

import net.metadata.dataspace.atom.util.ClientHelper;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

/**
 * Author: alabri
 * Date: 24/11/2010
 * Time: 10:21:04 AM
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = Constants.TEST_CONTEXT)
public class AppTest {

	@Test
    public void testPublicFrontPage() throws Exception {
        //create a client
		HttpClient client = new HttpClient();
        GetMethod result;
        String[] locations = { "", "browse", "agents", "collections" };
        for (int i = 0; i < locations.length; i++) {
        	result = ClientHelper.getEntry(client, Constants.URL_PREFIX+locations[i], "text/html");
        	assertEquals(result.getURI()+" should return 200 OK", 200, result.getStatusCode());
        	assertTrue(result.getURI()+" should return not be zero length", 
        			0 < result.getResponseBody().length);
        }
    }
	
    @Test
    public void testCorrectLoginLogout() throws Exception {
        //create a client
        HttpClient client = new HttpClient();
        //correct username and password
        int status = ClientHelper.login(client, Constants.USERNAME, Constants.PASSWORD);
        assertEquals("Could not authenticate", 200, status);

{'fraction_non_alphanumeric': 0.10499453153481589, 'fraction_numerical': 0.017499088589135983, 'mean_word_length': 4.138576779026217, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6204314', 'n_tokens_mistral': 800, 'n_tokens_neox': 751, 'n_words': 187}