⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testtaskproperties.java

📁 用来为垂直搜索引擎抓取数据的采集系统
💻 JAVA
字号:
/*
 * *****************************************************
 * Copyright (c) 2005 IIM Lab. All  Rights Reserved.
 * Created by xuehao at 2005-10-12
 * Contact: zxuehao@mail.ustc.edu.cn
 * *****************************************************
 */

package org.indigo.tests.util;

import org.indigo.util.TaskProperties;

import junit.framework.TestCase;


public class TestTaskProperties extends TestCase
{

    public void testTaskProperties()
    {

        String VisitBeginUrl = null, CollectedBeginUrl = null, VisitKey = null, CollectedKey = null, StartPageNum = null, EndPageNum = null, incPageNum = null;
        String idFront=null, idBack=null;

        TaskProperties props = new TaskProperties();
        props.open("taskconfig/农业网站/吉林省/供求信息.task");

        VisitBeginUrl = props.getProperty("VisitBeginUrl");
        VisitKey = props.getProperty("VisitKey");
        StartPageNum = props.getProperty("StartPageNum");
        EndPageNum = props.getProperty("EndPageNum");
        incPageNum = props.getProperty("incPageNum");
        
        CollectedBeginUrl = props.getProperty("CollectedBeginUrl");
        CollectedKey = props.getProperty("CollectedKey");

        idFront = props.getProperty( "IdFront" );
        idBack = props.getProperty( "IdBack" );

        String str = null;
        int ruleCount = 0, i;
        str = props.getProperty("RuleCount");
        ruleCount = Integer.parseInt(str);
        String front[] = new String[ruleCount];
        String back[] = new String[ruleCount];
        for (i = 0; i < ruleCount; i++)
        {
            str = props.getProperty( "Front" + (i+1) );
            front[i] = str;
            str = props.getProperty( "Back" + (i+1) );
            back[i] = str;
        }
    }
    public void testTaskProperties2()
    {
        TaskProperties props = new TaskProperties();
        props.open("taskconfig/test/test.task");
        
        props.setProperty( "LastItem", "value" );
        props.deleteProperties( "key" );
        props.changeProperty( "LastItem", "value2" );
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -