<commit_before>package org.intermine.web.struts;

/*
 * Copyright (C) 2002-2011 FlyMine
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  See the LICENSE file for more
 * information or http://www.gnu.org/copyleft/lesser.html.
 *
 */

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import junit.framework.TestCase;

import org.intermine.api.InterMineAPI;
import org.intermine.api.bag.BagQuery;
import org.intermine.api.bag.BagQueryConfig;
import org.intermine.api.config.ClassKeyHelper;
import org.intermine.api.profile.InterMineBag;
import org.intermine.api.profile.Profile;
import org.intermine.api.profile.ProfileManager;
import org.intermine.api.template.SwitchOffAbility;
import org.intermine.api.template.TemplateQuery;
import org.intermine.metadata.FieldDescriptor;
import org.intermine.metadata.Model;
import org.intermine.model.InterMineObject;
import org.intermine.model.userprofile.UserProfile;
import org.intermine.objectstore.ObjectStore;
import org.intermine.objectstore.ObjectStoreException;
import org.intermine.objectstore.ObjectStoreFactory;
import org.intermine.objectstore.ObjectStoreSummary;
import org.intermine.objectstore.ObjectStoreWriter;
import org.intermine.objectstore.ObjectStoreWriterFactory;
import org.intermine.objectstore.query.ConstraintOp;
import org.intermine.objectstore.query.Query;
import org.intermine.objectstore.query.QueryClass;
import org.intermine.objectstore.query.QueryField;
import org.intermine.objectstore.query.QueryValue;
import org.intermine.objectstore.query.SimpleConstraint;
import org.intermine.objectstore.query.SingletonResults;
import org.intermine.pathquery.Path;
import org.intermine.pathquery.PathConstraint;
import org.intermine.pathquery.PathConstraintAttribute;
import org.intermine.pathquery.PathConstraintBag;
import org.intermine.pathquery.PathConstraintLookup;
import org.intermine.pathquery.PathConstraintLoop;
import org.intermine.pathquery.PathConstraintNull;
import org.intermine.pathquery.PathConstraintSubclass;
import org.intermine.pathquery.PathException;
import org.intermine.pathquery.PathQuery;
import org.intermine.web.logic.query.DisplayConstraint;
import org.intermine.web.logic.query.DisplayConstraintFactory;
import org.intermine.web.logic.query.DisplayConstraint.DisplayConstraintOption;


public class DisplayConstraintTest extends TestCase
{
    protected ProfileManager pm;
    protected ObjectStore os;
    protected ObjectStoreWriter uosw;
    protected Map<String, List<FieldDescriptor>> classKeys;
    protected Profile superUser, testUser, emptyUser;
    protected DisplayConstraint dcAttribute, dcNull, dcBag, dcLookup, dcSubclass,
    dcLoop, dcNullPathConstraint, dcAttribute2, dcInTemplate;
    protected InterMineBag firstEmployeeBag, secondEmployeeBag;

    public void setUp() throws Exception
    {
        super.setUp();
        os = ObjectStoreFactory.getObjectStore("os.unittest");
        uosw =  ObjectStoreWriterFactory.getObjectStoreWriter("osw.userprofile-test");

        pm = new ProfileManager(os, uosw);
        superUser = new Profile(pm, "superUser", null, "password",
            new HashMap(), new HashMap(), new HashMap());
        pm.createProfile(superUser);
        pm.setSuperuser("superUser");

        testUser = new Profile(pm, "testUser", null, "password",
            new HashMap(), new HashMap(), new HashMap());
        pm.createProfile(testUser);

        emptyUser = new Profile(pm, "emptyUser", null, "password",
            new HashMap(), new HashMap(), new HashMap());
        pm.createProfile(emptyUser);
<commit_msg>Test fix<commit_after>package org.intermine.web.struts;

/*
 * Copyright (C) 2002-2011 FlyMine
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  See the LICENSE file for more
 * information or http://www.gnu.org/copyleft/lesser.html.
 *
 */

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import junit.framework.TestCase;

import org.intermine.api.InterMineAPI;
import org.intermine.api.bag.BagQuery;
import org.intermine.api.bag.BagQueryConfig;
import org.intermine.api.config.ClassKeyHelper;
import org.intermine.api.profile.InterMineBag;
import org.intermine.api.profile.Profile;
import org.intermine.api.profile.ProfileManager;
import org.intermine.api.template.SwitchOffAbility;
import org.intermine.api.template.TemplateQuery;
import org.intermine.metadata.FieldDescriptor;
import org.intermine.metadata.Model;
import org.intermine.model.InterMineObject;
import org.intermine.model.userprofile.UserProfile;
import org.intermine.objectstore.ObjectStore;
import org.intermine.objectstore.ObjectStoreException;
import org.intermine.objectstore.ObjectStoreFactory;
import org.intermine.objectstore.ObjectStoreSummary;
import org.intermine.objectstore.ObjectStoreWriter;
import org.intermine.objectstore.ObjectStoreWriterFactory;
import org.intermine.objectstore.query.ConstraintOp;
import org.intermine.objectstore.query.Query;
import org.intermine.objectstore.query.QueryClass;
import org.intermine.objectstore.query.QueryField;
import org.intermine.objectstore.query.QueryValue;
import org.intermine.objectstore.query.SimpleConstraint;
import org.intermine.objectstore.query.SingletonResults;
import org.intermine.pathquery.Path;
import org.intermine.pathquery.PathConstraint;
import org.intermine.pathquery.PathConstraintAttribute;
import org.intermine.pathquery.PathConstraintBag;
import org.intermine.pathquery.PathConstraintLookup;
import org.intermine.pathquery.PathConstraintLoop;
import org.intermine.pathquery.PathConstraintNull;
import org.intermine.pathquery.PathConstraintSubclass;
import org.intermine.pathquery.PathException;
import org.intermine.pathquery.PathQuery;
import org.intermine.web.logic.query.DisplayConstraint;
import org.intermine.web.logic.query.DisplayConstraintFactory;
import org.intermine.web.logic.query.DisplayConstraint.DisplayConstraintOption;


public class DisplayConstraintTest extends TestCase
{
    protected ProfileManager pm;
    protected ObjectStore os;
    protected ObjectStoreWriter uosw;
    protected Map<String, List<FieldDescriptor>> classKeys;
    protected Profile superUser, testUser, emptyUser;
    protected DisplayConstraint dcAttribute, dcNull, dcBag, dcLookup, dcSubclass,
    dcLoop, dcNullPathConstraint, dcAttribute2, dcInTemplate;
    protected InterMineBag firstEmployeeBag, secondEmployeeBag;

    public void setUp() throws Exception
    {
        super.setUp();
        os = ObjectStoreFactory.getObjectStore("os.unittest");
        uosw =  ObjectStoreWriterFactory.getObjectStoreWriter("osw.userprofile-test");

        pm = new ProfileManager(os, uosw);
        superUser = new Profile(pm, "superUser", null, "password",
            new HashMap(), new HashMap(), new HashMap(), true);
        pm.createProfile(superUser);
        pm.setSuperuser("superUser");

        testUser = new Profile(pm, "testUser", null, "password",
            new HashMap(), new HashMap(), new HashMap(), true);
        pm.createProfile(testUser);

        emptyUser = new Profile(pm, "emptyUser", null, "password",
            new HashMap(), new HashMap(), new HashMap(), true);
        pm.createProfile(emptyUser);

{'fraction_non_alphanumeric': 0.09639344262295083, 'fraction_numerical': 0.002360655737704918, 'mean_word_length': 5.22530612244898, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7662310', 'n_tokens_mistral': 2156, 'n_tokens_neox': 2121, 'n_words': 456}