
package com.andreistraut.gaps.datamodel.mock;

import com.andreistraut.gaps.controller.MessageRequest;
import com.google.gson.JsonObject;

public class MessageRequestMock {
    private MessageRequest getGraphRequestMock;
    private MessageRequest computePathsRequestMock;
    private MessageRequest evolveRequestMock;
    private MessageRequest compareRequestMock;
    
    private final JsonObject computeEvolveCompareRequestJsonData;
    
    public MessageRequestMock() {
	this.computeEvolveCompareRequestJsonData = new JsonObject();
	this.computeEvolveCompareRequestJsonData.addProperty("comparePaths", 5);
	this.computeEvolveCompareRequestJsonData.addProperty("sourceNode", 0);
	this.computeEvolveCompareRequestJsonData.addProperty("destinationNode", 29);
	this.computeEvolveCompareRequestJsonData.addProperty("numberOfPaths", 100);
	this.computeEvolveCompareRequestJsonData.addProperty("numberOfEvolutions", 1000);
	this.computeEvolveCompareRequestJsonData.addProperty("stopConditionPercent", 100);
	
	this.initGetGraphMock();
	this.initComputePathsRequestMock();
	this.initEvolveRequestMock();
	this.initCompareRequestMock();
    }
    
    private void initGetGraphMock() {
	JsonObject getGraphRequest = new JsonObject();
	
	getGraphRequest.addProperty("callback_id", 1);
	getGraphRequest.addProperty("type", "GetGraph");
	getGraphRequest.add("data", this.computeEvolveCompareRequestJsonData);
	
	this.getGraphRequestMock = new MessageRequest(getGraphRequest);
    }
    
    private void initComputePathsRequestMock() {
	JsonObject computePathsRequest = new JsonObject();
	
	computePathsRequest.addProperty("callback_id", 2);
	computePathsRequest.addProperty("type", "ComputePaths");
	computePathsRequest.add("data", this.computeEvolveCompareRequestJsonData);
	
	this.computePathsRequestMock = new MessageRequest(computePathsRequest);
    }
    
    private void initEvolveRequestMock() {
	JsonObject evolveRequest = new JsonObject();	
	
	evolveRequest.addProperty("callback_id", 3);
	evolveRequest.addProperty("type", "Evolve");
	evolveRequest.add("data", this.computeEvolveCompareRequestJsonData);
	
	this.computePathsRequestMock = new MessageRequest(evolveRequest);
    }
    
    private void initCompareRequestMock() {
	JsonObject compareRequest = new JsonObject();	
	
	compareRequest.addProperty("callback_id", 4);
	compareRequest.addProperty("type", "compare");
	compareRequest.add("data", this.computeEvolveCompareRequestJsonData);
	
	this.computePathsRequestMock = new MessageRequest(compareRequest);
    }

    public MessageRequest getGetGraphRequestMock() {
	return getGraphRequestMock;
    }

    public MessageRequest getComputePathsRequestMock() {
	return computePathsRequestMock;
    }

    public MessageRequest getEvolveRequestMock() {
	return evolveRequestMock;
    }

    public MessageRequest getCompareRequestMock() {
	return compareRequestMock;
    }
}

@@ -1225,17 +1225,349 @@
 ject();%0A
-%09
+        %0A        JsonObject getGraphRequestData = new JsonObject();%0A        getGraphRequestData.addProperty(%22numberOfNodes%22, 30);%0A        getGraphRequestData.addProperty(%22numberOfEdges%22, 100);%0A        getGraphRequestData.addProperty(%22minimumEdgeWeight%22, 1);%0A        getGraphRequestData.addProperty(%22maximumEdgeWeight%22, 100);%0A        
 %0A%09getGra
@@ -1690,44 +1690,23 @@
 a%22, 
-this.computeEvolveCompare
+getGraph
 Request
-Json
 Data
@@ -2673,17 +2673,17 @@
 type%22, %22
-c
+C
 ompare%22)

Fix wrong data in GetGraphMessageRequest