/**
 * Copyright 2009-2012 OpenAIRE PROJECT (Bielefeld University)
 * Original author: Marek Imialek <marek.imialek at uni-bielefeld.de>
 *
 * 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 eu.dnetlib.data.udm.client;

import java.util.List;

import javax.xml.ws.wsaddressing.W3CEndpointReference;

import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;

import eu.dnetlib.data.udm.IUsageDataMergingService;
import eu.dnetlib.data.udm.UsageDataMergingServiceException;
import eu.dnetlib.enabling.resultset.rmi.ResultSetException;
import eu.dnetlib.enabling.resultset.rmi.ResultSetService;
import eu.dnetlib.enabling.tools.JaxwsServiceResolverImpl;

import static org.junit.Assert.assertNotNull;

/**
 * The Class SimpleUDMClient is a simple client testing getAllRecords 
 * function. 
 * 
 * @author <a href="mailto:marek.imialek at uni-bielefeld.de">Marek Imialek</a>
 */

public class SimpleUDMClient {

	/** The service. */
	private static IUsageDataMergingService service;
	//private static String address = "http://localhost:8090/dnet-udm/services/UsageDataMergingService?";
	/** The address. */
	private static String address = 
		"http://129.70.40.104:8287/dnet-udm/services/UsageDataMergingService?";
	
	/**
	 * The main method.
	 * 
	 * @param args the args
	 * 
	 * @throws UsageDataMergingServiceException the usage data merging service exception
	 */
	public static void main(String[] args) throws Exception {
		
		//Logger  logger = Logger.getLogger("eu.dnetlib.data");
		//logger.setLevel(Level.DEBUG);
		
		JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
		factory.setServiceClass(IUsageDataMergingService.class);
		factory.setAddress(address);
		service = (IUsageDataMergingService) factory.create();
		assertNotNull(service.identify(), "Can not connect UDM Service");
		System.out.println("Service Identify: " + service.identify() );
		
		//service.createCompleteDataCollection();
		
		service.createYesterdaysDataCollection("2011-03-24");
		//service.createYesterdaysDataCollection("2011-10-05");
		//service.createYesterdaysDataCollection("2011-10-05");
		
	}
}
