Package com.analysis.control

Examples of com.analysis.control.AnaCrack


                this.getKeyword());
        // Get all items
        crawlResult = aCrawl.crawlWebPages(craigslistURL, 2500);
        logger.debug("aResultColl Size=" + crawlResult.size());
        // Create analyzer object
        analyzer = new AnaCrack();
        // Do the analyzing and return the offers
        analyzerOffers = analyzer.analyse(
                crawlResult, /* The result collection from the crawler */
                10, /* Give me the x best offers */
                CraigslistAlgorithmEnum.BEST, /* To use algorithm */
 
View Full Code Here


        Collection<CrawlResultPackage> aResultColl =aCrawl.crawlWebPages(aUrl, 5000);

        logger.debug("aResultColl Size=" + aResultColl.size());

        // 3. Create analyzer object
        AnaCrack aAnaCrack = new AnaCrack();

        // 4. do the anlysing and return the offers
        Collection<CrawlResultPackage> aAnaColl = aAnaCrack.analyse(
                aResultColl, /* The result collection from the crawler */
                50, /* Give me the x best offers */
                CraigslistAlgorithmEnum.BEST, /* To use algorithm */
                1, /* Lower control limit */
                1000 /* higher control limit */
        );
       
        int i = 0;
        for (CrawlResultPackage aPack : aAnaColl) {
            i++;
            logger.debug(i + ". BEST OFFERS=" + aPack.toString());
        }
       
        Collection<LocationDistribution> aLocColl=aAnaCrack.getLocationDistribution();
       
        i = 0;
        for (LocationDistribution aLoc : aLocColl) {
            i++;
            logger.info(aLoc.toString());
        }

        logger.info(aLocColl.size());
       
        Collection<PriceDistribution> aPriceColl=aAnaCrack.getPriceDistribution();
       
        i = 0;
        for (PriceDistribution aPrice : aPriceColl) {
            i++;
            logger.debug(aPrice.toString());
View Full Code Here

  static Logger logger = Logger.getLogger(AnaCrackTest.class);

  @Test
  public void test_createAnaCrack() {
      logger.info("Create AnaCrack class...");
    AnaCrack c = new AnaCrack();
    assertTrue(c != null);
  }
View Full Code Here

 
    @Test
    public void test_illegalArgumentException() {
        logger.info("Catch expected IllegalArgumentException");
        logger.info("Create AnaCrack class and give over nothing null and -1 ...");
        AnaCrack c = new AnaCrack();
       
        try{
            Collection<CrawlResultPackage> aColl=c.analyse(null, -1, null, -1, -1);
        } catch (IllegalArgumentException e){
            logger.info("Catch expected IllegalArgumentException exception");
            logger.info(e);
        }
View Full Code Here

   
    @Test
    public void test_collectionAverage() {
        logger.info("Test Average");
       
        AnaCrack c = new AnaCrack();
       
        // ToDo try something lower then 10 Packages and you will receive an Exception
        Collection<CrawlResultPackage> aColl=c.analyse(AnaCrackTest.generateFakeColl(1, 10, 1), 10, CraigslistAlgorithmEnum.BEST, 1, 10);

        logger.debug(""+c.toString());
       
        assertTrue(c.getAverage() == 5);
    }
View Full Code Here

   
    @Test
    public void test_offers() {
        logger.info("Test offers");
       
        AnaCrack c = new AnaCrack();
       
        // ToDo try something lower then 10 Packages and you will receive an Exception
        Collection<CrawlResultPackage> aColl=c.analyse(AnaCrackTest.generateFakeColl(1, 10, 1), 10, CraigslistAlgorithmEnum.BEST, 1, 10);

        logger.debug(""+c.toString());
       
        assertTrue(c.getOffers() == 9);
    }
View Full Code Here

   
    @Test
    public void test_min() {
        logger.info("Test min");
       
        AnaCrack c = new AnaCrack();
       
        // ToDo try something lower then 10 Packages and you will receive an Exception
        Collection<CrawlResultPackage> aColl=c.analyse(AnaCrackTest.generateFakeColl(1, 10, 1), 10, CraigslistAlgorithmEnum.BEST, 1, 10);

        logger.debug(""+c.toString());
       
        assertTrue(c.getMin() == 1);
    }
View Full Code Here

   
    @Test
    public void test_max() {
        logger.info("Test max");
       
        AnaCrack c = new AnaCrack();
       
        // ToDo try something lower then 10 Packages and you will receive an Exception
        Collection<CrawlResultPackage> aColl=c.analyse(AnaCrackTest.generateFakeColl(1, 10, 1), 10, CraigslistAlgorithmEnum.BEST, 1, 10);

        logger.debug(""+c.toString());
       
        assertTrue(c.getMax() == 9);
    }
View Full Code Here

   
    @Test
    public void test_median() {
        logger.info("Test median");
       
        AnaCrack c = new AnaCrack();
       
        // ToDo try something lower then 10 Packages and you will receive an Exception
        Collection<CrawlResultPackage> aColl=c.analyse(AnaCrackTest.generateFakeColl(1, 10, 1), 10, CraigslistAlgorithmEnum.BEST, 1, 10);

        logger.debug(""+c.toString());
       
        assertTrue(c.getMedian() == 5.0);
    }
View Full Code Here

   
    @Test
    public void test_standardDeviation() {
        logger.info("Test Standard Deviation");
       
        AnaCrack c = new AnaCrack();
       
        // ToDo try something lower then 10 Packages and you will receive an Exception
        Collection<CrawlResultPackage> aColl=c.analyse(AnaCrackTest.generateFakeColl(1, 10, 1), 10, CraigslistAlgorithmEnum.BEST, 1, 10);

        logger.debug(""+c.toString());
       
        assertTrue(c.getStandardDeviation() == 2.7386127875258306);
    }
View Full Code Here

TOP

Related Classes of com.analysis.control.AnaCrack

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.