package it.eng.btem.client.test;

import it.eng.btemanager.client.json.LinkListJSonModel;
import it.eng.btemanager.client.json.scase.AccountJSonModel;
import it.eng.btemanager.client.operations.ServiceEngine;
import it.eng.btemanager.client.operations.beans.InputDataBean;
import it.eng.btemanager.client.operations.beans.OperationBean;
import it.eng.btemanager.client.operations.beans.OperationBean.Operation;
import it.eng.btemanager.client.operations.beans.OutputDataBean;

public class Test {

	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub

		InputDataBean input = new InputDataBean();
		input.setBaseUrl("http://localhost:8080/eticsbte/api");
		input.setInputData(new AccountJSonModel());
		input.setObjectIdentifier("1");
		
		OperationBean operation = new OperationBean(input,Operation.READ_OBJECT);
		
		
		OperationBean response = ServiceEngine.getInstance().execute(operation);
	
		System.out.println(response.getOutputData());
		
		AccountJSonModel responseModel = new AccountJSonModel();
		responseModel.fromJson(response.getOutputData().getResponseData().getBytes());
		
		System.out.println("UserName "+responseModel.getUsername());
		
	}

}
