Format files with google-java-format 1.6
Change-Id: Ie7ff83768e4b812b8067ddad806d7c22bdfae284
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/PhabricatorItsFacade.java b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/PhabricatorItsFacade.java
index 0459ef0..62c2f78 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/PhabricatorItsFacade.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/PhabricatorItsFacade.java
@@ -14,26 +14,23 @@
package com.googlesource.gerrit.plugins.its.phabricator;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Set;
-
-import org.eclipse.jgit.lib.Config;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import com.google.common.collect.Sets;
import com.google.gerrit.extensions.annotations.PluginName;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.gson.JsonElement;
import com.google.inject.Inject;
-
import com.googlesource.gerrit.plugins.its.base.its.ItsFacade;
import com.googlesource.gerrit.plugins.its.phabricator.conduit.Conduit;
import com.googlesource.gerrit.plugins.its.phabricator.conduit.ConduitErrorException;
import com.googlesource.gerrit.plugins.its.phabricator.conduit.ConduitException;
import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ManiphestInfo;
import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ProjectInfo;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Set;
+import org.eclipse.jgit.lib.Config;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class PhabricatorItsFacade implements ItsFacade {
private static final Logger log = LoggerFactory.getLogger(PhabricatorItsFacade.class);
@@ -44,18 +41,15 @@
private final Conduit conduit;
@Inject
- public PhabricatorItsFacade(@PluginName String pluginName,
- @GerritServerConfig Config cfg) {
+ public PhabricatorItsFacade(@PluginName String pluginName, @GerritServerConfig Config cfg) {
String url = cfg.getString(pluginName, null, GERRIT_CONFIG_URL);
- String token = cfg.getString(pluginName, null,
- GERRIT_CONFIG_TOKEN);
+ String token = cfg.getString(pluginName, null, GERRIT_CONFIG_TOKEN);
this.conduit = new Conduit(url, token);
}
@Override
- public void addComment(final String bugId, final String comment)
- throws IOException {
+ public void addComment(final String bugId, final String comment) throws IOException {
int task_id = Integer.parseInt(bugId);
try {
conduit.maniphestEdit(task_id, comment);
@@ -66,10 +60,10 @@
}
@Override
- public void addRelatedLink(final String issueKey, final URL relatedUrl,
- String description) throws IOException {
- addComment(issueKey, "Related URL: " + createLinkForWebui(
- relatedUrl.toExternalForm(), description));
+ public void addRelatedLink(final String issueKey, final URL relatedUrl, String description)
+ throws IOException {
+ addComment(
+ issueKey, "Related URL: " + createLinkForWebui(relatedUrl.toExternalForm(), description));
}
@Override
@@ -83,7 +77,7 @@
} catch (ConduitErrorException e) {
// An ERR_BAD_TASK just means that the task does not exist.
// So the default value of ret would be ok
- if (! ("ERR_BAD_TASK".equals(e.getErrorCode()))) {
+ if (!("ERR_BAD_TASK".equals(e.getErrorCode()))) {
// So we had an exception that is /not/ ERR_BAD_TASK.
// We have to relay that to the caller.
throw e;
@@ -122,9 +116,11 @@
}
private void assertParameters(String action, String[] params, int length) throws IOException {
- if (params.length -1 != length) {
- throw new IOException(String.format("Action %s expects exactly %d parameter(s) but %d given",
- action, length, params.length -1));
+ if (params.length - 1 != length) {
+ throw new IOException(
+ String.format(
+ "Action %s expects exactly %d parameter(s) but %d given",
+ action, length, params.length - 1));
}
}
@@ -136,8 +132,7 @@
Set<String> projectPhids = Sets.newHashSet(projectPhid);
ManiphestInfo taskInfo = conduit.maniphestInfo(taskId);
- for (JsonElement jsonElement :
- taskInfo.getProjectPHIDs().getAsJsonArray()) {
+ for (JsonElement jsonElement : taskInfo.getProjectPHIDs().getAsJsonArray()) {
projectPhids.add(jsonElement.getAsString());
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/PhabricatorModule.java b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/PhabricatorModule.java
index b7e2d4e..35171cd 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/PhabricatorModule.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/PhabricatorModule.java
@@ -14,18 +14,16 @@
package com.googlesource.gerrit.plugins.its.phabricator;
-import org.eclipse.jgit.lib.Config;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import com.google.gerrit.extensions.annotations.PluginName;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.gerrit.server.config.PluginConfigFactory;
import com.google.inject.AbstractModule;
import com.google.inject.Inject;
-
import com.googlesource.gerrit.plugins.its.base.ItsHookModule;
import com.googlesource.gerrit.plugins.its.base.its.ItsFacade;
+import org.eclipse.jgit.lib.Config;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class PhabricatorModule extends AbstractModule {
@@ -36,7 +34,8 @@
private final PluginConfigFactory pluginCfgFactory;
@Inject
- public PhabricatorModule(@PluginName final String pluginName,
+ public PhabricatorModule(
+ @PluginName final String pluginName,
@GerritServerConfig final Config config,
PluginConfigFactory pluginCfgFactory) {
this.pluginName = pluginName;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/Conduit.java b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/Conduit.java
index 3032b41..fa834fe 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/Conduit.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/Conduit.java
@@ -1,43 +1,40 @@
-//Copyright (C) 2017 The Android Open Source Project
+// Copyright (C) 2017 The Android Open Source Project
//
-//Licensed under the Apache License, Version 2.0 (the "License");
-//you may not use this file except in compliance with the License.
-//You may obtain a copy of the License at
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
//
-//http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
-//Unless required by applicable law or agreed to in writing, software
-//distributed under the License is distributed on an "AS IS" BASIS,
-//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//See the License for the specific language governing permissions and
-//limitations under the License.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
package com.googlesource.gerrit.plugins.its.phabricator.conduit;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-
import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ConduitPing;
-import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ManiphestInfo;
import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ManiphestEdit;
+import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ManiphestInfo;
import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ProjectInfo;
import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.QueryResult;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Bindings for Phabricator's Conduit API
- * <p/>
- * This class is not thread-safe.
+ *
+ * <p>This class is not thread-safe.
*/
public class Conduit {
@@ -70,9 +67,7 @@
this.token = token;
}
- /**
- * Runs the API's 'conduit.ping' method
- */
+ /** Runs the API's 'conduit.ping' method */
public ConduitPing conduitPing() throws ConduitException {
Map<String, Object> params = new HashMap<>();
JsonElement callResult = conduitConnection.call("conduit.ping", params, token);
@@ -82,9 +77,7 @@
return result;
}
- /**
- * Runs the API's 'maniphest.Info' method
- */
+ /** Runs the API's 'maniphest.Info' method */
public ManiphestInfo maniphestInfo(int taskId) throws ConduitException {
Map<String, Object> params = new HashMap<>();
params.put("task_id", taskId);
@@ -94,38 +87,38 @@
return result;
}
- /**
- * Runs the API's 'maniphest.edit' method
- */
+ /** Runs the API's 'maniphest.edit' method */
public ManiphestEdit maniphestEdit(int taskId, String comment) throws ConduitException {
return maniphestEdit(taskId, comment, null, ACTION_COMMENT);
}
- /**
- * Runs the API's 'maniphest.edit' method
- */
- public ManiphestEdit maniphestEdit(int taskId, Iterable<String> projects, String action) throws ConduitException {
+ /** Runs the API's 'maniphest.edit' method */
+ public ManiphestEdit maniphestEdit(int taskId, Iterable<String> projects, String action)
+ throws ConduitException {
return maniphestEdit(taskId, null, projects, action);
}
- /**
- * Runs the API's 'maniphest.edit' method
- */
- public ManiphestEdit maniphestEdit(int taskId, String comment, Iterable<String> projects, String action) throws ConduitException {
+ /** Runs the API's 'maniphest.edit' method */
+ public ManiphestEdit maniphestEdit(
+ int taskId, String comment, Iterable<String> projects, String action)
+ throws ConduitException {
HashMap<String, Object> params = new HashMap<>();
List<Object> list = new ArrayList<>();
HashMap<String, Object> params2 = new HashMap<>();
params2.put("type", action);
- if(action.equals(ACTION_COMMENT)) {
+ if (action.equals(ACTION_COMMENT)) {
if (comment == null) {
- throw new IllegalArgumentException("The value of comment (null) is invalid for the action" + action);
+ throw new IllegalArgumentException(
+ "The value of comment (null) is invalid for the action" + action);
}
params2.put("value", comment);
}
- if(action.equals(ACTION_PROJECT_ADD) || action.equals(ACTION_PROJECT_REMOVE)) {
- if ((action.equals(ACTION_PROJECT_ADD) || action.equals(ACTION_PROJECT_REMOVE)) && projects == null) {
- throw new IllegalArgumentException("The value of projects (null) is invalid for the action " + action);
+ if (action.equals(ACTION_PROJECT_ADD) || action.equals(ACTION_PROJECT_REMOVE)) {
+ if ((action.equals(ACTION_PROJECT_ADD) || action.equals(ACTION_PROJECT_REMOVE))
+ && projects == null) {
+ throw new IllegalArgumentException(
+ "The value of projects (null) is invalid for the action " + action);
}
params2.put("value", projects);
}
@@ -141,9 +134,7 @@
return result;
}
- /**
- * Runs the API's 'projectQuery' method to match exactly one project name
- */
+ /** Runs the API's 'projectQuery' method to match exactly one project name */
public ProjectInfo projectQuery(String name) throws ConduitException {
Map<String, Object> params = new HashMap<>();
params.put("names", Arrays.asList(name));
@@ -153,11 +144,9 @@
JsonObject queryResultData = queryResult.getData().getAsJsonObject();
ProjectInfo result = null;
- for (Entry<String, JsonElement> queryResultEntry:
- queryResultData.entrySet()) {
+ for (Entry<String, JsonElement> queryResultEntry : queryResultData.entrySet()) {
JsonElement queryResultEntryValue = queryResultEntry.getValue();
- ProjectInfo queryResultProjectInfo =
- gson.fromJson(queryResultEntryValue, ProjectInfo.class);
+ ProjectInfo queryResultProjectInfo = gson.fromJson(queryResultEntryValue, ProjectInfo.class);
if (queryResultProjectInfo.getName().equals(name)) {
result = queryResultProjectInfo;
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/ConduitConnection.java b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/ConduitConnection.java
index cf74e0e..9d93080 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/ConduitConnection.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/ConduitConnection.java
@@ -1,24 +1,26 @@
-//Copyright (C) 2017 The Android Open Source Project
+// Copyright (C) 2017 The Android Open Source Project
//
-//Licensed under the Apache License, Version 2.0 (the "License");
-//you may not use this file except in compliance with the License.
-//You may obtain a copy of the License at
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
//
-//http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
-//Unless required by applicable law or agreed to in writing, software
-//distributed under the License is distributed on an "AS IS" BASIS,
-//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//See the License for the specific language governing permissions and
-//limitations under the License.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
package com.googlesource.gerrit.plugins.its.phabricator.conduit;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
-
import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.CallCapsule;
-
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
@@ -29,14 +31,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Abstracts the connection to Conduit API
- */
+/** Abstracts the connection to Conduit API */
class ConduitConnection {
private static final Logger log = LoggerFactory.getLogger(Conduit.class);
@@ -53,8 +48,8 @@
/**
* Gives a cached HttpClient
- * <p/>
- * If no cached HttpClient exists, a new one is spawned.
+ *
+ * <p>If no cached HttpClient exists, a new one is spawned.
*
* @return the cached CloseableHttpClient
*/
@@ -85,12 +80,12 @@
* @return The call's result, if there has been no error
* @throws ConduitException
*/
- JsonElement call(String method, Map<String, Object> params, String token) throws ConduitException {
+ JsonElement call(String method, Map<String, Object> params, String token)
+ throws ConduitException {
String methodUrl = apiUrlBase + method;
HttpPost httppost = new HttpPost(methodUrl);
-
if (token != null) {
Map<String, Object> conduitParams = new HashMap<>();
conduitParams.put("token", token);
@@ -99,8 +94,7 @@
String json = gson.toJson(params);
- log.trace("Calling phabricator method " + method
- + " with the parameters " + json );
+ log.trace("Calling phabricator method " + method + " with the parameters " + json);
httppost.setEntity(new StringEntity("params=" + json, StandardCharsets.UTF_8));
CloseableHttpResponse response;
@@ -124,10 +118,9 @@
log.trace("callCapsule.result: " + callCapsule.getResult());
log.trace("callCapsule.error_code: " + callCapsule.getErrorCode());
log.trace("callCapsule.error_info: " + callCapsule.getErrorInfo());
- if (callCapsule.getErrorCode() != null
- || callCapsule.getErrorInfo() != null) {
- throw new ConduitErrorException(method, callCapsule.getErrorCode(),
- callCapsule.getErrorInfo());
+ if (callCapsule.getErrorCode() != null || callCapsule.getErrorInfo() != null) {
+ throw new ConduitErrorException(
+ method, callCapsule.getErrorCode(), callCapsule.getErrorInfo());
}
return callCapsule.getResult();
} finally {
@@ -138,4 +131,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/ConduitErrorException.java b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/ConduitErrorException.java
index c684297..c4b1f0c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/ConduitErrorException.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/ConduitErrorException.java
@@ -1,22 +1,20 @@
-//Copyright (C) 2014 The Android Open Source Project
+// Copyright (C) 2014 The Android Open Source Project
//
-//Licensed under the Apache License, Version 2.0 (the "License");
-//you may not use this file except in compliance with the License.
-//You may obtain a copy of the License at
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
//
-//http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
-//Unless required by applicable law or agreed to in writing, software
-//distributed under the License is distributed on an "AS IS" BASIS,
-//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//See the License for the specific language governing permissions and
-//limitations under the License.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
package com.googlesource.gerrit.plugins.its.phabricator.conduit;
-/**
- * Exception thrown if Conduit response has error_code or error_info set
- */
+/** Exception thrown if Conduit response has error_code or error_info set */
public class ConduitErrorException extends ConduitException {
private static final long serialVersionUID = 1L;
@@ -25,10 +23,12 @@
private final String errorInfo;
ConduitErrorException(String method, String errorCode, String errorInfo) {
- super("Method '" + method + "' gave: " +errorCode +
- ((errorInfo != null && !errorInfo.isEmpty())
- ? (", " + errorInfo)
- : ""));
+ super(
+ "Method '"
+ + method
+ + "' gave: "
+ + errorCode
+ + ((errorInfo != null && !errorInfo.isEmpty()) ? (", " + errorInfo) : ""));
this.errorCode = errorCode;
this.errorInfo = errorInfo;
}
@@ -40,5 +40,4 @@
public String getErrorInfo() {
return errorInfo;
}
-
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/ConduitException.java b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/ConduitException.java
index edde2fd..b6a5a43 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/ConduitException.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/ConduitException.java
@@ -1,22 +1,20 @@
-//Copyright (C) 2014 The Android Open Source Project
+// Copyright (C) 2014 The Android Open Source Project
//
-//Licensed under the Apache License, Version 2.0 (the "License");
-//you may not use this file except in compliance with the License.
-//You may obtain a copy of the License at
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
//
-//http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
-//Unless required by applicable law or agreed to in writing, software
-//distributed under the License is distributed on an "AS IS" BASIS,
-//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//See the License for the specific language governing permissions and
-//limitations under the License.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
package com.googlesource.gerrit.plugins.its.phabricator.conduit;
-/**
- * Generic wrapper for Exceptions caused by processing for Conduit
- */
+/** Generic wrapper for Exceptions caused by processing for Conduit */
public class ConduitException extends Exception {
private static final long serialVersionUID = 1L;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/CallCapsule.java b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/CallCapsule.java
index dcf0484..51e32f8 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/CallCapsule.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/CallCapsule.java
@@ -1,24 +1,25 @@
-//Copyright (C) 2014 The Android Open Source Project
+// Copyright (C) 2014 The Android Open Source Project
//
-//Licensed under the Apache License, Version 2.0 (the "License");
-//you may not use this file except in compliance with the License.
-//You may obtain a copy of the License at
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
//
-//http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
-//Unless required by applicable law or agreed to in writing, software
-//distributed under the License is distributed on an "AS IS" BASIS,
-//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//See the License for the specific language governing permissions and
-//limitations under the License.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
package com.googlesource.gerrit.plugins.its.phabricator.conduit.results;
import com.google.gson.JsonElement;
/**
* Models the generic wrapper for API calls
- * <p/>
- * JSON looks like:
+ *
+ * <p>JSON looks like:
+ *
* <pre>
* {
* "result": SOME JSON OBJECT,
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ConduitConnect.java b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ConduitConnect.java
index 52919f5..05c74d6 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ConduitConnect.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ConduitConnect.java
@@ -1,22 +1,23 @@
-//Copyright (C) 2014 The Android Open Source Project
+// Copyright (C) 2014 The Android Open Source Project
//
-//Licensed under the Apache License, Version 2.0 (the "License");
-//you may not use this file except in compliance with the License.
-//You may obtain a copy of the License at
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
//
-//http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
-//Unless required by applicable law or agreed to in writing, software
-//distributed under the License is distributed on an "AS IS" BASIS,
-//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//See the License for the specific language governing permissions and
-//limitations under the License.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
package com.googlesource.gerrit.plugins.its.phabricator.conduit.results;
/**
* Models the result for a call to conduit.connect
- * <p/>
- * JSON looks like:
+ *
+ * <p>JSON looks like:
+ *
* <pre>
* {
* "connectionID":4,
@@ -24,8 +25,8 @@
* "userPHID":"PHID-USER-h4n52fq2kt2v3a2qjyqh"
* }
* </pre>
- * @author christian
*
+ * @author christian
*/
public class ConduitConnect {
private int connectionID;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ConduitPing.java b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ConduitPing.java
index 5d409b3..860ed82 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ConduitPing.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ConduitPing.java
@@ -1,23 +1,23 @@
-//Copyright (C) 2014 The Android Open Source Project
+// Copyright (C) 2014 The Android Open Source Project
//
-//Licensed under the Apache License, Version 2.0 (the "License");
-//you may not use this file except in compliance with the License.
-//You may obtain a copy of the License at
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
//
-//http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
-//Unless required by applicable law or agreed to in writing, software
-//distributed under the License is distributed on an "AS IS" BASIS,
-//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//See the License for the specific language governing permissions and
-//limitations under the License.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
package com.googlesource.gerrit.plugins.its.phabricator.conduit.results;
/**
* Models the result for a call to conduit.ping
- * <p/>
- * JSON is just the hostname of the instance. We wrap it in a proper object
- * to make it a nicer Java citizen.
+ *
+ * <p>JSON is just the hostname of the instance. We wrap it in a proper object to make it a nicer
+ * Java citizen.
*/
public class ConduitPing {
private String hostname;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ManiphestEdit.java b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ManiphestEdit.java
index 8323f4e..e9e3805 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ManiphestEdit.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ManiphestEdit.java
@@ -1,22 +1,23 @@
-//Copyright (C) 2014 The Android Open Source Project
+// Copyright (C) 2014 The Android Open Source Project
//
-//Licensed under the Apache License, Version 2.0 (the "License");
-//you may not use this file except in compliance with the License.
-//You may obtain a copy of the License at
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
//
-//http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
-//Unless required by applicable law or agreed to in writing, software
-//distributed under the License is distributed on an "AS IS" BASIS,
-//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//See the License for the specific language governing permissions and
-//limitations under the License.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
package com.googlesource.gerrit.plugins.its.phabricator.conduit.results;
/**
* Models the result for a call to maniphest.edit
- * <p/>
- * JSON looks like:
+ *
+ * <p>JSON looks like:
+ *
* <pre>
* {
* "id":"48",
@@ -46,6 +47,4 @@
* }
* </pre>
*/
-public class ManiphestEdit extends Task {
-
-}
+public class ManiphestEdit extends Task {}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ManiphestInfo.java b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ManiphestInfo.java
index 472853e..7358c79 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ManiphestInfo.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ManiphestInfo.java
@@ -1,51 +1,50 @@
-//Copyright (C) 2014 The Android Open Source Project
+// Copyright (C) 2014 The Android Open Source Project
//
-//Licensed under the Apache License, Version 2.0 (the "License");
-//you may not use this file except in compliance with the License.
-//You may obtain a copy of the License at
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
//
-//http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
-//Unless required by applicable law or agreed to in writing, software
-//distributed under the License is distributed on an "AS IS" BASIS,
-//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//See the License for the specific language governing permissions and
-//limitations under the License.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
package com.googlesource.gerrit.plugins.its.phabricator.conduit.results;
/**
-* Models the result for a call to maniphest.info
-* <p/>
-* JSON looks like:
-* <pre>
-* {
-* "id":"48",
-* "phid":"PHID-TASK-pemd324eosnymq3tdkyo",
-* "authorPHID":"PHID-USER-na3one2sht11aone",
-* "ownerPHID":null,
-* "ccPHIDs":[
-* "PHID-USER-h4n62fq2kt2v3a2qjyqh"
-* ],
-* "status":"open",
-* "statusName":"Open",
-* "isClosed":false,
-* "priority": "Needs Triage",
-* "priorityColor":"violet",
-* "title":"QChris test task",
-* "description":"",
-* "projectPHIDs":[],
-* "uri":"https://phab-01.wmflabs.org/T47",
-* "auxiliary":{
-* "std:maniphest:security_topic":"default",
-* "isdc:sprint:storypoints":null
-* },
-* "objectName":"T47",
-* "dateCreated":"1413484594",
-* "dateModified":1413549869,
-* "dependsOnTaskPHIDs":[]
-* }
-* </pre>
-*/
-public class ManiphestInfo extends Task {
-
-}
+ * Models the result for a call to maniphest.info
+ *
+ * <p>JSON looks like:
+ *
+ * <pre>
+ * {
+ * "id":"48",
+ * "phid":"PHID-TASK-pemd324eosnymq3tdkyo",
+ * "authorPHID":"PHID-USER-na3one2sht11aone",
+ * "ownerPHID":null,
+ * "ccPHIDs":[
+ * "PHID-USER-h4n62fq2kt2v3a2qjyqh"
+ * ],
+ * "status":"open",
+ * "statusName":"Open",
+ * "isClosed":false,
+ * "priority": "Needs Triage",
+ * "priorityColor":"violet",
+ * "title":"QChris test task",
+ * "description":"",
+ * "projectPHIDs":[],
+ * "uri":"https://phab-01.wmflabs.org/T47",
+ * "auxiliary":{
+ * "std:maniphest:security_topic":"default",
+ * "isdc:sprint:storypoints":null
+ * },
+ * "objectName":"T47",
+ * "dateCreated":"1413484594",
+ * "dateModified":1413549869,
+ * "dependsOnTaskPHIDs":[]
+ * }
+ * </pre>
+ */
+public class ManiphestInfo extends Task {}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ProjectInfo.java b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ProjectInfo.java
index a3414c9..c0d2706 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ProjectInfo.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ProjectInfo.java
@@ -1,24 +1,25 @@
-//Copyright (C) 2015 The Android Open Source Project
+// Copyright (C) 2015 The Android Open Source Project
//
-//Licensed under the Apache License, Version 2.0 (the "License");
-//you may not use this file except in compliance with the License.
-//You may obtain a copy of the License at
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
//
-//http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
-//Unless required by applicable law or agreed to in writing, software
-//distributed under the License is distributed on an "AS IS" BASIS,
-//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//See the License for the specific language governing permissions and
-//limitations under the License.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
package com.googlesource.gerrit.plugins.its.phabricator.conduit.results;
import com.google.gson.JsonElement;
/**
* Models the result for API methods returning Project information
- * <p/>
- * JSON looks like:
+ *
+ * <p>JSON looks like:
+ *
* <pre>
* {
* "id":"23",
@@ -49,30 +50,39 @@
public int getId() {
return id;
}
+
public String getPhid() {
return phid;
}
+
public String getName() {
return name;
}
+
public String getProfileImagePHID() {
return profileImagePHID;
}
+
public String getIcon() {
return icon;
}
+
public String getColor() {
return color;
}
+
public JsonElement getMembers() {
return members;
}
+
public JsonElement getSlugs() {
return slugs;
}
+
public String getDateCreated() {
return dateCreated;
}
+
public String getDateModified() {
return dateModified;
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/QueryResult.java b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/QueryResult.java
index bd0467d..5f45f15 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/QueryResult.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/QueryResult.java
@@ -1,24 +1,25 @@
-//Copyright (C) 2015 The Android Open Source Project
+// Copyright (C) 2015 The Android Open Source Project
//
-//Licensed under the Apache License, Version 2.0 (the "License");
-//you may not use this file except in compliance with the License.
-//You may obtain a copy of the License at
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
//
-//http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
-//Unless required by applicable law or agreed to in writing, software
-//distributed under the License is distributed on an "AS IS" BASIS,
-//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//See the License for the specific language governing permissions and
-//limitations under the License.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
package com.googlesource.gerrit.plugins.its.phabricator.conduit.results;
import com.google.gson.JsonElement;
/**
* Models the result for API methods returning a (possible paged) QueryResult
- * <p/>
- * JSON looks like:
+ *
+ * <p>JSON looks like:
+ *
* <pre>
* {
* "data": { ... },
@@ -29,8 +30,8 @@
* "before": null
* }
* }
- * </pre>
- */
+ * </pre>
+ */
public class QueryResult {
private JsonElement data;
private JsonElement slugMap;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/Task.java b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/Task.java
index 0392314..177968d 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/Task.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/Task.java
@@ -1,24 +1,25 @@
-//Copyright (C) 2014 The Android Open Source Project
+// Copyright (C) 2014 The Android Open Source Project
//
-//Licensed under the Apache License, Version 2.0 (the "License");
-//you may not use this file except in compliance with the License.
-//You may obtain a copy of the License at
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
//
-//http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
-//Unless required by applicable law or agreed to in writing, software
-//distributed under the License is distributed on an "AS IS" BASIS,
-//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//See the License for the specific language governing permissions and
-//limitations under the License.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
package com.googlesource.gerrit.plugins.its.phabricator.conduit.results;
import com.google.gson.JsonElement;
/**
* Models the result for API methods returning Task information
- * <p/>
- * JSON looks like:
+ *
+ * <p>JSON looks like:
+ *
* <pre>
* {
* "id":"48",
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/phabricator/PhabricatorItsFacadeTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/phabricator/PhabricatorItsFacadeTest.java
index 6910332..c164390 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/phabricator/PhabricatorItsFacadeTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/phabricator/PhabricatorItsFacadeTest.java
@@ -15,15 +15,13 @@
import static org.easymock.EasyMock.expect;
-import org.eclipse.jgit.lib.Config;
-
import com.google.gerrit.extensions.annotations.PluginName;
import com.google.gerrit.extensions.config.FactoryModule;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.inject.Guice;
import com.google.inject.Injector;
-
import com.googlesource.gerrit.plugins.its.base.testutil.LoggingMockingTestCase;
+import org.eclipse.jgit.lib.Config;
public class PhabricatorItsFacadeTest extends LoggingMockingTestCase {
private Injector injector;
@@ -78,10 +76,8 @@
}
private void mockUnconnectablePhabricator() {
- expect(serverConfig.getString("its-phabricator", null, "url"))
- .andReturn("<no-url>").anyTimes();
- expect(serverConfig.getString("its-phabricator", null, "token"))
- .andReturn("none").anyTimes();
+ expect(serverConfig.getString("its-phabricator", null, "url")).andReturn("<no-url>").anyTimes();
+ expect(serverConfig.getString("its-phabricator", null, "token")).andReturn("none").anyTimes();
}
@Override
@@ -95,10 +91,8 @@
@Override
protected void configure() {
serverConfig = createMock(Config.class);
- bind(Config.class).annotatedWith(GerritServerConfig.class)
- .toInstance(serverConfig);
- bind(String.class).annotatedWith(PluginName.class)
- .toInstance("its-phabricator");
+ bind(Config.class).annotatedWith(GerritServerConfig.class).toInstance(serverConfig);
+ bind(String.class).annotatedWith(PluginName.class).toInstance("its-phabricator");
}
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/ConduitTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/ConduitTest.java
index ec2c565..9dec435 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/ConduitTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/ConduitTest.java
@@ -1,16 +1,16 @@
-//Copyright (C) 2017 The Android Open Source Project
+// Copyright (C) 2017 The Android Open Source Project
//
-//Licensed under the Apache License, Version 2.0 (the "License");
-//you may not use this file except in compliance with the License.
-//You may obtain a copy of the License at
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
//
-//http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
-//Unless required by applicable law or agreed to in writing, software
-//distributed under the License is distributed on an "AS IS" BASIS,
-//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//See the License for the specific language governing permissions and
-//limitations under the License.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
package com.googlesource.gerrit.plugins.its.phabricator.conduit;
import static org.easymock.EasyMock.capture;
@@ -19,30 +19,26 @@
import static org.easymock.EasyMock.resetToStrict;
import static org.powermock.api.easymock.PowerMock.expectNew;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
+import com.googlesource.gerrit.plugins.its.base.testutil.LoggingMockingTestCase;
+import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ConduitPing;
+import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ManiphestEdit;
+import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ManiphestInfo;
+import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ProjectInfo;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
import org.easymock.Capture;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import com.google.gson.JsonObject;
-import com.google.gson.JsonPrimitive;
-
-import com.googlesource.gerrit.plugins.its.base.testutil.LoggingMockingTestCase;
-import com.googlesource.gerrit.plugins.its.phabricator.conduit.Conduit;
-import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ConduitPing;
-import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ManiphestInfo;
-import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ManiphestEdit;
-import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ProjectInfo;
-
@RunWith(PowerMockRunner.class)
@PrepareForTest(Conduit.class)
public class ConduitTest extends LoggingMockingTestCase {
- private final static String URL = "urlFoo";
- private final static String TOKEN = "tokenFoo";
+ private static final String URL = "urlFoo";
+ private static final String TOKEN = "tokenFoo";
private ConduitConnection connection;
@@ -54,8 +50,8 @@
Capture<Map<String, Object>> paramsCaptureRelevant = new Capture<>();
expect(connection.call(eq("conduit.ping"), capture(paramsCaptureRelevant), eq(TOKEN)))
- .andReturn(new JsonPrimitive("foo"))
- .once();
+ .andReturn(new JsonPrimitive("foo"))
+ .once();
replayMocks();
@@ -76,8 +72,8 @@
Capture<Map<String, Object>> paramsCaptureRelevant = new Capture<>();
expect(connection.call(eq("conduit.ping"), capture(paramsCaptureRelevant), eq(TOKEN)))
- .andThrow(conduitException)
- .once();
+ .andThrow(conduitException)
+ .once();
replayMocks();
@@ -102,8 +98,8 @@
retRelevant.add("id", new JsonPrimitive(42));
expect(connection.call(eq("maniphest.info"), capture(paramsCaptureRelevant), eq(TOKEN)))
- .andReturn(retRelevant)
- .once();
+ .andReturn(retRelevant)
+ .once();
replayMocks();
@@ -125,8 +121,8 @@
Capture<Map<String, Object>> paramsCaptureRelevant = new Capture<>();
expect(connection.call(eq("maniphest.info"), capture(paramsCaptureRelevant), eq(TOKEN)))
- .andThrow(conduitException)
- .once();
+ .andThrow(conduitException)
+ .once();
replayMocks();
@@ -150,8 +146,8 @@
Capture<Map<String, Object>> paramsCaptureRelevant = new Capture<>();
expect(connection.call(eq("maniphest.info"), capture(paramsCaptureRelevant), eq(TOKEN)))
- .andThrow(conduitException)
- .once();
+ .andThrow(conduitException)
+ .once();
replayMocks();
@@ -179,8 +175,8 @@
Capture<Map<String, Object>> paramsCaptureRelevant = new Capture<>();
expect(connection.call(eq("maniphest.update"), capture(paramsCaptureRelevant), eq(TOKEN)))
- .andReturn(retRelevant)
- .once();
+ .andReturn(retRelevant)
+ .once();
replayMocks();
@@ -205,19 +201,21 @@
Capture<Map<String, Object>> paramsCaptureRelevant = new Capture<>();
expect(connection.call(eq("maniphest.edit"), capture(paramsCaptureRelevant), eq(TOKEN)))
- .andReturn(retRelevant)
- .once();
+ .andReturn(retRelevant)
+ .once();
replayMocks();
Conduit conduit = new Conduit(URL, TOKEN);
- ManiphestEdit maniphestEdit = conduit.maniphestEdit(42,
- Arrays.asList("foo", "bar"), Conduit.ACTION_PROJECT_ADD);
+ ManiphestEdit maniphestEdit =
+ conduit.maniphestEdit(42, Arrays.asList("foo", "bar"), Conduit.ACTION_PROJECT_ADD);
Map<String, Object> paramsRelevant = paramsCaptureRelevant.getValue();
assertEquals("Task id is not set", 42, paramsRelevant.get("id"));
- assertEquals("Task projects are not set", Arrays.asList("foo", "bar"),
+ assertEquals(
+ "Task projects are not set",
+ Arrays.asList("foo", "bar"),
paramsRelevant.get("projectPHIDs"));
assertEquals("ManiphestEdit's id does not match", 42, maniphestEdit.getId());
@@ -234,26 +232,28 @@
Capture<Map<String, Object>> paramsCaptureRelevant = new Capture<>();
expect(connection.call(eq("maniphest.edit"), capture(paramsCaptureRelevant), eq(TOKEN)))
- .andReturn(retRelevant)
- .once();
+ .andReturn(retRelevant)
+ .once();
replayMocks();
Conduit conduit = new Conduit(URL, TOKEN);
- ManiphestEdit maniphestEdit = conduit.maniphestEdit(42, "baz",
- Arrays.asList("foo", "bar"), Conduit.ACTION_PROJECT_REMOVE);
+ ManiphestEdit maniphestEdit =
+ conduit.maniphestEdit(
+ 42, "baz", Arrays.asList("foo", "bar"), Conduit.ACTION_PROJECT_REMOVE);
Map<String, Object> paramsRelevant = paramsCaptureRelevant.getValue();
assertEquals("Task id is not set", 42, paramsRelevant.get("id"));
assertEquals("Task comment is not set", "baz", paramsRelevant.get("comments"));
- assertEquals("Task projects are not set", Arrays.asList("foo", "bar"),
+ assertEquals(
+ "Task projects are not set",
+ Arrays.asList("foo", "bar"),
paramsRelevant.get("projectPHIDs"));
assertEquals("ManiphestUpdate's id does not match", 42, maniphestEdit.getId());
}
-
public void testManiphestEditFailConnect() throws Exception {
mockConnection();
@@ -262,8 +262,8 @@
Capture<Map<String, Object>> paramsCapture = new Capture<>();
expect(connection.call(eq("conduit.connect"), capture(paramsCapture), eq(TOKEN)))
- .andThrow(conduitException)
- .once();
+ .andThrow(conduitException)
+ .once();
replayMocks();
@@ -287,8 +287,8 @@
Capture<Map<String, Object>> paramsCaptureRelevant = new Capture<>();
expect(connection.call(eq("maniphest.edit"), capture(paramsCaptureRelevant), eq(TOKEN)))
- .andThrow(conduitException)
- .once();
+ .andThrow(conduitException)
+ .once();
replayMocks();
@@ -316,8 +316,8 @@
Capture<Map<String, Object>> paramsCaptureRelevant = new Capture<>();
expect(connection.call(eq("maniphest.info"), capture(paramsCaptureRelevant), eq(TOKEN)))
- .andReturn(retRelevant)
- .once();
+ .andReturn(retRelevant)
+ .once();
replayMocks();
@@ -349,8 +349,8 @@
Capture<Map<String, Object>> paramsCaptureRelevant = new Capture<>();
expect(connection.call(eq("project.query"), capture(paramsCaptureRelevant), eq(TOKEN)))
- .andReturn(retRelevant)
- .once();
+ .andReturn(retRelevant)
+ .once();
replayMocks();
@@ -360,8 +360,7 @@
Map<String, Object> paramsRelevant = paramsCaptureRelevant.getValue();
List<String> expectedNames = Arrays.asList("foo");
- assertEquals("Project name does not match", expectedNames,
- paramsRelevant.get("names"));
+ assertEquals("Project name does not match", expectedNames, paramsRelevant.get("names"));
assertEquals("ProjectInfo's name does not match", "foo", projectInfo.getName());
}
@@ -394,8 +393,8 @@
Capture<Map<String, Object>> paramsCaptureRelevant = new Capture<>();
expect(connection.call(eq("project.query"), capture(paramsCaptureRelevant), eq(TOKEN)))
- .andReturn(retRelevant)
- .once();
+ .andReturn(retRelevant)
+ .once();
replayMocks();
@@ -405,16 +404,13 @@
Map<String, Object> paramsRelevant = paramsCaptureRelevant.getValue();
List<String> expectedNames = Arrays.asList("foo2");
- assertEquals("Project name does not match", expectedNames,
- paramsRelevant.get("names"));
+ assertEquals("Project name does not match", expectedNames, paramsRelevant.get("names"));
assertEquals("ProjectInfo's name does not match", "foo2", projectInfo.getName());
}
private void mockConnection() throws Exception {
connection = createMock(ConduitConnection.class);
- expectNew(ConduitConnection.class, URL)
- .andReturn(connection)
- .once();
+ expectNew(ConduitConnection.class, URL).andReturn(connection).once();
}
-}
\ No newline at end of file
+}