<commit_before>package org.lantern.state;

import static org.junit.Assert.assertEquals;

import java.io.File;

import org.apache.commons.lang.SystemUtils;
import org.junit.BeforeClass;
import org.junit.Test;
import org.lantern.TestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ModelIoTest {

    private static Logger LOG = LoggerFactory.getLogger(ModelIoTest.class);

    private static File testFile;

    @BeforeClass
    public static void setup() throws Exception {
        testFile = new File("modelTest");
        testFile.delete();
        testFile.deleteOnExit();
    }
    
    @Test
    public void testModelIo() throws Exception {
        ModelIo io = 
            new ModelIo(testFile, TestUtils.getEncryptedFileService());
        
        Model model = io.get();
        
        final String id = model.getNodeId();
        SystemData system = model.getSystem();
        Settings settings = model.getSettings();
        Connectivity connectivity = model.getConnectivity();
        assertEquals("", connectivity.getIp());
        
        final String ip = "172.16.58.3";
        //connectivity.setIp(ip);
        
        assertEquals(0, model.getNinvites());
        model.setNinvites(10);
        assertEquals(10, model.getNinvites());
        
        assertEquals(true, settings.isAutoConnect());
        settings.setAutoConnect(false);
        
        if ("en".equalsIgnoreCase(SystemUtils.USER_LANGUAGE)) {
            assertEquals("en", system.getLang());
        }
        io.write();
        
        io = new ModelIo(testFile, TestUtils.getEncryptedFileService());
        model = io.get();
        system = model.getSystem();
        settings = model.getSettings();
        connectivity = model.getConnectivity();
        assertEquals(false, settings.isAutoConnect());
        assertEquals(10, model.getNinvites());
        
        // The user's IP address should not persist to disk
        assertEquals("", connectivity.getIp());
        
        assertEquals("ID should persist across sessions", 
            id, model.getNodeId());
        <commit_msg>Fixed compile<commit_after>package org.lantern.state;

import static org.junit.Assert.assertEquals;

import java.io.File;

import org.apache.commons.lang.SystemUtils;
import org.junit.BeforeClass;
import org.junit.Test;
import org.lantern.TestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ModelIoTest {

    private static Logger LOG = LoggerFactory.getLogger(ModelIoTest.class);

    private static File testFile;

    @BeforeClass
    public static void setup() throws Exception {
        testFile = new File("modelTest");
        testFile.delete();
        testFile.deleteOnExit();
    }
    
    @Test
    public void testModelIo() throws Exception {
        ModelIo io = 
            new ModelIo(testFile, TestUtils.getEncryptedFileService());
        
        Model model = io.get();
        
        final String id = model.getNodeId();
        SystemData system = model.getSystem();
        Settings settings = model.getSettings();
        Connectivity connectivity = model.getConnectivity();
        assertEquals("", connectivity.getIp());
        
        final String ip = "172.16.58.3";
        //connectivity.setIp(ip);
        
        assertEquals(0, model.getNinvites());
        model.setNinvites(10);
        assertEquals(10, model.getNinvites());
        
        if ("en".equalsIgnoreCase(SystemUtils.USER_LANGUAGE)) {
            assertEquals("en", system.getLang());
        }
        io.write();
        
        io = new ModelIo(testFile, TestUtils.getEncryptedFileService());
        model = io.get();
        system = model.getSystem();
        settings = model.getSettings();
        connectivity = model.getConnectivity();
        assertEquals(10, model.getNinvites());
        
        // The user's IP address should not persist to disk
        assertEquals("", connectivity.getIp());
        
        assertEquals("ID should persist across sessions", 
            id, model.getNodeId());
        
{'fraction_non_alphanumeric': 0.11089303238469088, 'fraction_numerical': 0.008341511285574092, 'mean_word_length': 2.4521591871295514, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '6123643', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1077, 'n_words': 244}