package com.ebmwebsourcing.easybpel.usecase.collecteRegimeCNAV;

import java.io.File;

import javax.xml.namespace.QName;

import com.ebmwebsourcing.easybpel.model.bpel.api.BPELException;
import com.ebmwebsourcing.easyviper.core.api.CoreException;
import com.ebmwebsourcing.easyviper.environment.test.env.api.Operation;
import com.ebmwebsourcing.easyviper.environment.test.env.api.ProviderEndpoint;
import com.ebmwebsourcing.easyviper.environment.test.env.api.Service;
import com.ebmwebsourcing.easyviper.environment.test.env.impl.AbstractServiceImpl;

/**
 * 
 * @author alouis
 *
 */
public class NotifRetardService extends AbstractServiceImpl implements Service {


	public NotifRetardService(ProviderEndpoint pep) throws Exception {
		super(pep);
		this.setName(new QName("http://notif.architecture.cnav.fr/", "I_ServiceNotifRetardPortType"));

		// Create operation
		
		notificationRetard();
	}

	private void notificationRetard() throws Exception {
		try {
			File in = new File(
					"./src/test/resources/NotifRetardServiceRequest.xml");
			File out = new File(
					"./src/test/resources/NotifRetardServiceResponse.xml");

			Operation notificationRetard = MockServiceBuilder.buildOperation(this,
					"http://notif.architecture.cnav.fr/", "notificationRetard",
					"I_ServiceNotifRetardPortType", getProviderEndpoint()
							.getName(), in, "notificationRetard", out,
					"notificationRetardResponse", null, null);
			this.addOperation(notificationRetard);

		} catch (CoreException e) {
			throw new BPELException(e);
		}
	
	}
	
}
