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 CollecteService3 extends AbstractServiceImpl implements Service {

	public CollecteService3(ProviderEndpoint pep) throws Exception {
		super(pep);
		this.setName(new QName("http://collecte.architecture.cnav.fr/",
				"I_ServiceActiviteCollectePortType"));

		// Create operation
		collecteRegime3();
	}

	private void collecteRegime3() throws Exception {
		try {
			File in = new File(
					"./src/test/resources/CollecteServiceRequest.xml");
			File out = new File(
					"./src/test/resources/CollecteServiceResponse3.xml");

			Operation collecteRegime = MockServiceBuilder.buildOperation(this,
					"http://collecte.architecture.cnav.fr/", "collecteRegime",
					"I_ServiceActiviteCollectePortType", getProviderEndpoint()
							.getName(), in, "collecteRegime", out,
					"collecteRegimeResponse", null, null);
			this.addOperation(collecteRegime);

		} catch (CoreException e) {
			throw new BPELException(e);
		}
	}

}
