<commit_before>/*
 * The Gemma project
 * 
 * Copyright (c) 2006 University of British Columbia
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package ubic.gemma.apps;

import java.io.File;

/**
 * @author pavlidis
 * @version $Id$
 */
public class ProbeMapperTest extends AbstractCLITestCase {

    File tempFile;

    ProbeMapper p;

    /*
     * (non-Javadoc)
     * 
     * @see junit.framework.TestCase#setUp()
     */
    protected void setUp() throws Exception {
        super.setUp();
        tempFile = File.createTempFile( "cli", ".txt" );
        p = new ProbeMapper();
    }

    protected void tearDown() throws Exception {
        // tempFile.delete();
    }

    public final void testMainBadPort() throws Exception {
        Exception result = p.doWork( new String[] { "-P", "c", "-u", "pavlidis", "-p", "toast", "-o",
                tempFile.getAbsolutePath() } );
        // should result in an exception
        assertTrue( result.getMessage(), result != null );
    }

    public void testBlatHandling() throws Exception {

        String basePath = this.getTestFileBasePath();

        String blatFile = basePath + System.getProperty( "file.separator" )
                + "/gemma-core/src/test/resources/data/loader/genome/blatresult.noheader.txt";

        Exception result = p.doWork( new String[] { "-u", "pavlidis", "-p", "toast", "-o", tempFile.getAbsolutePath(),
                "-b", blatFile, "-d", "hg17" } );
        if ( result != null ) {
            fail( result.getMessage() );
        }
    }

    public void testGbHandling() throws Exception {

        String basePath = this.getTestFileBasePath();

        String gbFile = basePath + System.getProperty( "file.separator" )
                + "/gemma-core/src/test/resources/data/loader/genome/ncbiGenes.test.txt";

        Exception result = p.doWork( new String[] { "-u", "pavlidis", "-p", "toast", "-o", tempFile.getAbsolutePath(),
                "-g", gbFile, "-d", "hg17" } );
        if ( result != null ) {
            fail( result.getMessage() );
        }
    }

    public void testSingleGb() throws Exception {
        Exception result = p.doWork( new String[] { "-u", "pavlidis", "-p", "toast", "-o", tempFile.getAbsolutePath(),
                "-d", "hg17", "AF015731", "BX473803" } );
        if ( result != null ) {
            result.printStackTrace();
            fail( result.getMessage() );
        }
    }
}<commit_msg>check for valid test files<commit_after>/*
 * The Gemma project
 * 
 * Copyright (c) 2006 University of British Columbia
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package ubic.gemma.apps;

import java.io.File;

/**
 * @author pavlidis
 * @version $Id$
 */
public class ProbeMapperTest extends AbstractCLITestCase {

    File tempFile;

    ProbeMapper p;

    /*
     * (non-Javadoc)
     * 
     * @see junit.framework.TestCase#setUp()
     */
    protected void setUp() throws Exception {
        super.setUp();
        tempFile = File.createTempFile( "cli", ".txt" );
        p = new ProbeMapper();
    }

    protected void tearDown() throws Exception {
        // tempFile.delete();
    }

    public final void testMainBadPort() throws Exception {
        Exception result = p.doWork( new String[] { "-P", "c", "-u", "pavlidis", "-p", "toast", "-o",
                tempFile.getAbsolutePath() } );
        // should result in an exception
        assertTrue( result.getMessage(), result != null );
    }

    public void testBlatHandling() throws Exception {

        String basePath = this.getTestFileBasePath();

        String blatFile = basePath + System.getProperty( "file.separator" )
                + "/gemma-core/src/test/resources/data/loader/genome/blatresult.noheader.txt";
        
        assert ( new File( blatFile ) ).canRead();
        
        Exception result = p.doWork( new String[] { "-u", "pavlidis", "-p", "toast", "-o", tempFile.getAbsolutePath(),
                "-b", blatFile, "-d", "hg17" } );
        if ( result != null ) {
            fail( result.getMessage() );
        }
    }

    public void testGbHandling() throws Exception {

        String basePath = this.getTestFileBasePath();

        String gbFile = basePath + System.getProperty( "file.separator" )
                + "/gemma-core/src/test/resources/data/loader/genome/ncbiGenes.test.txt";

        assert ( new File( gbFile ) ).canRead();

        Exception result = p.doWork( new String[] { "-u", "pavlidis", "-p", "toast", "-o", tempFile.getAbsolutePath(),
                "-g", gbFile, "-d", "hg17" } );
        if ( result != null ) {
            fail( result.getMessage() );
        }
    }

    public void testSingleGb() throws Exception {
        Exception result = p.doWork( new String[] { "-u", "pavlidis", "-p", "toast", "-o", tempFile.getAbsolutePath(),
                "-d", "hg17", "AF015731", "BX473803" } );
        if ( result != null ) {
            result.printStackTrace();
            fail( result.getMessage() );
        }
    }
}
{'fraction_non_alphanumeric': 0.13729066489802685, 'fraction_numerical': 0.008622119051566905, 'mean_word_length': 2.3944850872256613, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1790583', 'n_tokens_mistral': 1825, 'n_tokens_neox': 1728, 'n_words': 514}