<commit_before>package com.justjournal.db;

import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource;
import org.apache.cayenne.access.DataContext;
import org.apache.cayenne.configuration.server.ServerRuntime;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import static org.junit.Assert.assertEquals;

public class LocationDaoTest {
    @BeforeClass
       public static void setUpClass() throws Exception {
           try {
               // Create initial context
               System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
                   "org.apache.naming.java.javaURLContextFactory");
               System.setProperty(Context.URL_PKG_PREFIXES,
                   "org.apache.naming");
               InitialContext ic = new InitialContext();

               ic.createSubcontext("java:");
               ic.createSubcontext("java:comp");
               ic.createSubcontext("java:comp/env");
               ic.createSubcontext("java:comp/env/jdbc");

               // Construct DataSource
               MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();
               ds.setURL("jdbc:mysql://ds9.midnightbsd.org:3306/jj");
               ds.setUser("jj");
               ds.setPassword("");

               ic.bind("java:comp/env/jdbc/jjDB", ds);

               ServerRuntime cayenneRuntime = new ServerRuntime("cayenne-JustJournalDomain.xml");
               DataContext.bindThreadObjectContext(cayenneRuntime.getContext());
           } catch (NamingException ex) {
                System.err.println(ex.getMessage());
           }

       }

    @Test
    public void testView() throws Exception {
        assertEquals(5, LocationDao.view().size());
    }
}<commit_msg>db context<commit_after>package com.justjournal.db;

import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource;
import org.apache.cayenne.access.DataContext;
import org.apache.cayenne.configuration.server.ServerRuntime;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import static org.junit.Assert.assertEquals;

public class LocationDaoTest {
    @BeforeClass
    public static void setUpClass() throws Exception {
        try {
            // Create initial context
            System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
                    "org.apache.naming.java.javaURLContextFactory");
            System.setProperty(Context.URL_PKG_PREFIXES,
                    "org.apache.naming");
            InitialContext ic = new InitialContext();

            ic.createSubcontext("java:");
            ic.createSubcontext("java:comp");
            ic.createSubcontext("java:comp/env");
            ic.createSubcontext("java:comp/env/jdbc");

            // Construct DataSource
            MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();
            ds.setURL("jdbc:mysql://ds9.midnightbsd.org:3306/jj");
            ds.setUser("jj");
            ds.setPassword("");

            ic.bind("java:comp/env/jdbc/jjDB", ds);

            ServerRuntime cayenneRuntime = new ServerRuntime("cayenne-JustJournalDomain.xml");
            DataContext.bindThreadObjectContext(cayenneRuntime.getContext());
        } catch (NamingException ex) {
            System.err.println(ex.getMessage());
        }

    }

    @Test
    public void testView() throws Exception {
        assertEquals(5, LocationDao.view().size());
    }
}
{'fraction_non_alphanumeric': 0.10855263157894737, 'fraction_numerical': 0.003837719298245614, 'mean_word_length': 2.5950738916256157, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '7482983', 'n_tokens_mistral': 999, 'n_tokens_neox': 974, 'n_words': 155}