package eu.dnetlib.clients;

import gr.uoa.di.driver.enabling.a2.A2Wrapper;
import gr.uoa.di.driver.enabling.a2.A2WrapperImpl;

public class TestA2Wrapper {

	private static A2Wrapper a2Wrapper = new A2WrapperImpl();

//	@BeforeClass
//	public static void setup() throws Throwable {
//		try {
//			JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
//			factory.setServiceClass(A2Service.class);
//			factory.setAddress("http://88.197.20.214/a2service-ws/A2Service");
//
//			 JAXBDataBinding dataBinding = new JAXBDataBinding();
//             Map<String, Object> contextProperties = new HashMap<String, Object>();
//             try {
//                     contextProperties.put(com.sun.xml.bind.api.JAXBRIContext.ANNOTATION_READER, 
//                             new ThrowableTransientAnnotationReaderBuilder().buildInstance());
//             } catch(Exception e) {
//                     throw new RuntimeException(e);
//             }
//             dataBinding.setContextProperties(contextProperties);
//             factory.setDataBinding(dataBinding);
//			
//			A2Service webService = (A2Service) factory.create();
//			
//			AASClient aasClient = new AASClient();
//			aasClient.setA2Service(webService);
//			StaticServiceLocator<eu.dnetlib.api.enabling.A2Service> locator = new StaticServiceLocator<eu.dnetlib.api.enabling.A2Service>();
//			
//			locator.setService(aasClient);
//
//			((A2WrapperImpl) a2Wrapper).setLocator(locator);
//		} catch (Throwable t) {
//			t.printStackTrace();
//
//			throw t;
//		}
//	}
//	
//	@Test
//	public void test() throws A2ServiceException, NoSuchAlgorithmException {
//		String secContextId = a2Wrapper.authenticateUser("kiatrop@di.uoa.gr", 
//				MD5.encrypt2Hex("1234"));
//		
//		assertNotNull(secContextId);
//	}
}
