Newer
Older
RestfulChecker / src / main / Main.java
y-ota on 13 Dec 2018 2 KB jsonの配列に対応
package main;

import java.util.ArrayList;

import restfulchecker.*;
import restfulchecker.RestChecker.Method;
import testcase.*;

public class Main {
	static RestChecker api = new RestChecker();
	static ArrayList<RestParam> queryParam = new ArrayList<>();
	static ArrayList<RestParam> formParam = new ArrayList<>();
	static ArrayList<String> pathParam = new ArrayList<>();
	static NecessaryParam nes = new NecessaryParam();
	static RemoveJsonParam remove = new RemoveJsonParam();
	static TestCactus get = new TestGETCactus();
	static TestCactus post = new TestCreatePOSTCactus("f", "f", "f");
	static TestCactus logout = new TestLogoutPOSTCactus(
			"h41ZoL44toLq3Kg7B1aXreHjcjluAsoyz8DezqiXJ28s1atiGR5UHFOqi7Or3xOD");
	static TestCactus put = new TestPUTCactus("f", "f");
	static TestCactus delete = new TestDELETECactus("qF9bgKYZmw8P");

	public static void main(String[] args) {
//		logout.start();
		init();
		api.jsonAcquisition("src/main/you.json");
		System.out.println(api.getReadJson());
		System.out.println(api.jsonRemove(
				"[{\"snippet\":{\"title\":\"aaa\",\"status\":\"e\"}},{\"snippet\":{\"title\":\"aaa\",\"status\":\"e\"}}]",
				remove));
//		api.doRestTest();
//		System.out.println(api.getResults());
	}

	private static void init() {
		api.setAccount("https://www.googleapis.com/youtube/v3");
		queryParam.add(new RestParam("mine", "true"));
		queryParam.add(new RestParam("part", "id"));
		queryParam.add(new RestParam("access_token",
				"ya29.GltwBvF7RosPhYHUlEnGaorRpqpdyD1nwRAm4m3rNihRsIZV5ZgZsL3PB_3jwMJTKF1huWkKkorUPiCsunGfMySzxfutzX4y0RN9f4iw8GxFyPHBEkPZHbxsgSXF"));
		pathParam.add("playlists");
		api.getGetnesParam().setQueryParams(new RestParam("mine", "true"));
		api.getGetnesParam().setQueryParams(new RestParam("part", "id"));
		api.getGetnesParam().setQueryParams(new RestParam("access_token",
				"ya29.GltwBvF7RosPhYHUlEnGaorRpqpdyD1nwRAm4m3rNihRsIZV5ZgZsL3PB_3jwMJTKF1huWkKkorUPiCsunGfMySzxfutzX4y0RN9f4iw8GxFyPHBEkPZHbxsgSXF"));
		api.getGetnesParam().setPathParams("playlists");
		// api.setProperty("Content-type", "application/json");
		api.setRemoveParam(new RemoveJsonParam("etag", new ArrayList<>()));
		api.setupRestTest(Method.GET, queryParam, formParam, pathParam);
		remove.setRemoveParam("title");
		remove.setNode("snippet");
	}

}