Updated Main demo method
This commit is contained in:
@@ -5,8 +5,8 @@ import javax.naming.ConfigurationException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import de.rwu.easydrop.api.client.AmazonProductDataSource;
|
||||
import de.rwu.easydrop.api.client.EbayItemDataSource;
|
||||
import de.rwu.easydrop.api.client.DataSourceFactory;
|
||||
import de.rwu.easydrop.service.retriever.ProductRetriever;
|
||||
import de.rwu.easydrop.util.Config;
|
||||
|
||||
/**
|
||||
@@ -34,25 +34,12 @@ public final class Main {
|
||||
*/
|
||||
public static void main(final String[] args) throws ConfigurationException {
|
||||
Config config = Config.getInstance();
|
||||
config.loadConfig();
|
||||
DataSourceFactory dataSourceFactory = new DataSourceFactory(config);
|
||||
ProductRetriever retriever = new ProductRetriever(dataSourceFactory);
|
||||
|
||||
String amznBaseUrl = config.getProperty("AMAZON_API_URL");
|
||||
String amznApiKey = config.getProperty("AMAZON_API_KEY");
|
||||
String ebayBaseUrl = config.getProperty("EBAY_API_URL");
|
||||
String ebayApiKey = config.getProperty("EBAY_API_KEY");
|
||||
|
||||
String amznTestProduct = null;
|
||||
String ebayTestProduct = null;
|
||||
|
||||
AmazonProductDataSource amznSrc = new AmazonProductDataSource(amznBaseUrl, amznApiKey);
|
||||
EbayItemDataSource ebaySrc = new EbayItemDataSource(ebayBaseUrl, ebayApiKey);
|
||||
try {
|
||||
amznTestProduct = amznSrc.getProductDTOById("B096Y2TYKV").toString();
|
||||
LOGGER.info(amznTestProduct);
|
||||
ebayTestProduct = ebaySrc.getProductDTOById("Gigabyte GeForce RTX 3060").toString();
|
||||
LOGGER.info(ebayTestProduct);
|
||||
} catch (IllegalArgumentException e) {
|
||||
LOGGER.error("Something went wrong :(", e);
|
||||
}
|
||||
String amznProduct = retriever.getProductFromAmazon("B096Y2TYKV").toString();
|
||||
LOGGER.info(amznProduct);
|
||||
String ebayProduct = retriever.getProductFromEbay("Gigabyte GeForce RTX 3060").toString();
|
||||
LOGGER.info(ebayProduct);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user