Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/sales.git
src/main/resources/scripts/2_ca_safeway.xml
<var-def name="flyer_page">
- <html-to-text id="flyer_text">
- <html-to-xml id="flyer_xml" htmlparser="jsoup">
+ <html-to-text>
+ <html-to-xml htmlparser="jsoup">
<http method="get" url="${vendor_url}">
<http-param name="store_code">
<var name="store_code"/>
</http-param>
</http>
</html-to-xml>
</html-to-text>
</var-def>
-
- <var-def name="product_regex" id="product_regex">
+
+ <var-def name="product_regex">
<regexp replace="true">
<regexp-pattern>[\s]</regexp-pattern>
<regexp-source><var name="product_name" /></regexp-source>
<regexp-result><template>.*</template></regexp-result>
</regexp>
</var-def>
<var-def name="product_price">
<regexp flag-caseinsensitive="yes" flag-dotall="no">
- <regexp-pattern id="pattern">.*<var name="product_regex"/>.*</regexp-pattern>
+ <regexp-pattern>.*<var name="product_regex"/>.*</regexp-pattern>
<regexp-source>
<var name="flyer_page" />
</regexp-source>
</regexp>
</var-def>
- <var-def name="message_body" id="message_body">
+ <var-def name="message_body">
<call name="vendor-name">
<call-param name="include_vendor_name">
src/test/java/com/whitemagicsoftware/sales/service/impl/DefaultScraperServiceTest.java
Product product = products.get( 4 );
-// for( Vendor vendor : vendors ) {
- Vendor vendor = vendors.get( 1 );
- Scraper scraper = createScraperService().createScraper( vendor );
+ for( Vendor vendor : vendors ) {
+// Vendor vendor = vendors.get( 1 );
+ Scraper scraper = createScraperService().createScraper( vendor );
- scraper.addVariableToContext( "include_vendor_name", true );
- scraper.addVariableToContext( "location_code", "V8V1Z9" );
- scraper.addVariableToContext( "product_name", product.getName() );
- scraper.addVariableToContext( "product_path", product.getUrlPath() );
+ scraper.addVariableToContext( "include_vendor_name", true );
+ scraper.addVariableToContext( "location_code", "V8V1Z9" );
+ scraper.addVariableToContext( "product_name", product.getName() );
+ scraper.addVariableToContext( "product_path", product.getUrlPath() );
- // Change the debug directory to where the application was launched.
- scraper.setDebugDir( System.getProperty( "user.dir" ) );
- scraper.setDebug( true );
- scraper.execute();
+ // Change the debug directory to where the application was launched.
+ scraper.setDebugDir( System.getProperty( "user.dir" ) );
+ scraper.setDebug( true );
+ scraper.execute();
- Variable body = scraper.getContext().getVar( "message_body" );
-// }
+ Variable body = scraper.getContext().getVar( "message_body" );
+ }
}
}

Removed debugging from script. Added scraper test to test all vendors.

Author djarvis <email>
Date 2016-07-03 19:21:39 GMT-0700
Commit 3d45622d5115eca4f34695e2fca898812b4c84b2
Parent c72958b
Delta 19 lines added, 19 lines removed