diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestHttp.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestHttp.java index b1524f37efe..43a24768918 100644 --- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestHttp.java +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestHttp.java @@ -24,11 +24,9 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; -import junit.framework.Assert; - -import org.apache.commons.httpclient.HttpException; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; +import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpHead; import org.apache.http.impl.client.DefaultHttpClient; @@ -37,13 +35,15 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; import org.testng.annotations.Parameters; +import junit.framework.Assert; + @ContextConfiguration(locations = "classpath:/storageContext.xml") public class TestHttp extends AbstractTestNGSpringContextTests { @Test @Parameters("template-url") public void testHttpclient(String templateUrl) { - HttpHead method = new HttpHead(templateUrl); - DefaultHttpClient client = new DefaultHttpClient(); + final HttpHead method = new HttpHead(templateUrl); + final DefaultHttpClient client = new DefaultHttpClient(); OutputStream output = null; long length = 0; @@ -51,34 +51,35 @@ public class TestHttp extends AbstractTestNGSpringContextTests { HttpResponse response = client.execute(method); length = Long.parseLong(response.getFirstHeader("Content-Length").getValue()); System.out.println(response.getFirstHeader("Content-Length").getValue()); - File localFile = new File("/tmp/test"); + final File localFile = new File("/tmp/test"); if (!localFile.exists()) { localFile.createNewFile(); } - HttpGet getMethod = new HttpGet(templateUrl); + final HttpGet getMethod = new HttpGet(templateUrl); response = client.execute(getMethod); - HttpEntity entity = response.getEntity(); + final HttpEntity entity = response.getEntity(); output = new BufferedOutputStream(new FileOutputStream(localFile)); entity.writeTo(output); - } catch (HttpException e) { + } catch (final ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); - } catch (IOException e) { + } catch (final IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { try { - if (output != null) + if (output != null) { output.close(); - } catch (IOException e) { + } + } catch (final IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - File f = new File("/tmp/test"); + final File f = new File("/tmp/test"); Assert.assertEquals(f.length(), length); } } diff --git a/framework/cluster/src/com/cloud/cluster/ClusterServiceServletHttpHandler.java b/framework/cluster/src/com/cloud/cluster/ClusterServiceServletHttpHandler.java index 3a85302c4a9..e12e0fe5ae0 100644 --- a/framework/cluster/src/com/cloud/cluster/ClusterServiceServletHttpHandler.java +++ b/framework/cluster/src/com/cloud/cluster/ClusterServiceServletHttpHandler.java @@ -20,11 +20,11 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.net.URLDecoder; -import org.apache.commons.httpclient.HttpStatus; import org.apache.http.HttpEntityEnclosingRequest; import org.apache.http.HttpException; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; import org.apache.http.entity.BasicHttpEntity; import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.HttpRequestHandler; @@ -55,14 +55,14 @@ public class ClusterServiceServletHttpHandler implements HttpRequestHandler { s_logger.trace("Handle cluster HTTP request done"); } - } catch (Throwable e) { + } catch (final Throwable e) { if (s_logger.isDebugEnabled()) { s_logger.debug("Exception " + e.toString()); } try { writeResponse(response, HttpStatus.SC_INTERNAL_SERVER_ERROR, null); - } catch (Throwable e2) { + } catch (final Throwable e2) { if (s_logger.isDebugEnabled()) { s_logger.debug("Exception " + e2.toString()); } @@ -73,20 +73,20 @@ public class ClusterServiceServletHttpHandler implements HttpRequestHandler { @SuppressWarnings("deprecation") private void parseRequest(HttpRequest request) throws IOException { if (request instanceof HttpEntityEnclosingRequest) { - HttpEntityEnclosingRequest entityRequest = (HttpEntityEnclosingRequest)request; + final HttpEntityEnclosingRequest entityRequest = (HttpEntityEnclosingRequest)request; - String body = EntityUtils.toString(entityRequest.getEntity()); + final String body = EntityUtils.toString(entityRequest.getEntity()); if (body != null) { - String[] paramArray = body.split("&"); + final String[] paramArray = body.split("&"); if (paramArray != null) { - for (String paramEntry : paramArray) { - String[] paramValue = paramEntry.split("="); + for (final String paramEntry : paramArray) { + final String[] paramValue = paramEntry.split("="); if (paramValue.length != 2) { continue; } - String name = URLDecoder.decode(paramValue[0]); - String value = URLDecoder.decode(paramValue[1]); + final String name = URLDecoder.decode(paramValue[0]); + final String value = URLDecoder.decode(paramValue[1]); if (s_logger.isTraceEnabled()) { s_logger.trace("Parsed request parameter " + name + "=" + value); @@ -103,17 +103,17 @@ public class ClusterServiceServletHttpHandler implements HttpRequestHandler { content = ""; } response.setStatusCode(statusCode); - BasicHttpEntity body = new BasicHttpEntity(); + final BasicHttpEntity body = new BasicHttpEntity(); body.setContentType("text/html; charset=UTF-8"); - byte[] bodyData = content.getBytes(); + final byte[] bodyData = content.getBytes(); body.setContent(new ByteArrayInputStream(bodyData)); body.setContentLength(bodyData.length); response.setEntity(body); } protected void handleRequest(HttpRequest req, HttpResponse response) { - String method = (String)req.getParams().getParameter("method"); + final String method = (String)req.getParams().getParameter("method"); int nMethod = RemoteMethodConstants.METHOD_UNKNOWN; String responseContent = null; @@ -133,22 +133,24 @@ public class ClusterServiceServletHttpHandler implements HttpRequestHandler { case RemoteMethodConstants.METHOD_UNKNOWN: default: - assert (false); + assert false; s_logger.error("unrecognized method " + nMethod); break; } - } catch (Throwable e) { + } catch (final Throwable e) { s_logger.error("Unexpected exception when processing cluster service request : ", e); } if (responseContent != null) { - if (s_logger.isTraceEnabled()) + if (s_logger.isTraceEnabled()) { s_logger.trace("Write reponse with HTTP OK " + responseContent); + } writeResponse(response, HttpStatus.SC_OK, responseContent); } else { - if (s_logger.isTraceEnabled()) + if (s_logger.isTraceEnabled()) { s_logger.trace("Write reponse with HTTP Bad request"); + } writeResponse(response, HttpStatus.SC_BAD_REQUEST, null); } @@ -156,16 +158,16 @@ public class ClusterServiceServletHttpHandler implements HttpRequestHandler { private String handleDeliverPduMethodCall(HttpRequest req) { - String pduSeq = (String)req.getParams().getParameter("pduSeq"); - String pduAckSeq = (String)req.getParams().getParameter("pduAckSeq"); - String sourcePeer = (String)req.getParams().getParameter("sourcePeer"); - String destPeer = (String)req.getParams().getParameter("destPeer"); - String agentId = (String)req.getParams().getParameter("agentId"); - String gsonPackage = (String)req.getParams().getParameter("gsonPackage"); - String stopOnError = (String)req.getParams().getParameter("stopOnError"); - String pduType = (String)req.getParams().getParameter("pduType"); + final String pduSeq = (String)req.getParams().getParameter("pduSeq"); + final String pduAckSeq = (String)req.getParams().getParameter("pduAckSeq"); + final String sourcePeer = (String)req.getParams().getParameter("sourcePeer"); + final String destPeer = (String)req.getParams().getParameter("destPeer"); + final String agentId = (String)req.getParams().getParameter("agentId"); + final String gsonPackage = (String)req.getParams().getParameter("gsonPackage"); + final String stopOnError = (String)req.getParams().getParameter("stopOnError"); + final String pduType = (String)req.getParams().getParameter("pduType"); - ClusterServicePdu pdu = new ClusterServicePdu(); + final ClusterServicePdu pdu = new ClusterServicePdu(); pdu.setSourcePeer(sourcePeer); pdu.setDestPeer(destPeer); pdu.setAgentId(Long.parseLong(agentId)); @@ -180,7 +182,7 @@ public class ClusterServiceServletHttpHandler implements HttpRequestHandler { } private String handlePingMethodCall(HttpRequest req) { - String callingPeer = (String)req.getParams().getParameter("callingPeer"); + final String callingPeer = (String)req.getParams().getParameter("callingPeer"); if (s_logger.isDebugEnabled()) { s_logger.debug("Handle ping request from " + callingPeer); diff --git a/plugins/network-elements/brocade-vcs/src/com/cloud/network/brocade/BrocadeVcsApi.java b/plugins/network-elements/brocade-vcs/src/com/cloud/network/brocade/BrocadeVcsApi.java index dc111fd898a..eb03515b5d5 100644 --- a/plugins/network-elements/brocade-vcs/src/com/cloud/network/brocade/BrocadeVcsApi.java +++ b/plugins/network-elements/brocade-vcs/src/com/cloud/network/brocade/BrocadeVcsApi.java @@ -30,9 +30,8 @@ import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpStatus; import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.methods.HttpDelete; @@ -64,9 +63,9 @@ import com.cloud.network.schema.showvcs.Output; public class BrocadeVcsApi { private static final Logger s_logger = Logger.getLogger(BrocadeVcsApi.class); - private String _host; - private String _adminuser; - private String _adminpass; + private final String _host; + private final String _adminuser; + private final String _adminpass; protected DefaultHttpClient _client; @@ -74,7 +73,7 @@ public class BrocadeVcsApi { String url; try { url = new URL(Constants.PROTOCOL, _host, Constants.PORT, uri).toString(); - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { s_logger.error("Unable to build Brocade Switch API URL", e); throw new BrocadeVcsApiException("Unable to build Brocade Switch API URL", e); } @@ -116,7 +115,7 @@ public class BrocadeVcsApi { if (createInterfaceVlan(vlanId)) { - PortProfile portProfile = createPortProfile(vlanId, networkId); + final PortProfile portProfile = createPortProfile(vlanId, networkId); if (portProfile != null) { return activatePortProfile(portProfile); @@ -129,9 +128,9 @@ public class BrocadeVcsApi { * Activates a port-profile. */ private boolean activatePortProfile(PortProfile portProfile) throws BrocadeVcsApiException { - PortProfileGlobal portProfileGlobal = new PortProfileGlobal(); + final PortProfileGlobal portProfileGlobal = new PortProfileGlobal(); portProfile.setVlanProfile(null); - Activate activate = new Activate(); + final Activate activate = new Activate(); portProfile.setActivate(activate); portProfileGlobal.setPortProfile(portProfile); @@ -144,7 +143,7 @@ public class BrocadeVcsApi { */ private PortProfile createPortProfile(int vlanId, long networkId) throws BrocadeVcsApiException { - PortProfile portProfile = new PortProfile(); + final PortProfile portProfile = new PortProfile(); portProfile.setName(Constants.PORT_PROFILE_NAME_PREFIX + networkId); if (executeCreateObject(portProfile, Constants.URI)) { if (createVlanSubProfile(vlanId, portProfile)) { @@ -158,7 +157,7 @@ public class BrocadeVcsApi { * Create vlan sub-profile for port-profile */ private boolean createVlanSubProfile(int vlanId, PortProfile portProfile) throws BrocadeVcsApiException { - VlanProfile vlanProfile = new VlanProfile(); + final VlanProfile vlanProfile = new VlanProfile(); portProfile.setVlanProfile(vlanProfile); if (executeUpdateObject(portProfile, Constants.URI)) { return configureVlanSubProfile(vlanId, portProfile); @@ -173,15 +172,15 @@ public class BrocadeVcsApi { * - configure allowed VLANs for vlan sub-profile */ private boolean configureVlanSubProfile(int vlanId, PortProfile portProfile) throws BrocadeVcsApiException { - SwitchportBasic switchPortBasic = new SwitchportBasic(); - Basic basic = new Basic(); + final SwitchportBasic switchPortBasic = new SwitchportBasic(); + final Basic basic = new Basic(); switchPortBasic.setBasic(basic); portProfile.getVlanProfile().setSwitchportBasic(switchPortBasic); // configure L2 mode for vlan sub-profile if (executeUpdateObject(portProfile, Constants.URI)) { VlanProfile vlanProfile = new VlanProfile(); Switchport switchPort = new Switchport(); - Mode mode = new Mode(); + final Mode mode = new Mode(); mode.setVlanMode("trunk"); switchPort.setMode(mode); vlanProfile.setSwitchport(switchPort); @@ -191,9 +190,9 @@ public class BrocadeVcsApi { if (executeUpdateObject(portProfile, Constants.URI)) { vlanProfile = new VlanProfile(); switchPort = new Switchport(); - Trunk trunk = new Trunk(); - Allowed allowed = new Allowed(); - Allowed.Vlan allowedVlan = new Allowed.Vlan(); + final Trunk trunk = new Trunk(); + final Allowed allowed = new Allowed(); + final Allowed.Vlan allowedVlan = new Allowed.Vlan(); allowedVlan.setAdd(vlanId); allowed.setVlan(allowedVlan); trunk.setAllowed(allowed); @@ -214,9 +213,9 @@ public class BrocadeVcsApi { * Creates a vlan interface. */ private boolean createInterfaceVlan(int vlanId) throws BrocadeVcsApiException { - InterfaceVlan interfaceVlan = new InterfaceVlan(); - Interface interfaceObj = new Interface(); - Vlan vlan = new Vlan(); + final InterfaceVlan interfaceVlan = new InterfaceVlan(); + final Interface interfaceObj = new Interface(); + final Vlan vlan = new Vlan(); vlan.setName(vlanId); interfaceObj.setVlan(vlan); interfaceVlan.setInterface(interfaceObj); @@ -230,10 +229,10 @@ public class BrocadeVcsApi { */ public boolean associateMacToNetwork(long networkId, String macAddress) throws BrocadeVcsApiException { - PortProfileGlobal portProfileGlobal = new PortProfileGlobal(); - PortProfile portProfile = new PortProfile(); + final PortProfileGlobal portProfileGlobal = new PortProfileGlobal(); + final PortProfile portProfile = new PortProfile(); portProfile.setName(Constants.PORT_PROFILE_NAME_PREFIX + networkId); - Static staticObj = new Static(); + final Static staticObj = new Static(); staticObj.setMacAddress(macAddress); portProfile.setStatic(staticObj); portProfileGlobal.setPortProfile(portProfile); @@ -247,10 +246,10 @@ public class BrocadeVcsApi { */ public boolean disassociateMacFromNetwork(long networkId, String macAddress) throws BrocadeVcsApiException { - PortProfileGlobal portProfileGlobal = new PortProfileGlobal(); - PortProfile portProfile = new PortProfile(); + final PortProfileGlobal portProfileGlobal = new PortProfileGlobal(); + final PortProfile portProfile = new PortProfile(); portProfile.setName(Constants.PORT_PROFILE_NAME_PREFIX + networkId); - Static staticObj = new Static(); + final Static staticObj = new Static(); staticObj.setOperation("delete"); staticObj.setMacAddress(macAddress); portProfile.setStatic(staticObj); @@ -278,9 +277,9 @@ public class BrocadeVcsApi { * Deletes a vlan interface. */ private boolean deleteInterfaceVlan(int vlanId) throws BrocadeVcsApiException { - InterfaceVlan interfaceVlan = new InterfaceVlan(); - Interface interfaceObj = new Interface(); - Vlan vlan = new Vlan(); + final InterfaceVlan interfaceVlan = new InterfaceVlan(); + final Interface interfaceObj = new Interface(); + final Vlan vlan = new Vlan(); vlan.setOperation("delete"); vlan.setName(vlanId); interfaceObj.setVlan(vlan); @@ -294,10 +293,10 @@ public class BrocadeVcsApi { * Deactivates a port-profile. */ private boolean deactivatePortProfile(long networkId) throws BrocadeVcsApiException { - PortProfileGlobal portProfileGlobal = new PortProfileGlobal(); - PortProfile portProfile = new PortProfile(); + final PortProfileGlobal portProfileGlobal = new PortProfileGlobal(); + final PortProfile portProfile = new PortProfile(); portProfile.setName(Constants.PORT_PROFILE_NAME_PREFIX + networkId); - Activate activate = new Activate(); + final Activate activate = new Activate(); activate.setOperation("delete"); portProfile.setActivate(activate); portProfileGlobal.setPortProfile(portProfile); @@ -311,7 +310,7 @@ public class BrocadeVcsApi { */ private boolean deletePortProfile(long networkId) throws BrocadeVcsApiException { - PortProfile portProfile = new PortProfile(); + final PortProfile portProfile = new PortProfile(); portProfile.setName(Constants.PORT_PROFILE_NAME_PREFIX + networkId); portProfile.setOperation("delete"); //deletes port-profile @@ -320,25 +319,25 @@ public class BrocadeVcsApi { protected boolean executeUpdateObject(T newObject, String uri) throws BrocadeVcsApiException { - boolean result = true; + final boolean result = true; if (_host == null || _host.isEmpty() || _adminuser == null || _adminuser.isEmpty() || _adminpass == null || _adminpass.isEmpty()) { throw new BrocadeVcsApiException("Hostname/credentials are null or empty"); } - HttpPatch pm = (HttpPatch)createMethod("patch", uri); + final HttpPatch pm = (HttpPatch)createMethod("patch", uri); pm.setHeader("Accept", "application/vnd.configuration.resource+xml"); pm.setEntity(new StringEntity(convertToString(newObject), ContentType.APPLICATION_XML)); - HttpResponse response = executeMethod(pm); + final HttpResponse response = executeMethod(pm); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_NO_CONTENT) { String errorMessage; try { errorMessage = responseToErrorMessage(response); - } catch (IOException e) { + } catch (final IOException e) { s_logger.error("Failed to update object : " + e.getMessage()); throw new BrocadeVcsApiException("Failed to update object : " + e.getMessage()); } @@ -363,12 +362,12 @@ public class BrocadeVcsApi { marshaller.marshal(object, stringWriter); - } catch (JAXBException e) { + } catch (final JAXBException e) { s_logger.error("Failed to convert object to string : " + e.getMessage()); throw new BrocadeVcsApiException("Failed to convert object to string : " + e.getMessage()); } - String str = stringWriter.toString(); + final String str = stringWriter.toString(); s_logger.info(str); return str; @@ -379,19 +378,19 @@ public class BrocadeVcsApi { Output output = null; try { - JAXBContext context = JAXBContext.newInstance(Output.class); + final JAXBContext context = JAXBContext.newInstance(Output.class); - StringReader reader = new StringReader(object); + final StringReader reader = new StringReader(object); final Unmarshaller unmarshaller = context.createUnmarshaller(); - Object result = unmarshaller.unmarshal(reader); + final Object result = unmarshaller.unmarshal(reader); if (result instanceof Output) { output = (Output)result; s_logger.info(output); } - } catch (JAXBException e) { + } catch (final JAXBException e) { s_logger.error("Failed to convert string to object : " + e.getMessage()); throw new BrocadeVcsApiException("Failed to convert string to object : " + e.getMessage()); } @@ -405,19 +404,19 @@ public class BrocadeVcsApi { throw new BrocadeVcsApiException("Hostname/credentials are null or empty"); } - boolean result = true; - HttpPost pm = (HttpPost)createMethod("post", uri); + final boolean result = true; + final HttpPost pm = (HttpPost)createMethod("post", uri); pm.setHeader("Accept", "application/vnd.configuration.resource+xml"); pm.setEntity(new StringEntity(convertToString(newObject), ContentType.APPLICATION_XML)); - HttpResponse response = executeMethod(pm); + final HttpResponse response = executeMethod(pm); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_CREATED) { String errorMessage; try { errorMessage = responseToErrorMessage(response); - } catch (IOException e) { + } catch (final IOException e) { s_logger.error("Failed to create object : " + e.getMessage()); throw new BrocadeVcsApiException("Failed to create object : " + e.getMessage()); } @@ -440,18 +439,18 @@ public class BrocadeVcsApi { String readLine = null; StringBuffer sb = null; - HttpPost pm = (HttpPost)createMethod("post", uri); + final HttpPost pm = (HttpPost)createMethod("post", uri); pm.setHeader("Accept", "application/vnd.operational-state.resource+xml"); pm.setEntity(new StringEntity("", ContentType.APPLICATION_XML)); - HttpResponse response = executeMethod(pm); + final HttpResponse response = executeMethod(pm); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { String errorMessage; try { errorMessage = responseToErrorMessage(response); - } catch (IOException e) { + } catch (final IOException e) { s_logger.error("Failed to retreive status : " + e.getMessage()); throw new BrocadeVcsApiException("Failed to retreive status : " + e.getMessage()); } @@ -464,12 +463,12 @@ public class BrocadeVcsApi { try (BufferedReader br = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), Charset.forName("UTF-8")))) { sb = new StringBuffer(); - while (((readLine = br.readLine()) != null)) { + while ((readLine = br.readLine()) != null) { s_logger.debug(readLine); sb.append(readLine); } - } catch (Exception e) { + } catch (final Exception e) { s_logger.error("Failed to retreive status : " + e.getMessage()); throw new BrocadeVcsApiException("Failed to retreive status : " + e.getMessage()); } @@ -484,17 +483,17 @@ public class BrocadeVcsApi { throw new BrocadeVcsApiException("Hostname/credentials are null or empty"); } - HttpDelete dm = (HttpDelete)createMethod("delete", uri); + final HttpDelete dm = (HttpDelete)createMethod("delete", uri); dm.setHeader("Accept", "application/vnd.configuration.resource+xml"); - HttpResponse response = executeMethod(dm); + final HttpResponse response = executeMethod(dm); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_NO_CONTENT) { String errorMessage; try { errorMessage = responseToErrorMessage(response); - } catch (IOException e) { + } catch (final IOException e) { s_logger.error("Failed to delete object : " + e.getMessage()); throw new BrocadeVcsApiException("Failed to delete object : " + e.getMessage()); } @@ -514,11 +513,7 @@ public class BrocadeVcsApi { method.releaseConnection(); response = _client.execute(method); } - } catch (HttpException e) { - s_logger.error("HttpException caught while trying to connect to the Brocade Switch", e); - method.releaseConnection(); - throw new BrocadeVcsApiException("API call to Brocade Switch Failed", e); - } catch (IOException e) { + } catch (final IOException e) { s_logger.error("IOException caught while trying to connect to the Brocade Switch", e); method.releaseConnection(); throw new BrocadeVcsApiException("API call to Brocade Switch Failed", e); @@ -533,7 +528,7 @@ public class BrocadeVcsApi { try (BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), Charset.forName("UTF-8")))) { - StringBuffer result = new StringBuffer(); + final StringBuffer result = new StringBuffer(); String line = ""; while ((line = rd.readLine()) != null) { result.append(line); diff --git a/plugins/network-elements/brocade-vcs/test/com/cloud/network/brocade/BrocadeVcsApiTest.java b/plugins/network-elements/brocade-vcs/test/com/cloud/network/brocade/BrocadeVcsApiTest.java index 4223d4cc7b8..e84b7caf265 100644 --- a/plugins/network-elements/brocade-vcs/test/com/cloud/network/brocade/BrocadeVcsApiTest.java +++ b/plugins/network-elements/brocade-vcs/test/com/cloud/network/brocade/BrocadeVcsApiTest.java @@ -26,9 +26,9 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.io.IOException; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.http.StatusLine; import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.StatusLine; import org.apache.http.client.methods.HttpPatch; import org.apache.http.client.methods.HttpPost; @@ -93,7 +93,7 @@ public class BrocadeVcsApiTest { when(response.getEntity()).thenReturn(new StringEntity(OUTPUT_XML_RESPONSE)); // Execute - Output result = api.getSwitchStatus(); + final Output result = api.getSwitchStatus(); // Assert verify(method, times(1)).releaseConnection(); diff --git a/plugins/network-elements/nicira-nvp/src/test/java/com/cloud/network/nicira/NiciraNvpApiTest.java b/plugins/network-elements/nicira-nvp/src/test/java/com/cloud/network/nicira/NiciraNvpApiTest.java index 79546a68472..34518cedad5 100644 --- a/plugins/network-elements/nicira-nvp/src/test/java/com/cloud/network/nicira/NiciraNvpApiTest.java +++ b/plugins/network-elements/nicira-nvp/src/test/java/com/cloud/network/nicira/NiciraNvpApiTest.java @@ -33,9 +33,9 @@ import static org.mockito.Mockito.when; import java.util.List; -import org.apache.commons.httpclient.HttpStatus; import org.apache.http.HttpHost; import org.apache.http.HttpRequest; +import org.apache.http.HttpStatus; import org.apache.http.ProtocolVersion; import org.apache.http.StatusLine; import org.apache.http.client.methods.CloseableHttpResponse;