Revert "Integration Test Suite for Office API."

This commit is contained in:
Vishwas Babu A J
2014-12-10 04:39:25 -08:00
parent 9e7ce7afeb
commit a3da63b760
4 changed files with 1 additions and 170 deletions
@@ -1,37 +0,0 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertEquals;
import com.google.gson.Gson;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.Utils;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.builder.ResponseSpecBuilder;
import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
import java.util.*;
public class OfficeIntegrationsTest {
private ResponseSpecification statusOkResponseSpec;
private RequestSpecification requestSpec;
@Before
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.statusOkResponseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
}
}
@@ -3,8 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.office;
package org.mifosplatform.integrationtests.common;
import java.util.HashMap;
@@ -1,103 +0,0 @@
package org.mifosplatform.integrationtests.common.office;
import com.google.gson.Gson;
public class OfficeHelper {
public static class Builder {
private String name;
private String externalId;
private Long id;
private String nameDecorated;
private int openingDate[] = new int[3];
private String hierarchy;
private Builder(final String name) {
this.name = name;
}
public Builder externalId(final String externalId) {
this.externalId = externalId;
return this;
}
public Builder nameDecorated(final String nameDecorated) {
this.nameDecorated = nameDecorated;
}
public Builder openingDate(final int[] openingDate) {
this.openingDate = openingDate;
}
public Builder hierarchy(final String hierarchy) {
this.hierarchy = hierarchy;
}
public OfficeHelper build() {
return new OfficeHelper(this.name, this.externalId, this.id, this.nameDecorated, this.openingDate, this.hierarchy);
}
}
private String name;
private String externalId;
private Long id;
private String nameDecorated;
OfficeHelper() {
super();
}
private OfficeHelper(final String name, final String externalId, final String nameDecorated, final String hierarchy, final int[] openingDate) {
super();
this.name = name;
this.externalId = externalId;
this.nameDecorated = nameDecorated;
this.hierarchy = hierarchy;
this.openingDate = openingDate;
}
}
public String toJSON() {
return new Gson().toJson(this);
}
public static OfficeHelper fromJSON(final String jsonData) {
return new Gson().fromJson(jsonData, OfficeHelper.class);
}
public String getName() {
return this.name;
}
public Long getId() {
return this.id;
}
public String getNameDecorated()
{ return this.nameDecorated; }
public String getHierarchy()
{ return this.hierarchy; }
public String getExternalId() {
return this.externalId;
}
public int openingDate() {
return this.openingDate;
}
}
@@ -1,28 +0,0 @@
package org.mifosplatform.integrationtests.common.office;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
import org.mifosplatform.integrationtests.common.Utils;
import java.util.HashMap;
import java.util.List;
public class OfficeResourceHandler {
private static final String OFFICES_URL = "/mifosng-provider/api/v1/offices";
private static final String CREATE_OFFICES_URL = OFFICES_URL + "?" + Utils.TENANT_IDENTIFIER;
public static Integer createFund(final String fundJSON,
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
return Utils.performServerPost(requestSpec, responseSpec, CREATE_FUNDS_URL, fundJSON, "resourceId");
}
public Integer createOffice(final String openingDate) {
String json = getAsJSON(openingDate);
return Utils.performServerPost(this.requestSpec, this.responseSpec, OFFICE_URL + "?" + Utils.TENANT_IDENTIFIER, json,
CommonConstants.RESPONSE_RESOURCE_ID);
}
}