Return-Path: X-Original-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8EAD2E70E for ; Fri, 1 Feb 2013 19:38:22 +0000 (UTC) Received: (qmail 20105 invoked by uid 500); 1 Feb 2013 19:38:13 -0000 Delivered-To: apmail-incubator-cloudstack-commits-archive@incubator.apache.org Received: (qmail 19999 invoked by uid 500); 1 Feb 2013 19:38:13 -0000 Mailing-List: contact cloudstack-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cloudstack-dev@incubator.apache.org Delivered-To: mailing list cloudstack-commits@incubator.apache.org Received: (qmail 18706 invoked by uid 99); 1 Feb 2013 19:38:11 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Feb 2013 19:38:11 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 9C8BE828F65; Fri, 1 Feb 2013 19:38:11 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kelveny@apache.org To: cloudstack-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [23/50] [abbrv] git commit: refs/heads/javelin - removed MockAPI server Message-Id: <20130201193811.9C8BE828F65@tyr.zones.apache.org> Date: Fri, 1 Feb 2013 19:38:11 +0000 (UTC) removed MockAPI server Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/ea660cd0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/ea660cd0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/ea660cd0 Branch: refs/heads/javelin Commit: ea660cd06de9350f5fffaaeb53e49e8bc91c4c1e Parents: def9fd1 Author: Kishan Kavala Authored: Mon Jan 28 17:50:38 2013 +0530 Committer: Kishan Kavala Committed: Mon Jan 28 17:50:38 2013 +0530 ---------------------------------------------------------------------- client/tomcatconf/components-regions.xml.in | 52 -- server/src/com/cloud/api/MockApiServer.java | 639 -------------- server/test/com/cloud/api/RegionTest.java | 42 - .../configuration/RegionsComponentLibrary.java | 230 ----- .../security/MockSecurityGroupManagerImpl.java | 198 ----- .../vpn/MockRemoteAccessVpnManagerImpl.java | 129 --- .../com/cloud/server/MockManagementServerImpl.java | 483 ---------- .../com/cloud/storage/MockStorageManagerImpl.java | 679 --------------- .../storage/snapshot/MockSnapshotManagerImpl.java | 236 ----- .../cloud/template/MockTemplateManagerImpl.java | 211 ----- .../test/com/cloud/vm/MockUserVmManagerImpl.java | 4 +- 11 files changed, 1 insertions(+), 2902 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ea660cd0/client/tomcatconf/components-regions.xml.in ---------------------------------------------------------------------- diff --git a/client/tomcatconf/components-regions.xml.in b/client/tomcatconf/components-regions.xml.in deleted file mode 100755 index 60a2d00..0000000 --- a/client/tomcatconf/components-regions.xml.in +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - true - - - - - - http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ea660cd0/server/src/com/cloud/api/MockApiServer.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/MockApiServer.java b/server/src/com/cloud/api/MockApiServer.java deleted file mode 100755 index 52d6b57..0000000 --- a/server/src/com/cloud/api/MockApiServer.java +++ /dev/null @@ -1,639 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you 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 -// -// 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.cloud.api; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InterruptedIOException; -import java.io.UnsupportedEncodingException; -import java.net.InetAddress; -import java.net.ServerSocket; -import java.net.Socket; -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -import org.apache.cloudstack.api.ApiErrorCode; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.BaseListCmd; -import org.apache.cloudstack.api.ResponseObject; -import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.ExceptionResponse; -import org.apache.http.ConnectionClosedException; -import org.apache.http.HttpException; -import org.apache.http.HttpRequest; -import org.apache.http.HttpResponse; -import org.apache.http.HttpServerConnection; -import org.apache.http.HttpStatus; -import org.apache.http.entity.BasicHttpEntity; -import org.apache.http.impl.DefaultHttpResponseFactory; -import org.apache.http.impl.DefaultHttpServerConnection; -import org.apache.http.impl.NoConnectionReuseStrategy; -import org.apache.http.impl.SocketHttpServerConnection; -import org.apache.http.params.BasicHttpParams; -import org.apache.http.params.CoreConnectionPNames; -import org.apache.http.params.CoreProtocolPNames; -import org.apache.http.params.HttpParams; -import org.apache.http.protocol.BasicHttpContext; -import org.apache.http.protocol.BasicHttpProcessor; -import org.apache.http.protocol.HttpContext; -import org.apache.http.protocol.HttpRequestHandler; -import org.apache.http.protocol.HttpRequestHandlerRegistry; -import org.apache.http.protocol.HttpService; -import org.apache.http.protocol.ResponseConnControl; -import org.apache.http.protocol.ResponseContent; -import org.apache.http.protocol.ResponseDate; -import org.apache.http.protocol.ResponseServer; -import org.apache.log4j.Logger; - -import com.cloud.api.response.ApiResponseSerializer; -import com.cloud.cluster.StackMaid; -import com.cloud.configuration.Config; -import com.cloud.configuration.ConfigurationVO; -import com.cloud.configuration.dao.ConfigurationDao; -import com.cloud.exception.InvalidParameterValueException; -import com.cloud.exception.PermissionDeniedException; -import com.cloud.server.ManagementService; -import com.cloud.user.Account; -import com.cloud.user.AccountManager; -import com.cloud.user.User; -import com.cloud.user.UserContext; -import com.cloud.utils.PropertiesUtil; -import com.cloud.utils.component.ComponentLocator; -import com.cloud.utils.concurrency.NamedThreadFactory; -import com.cloud.utils.db.SearchCriteria; -import com.cloud.utils.exception.CSExceptionErrorCode; - -public abstract class MockApiServer implements HttpRequestHandler { -// private static final Logger s_logger = Logger.getLogger(MockApiServer.class.getName()); -// -// public static final short ADMIN_COMMAND = 1; -// public static final short DOMAIN_ADMIN_COMMAND = 4; -// public static final short RESOURCE_DOMAIN_ADMIN_COMMAND = 2; -// public static final short USER_COMMAND = 8; -// public static boolean encodeApiResponse = false; -// public static String jsonContentType = "text/javascript"; -// private Properties _apiCommands = null; -// private ApiDispatcher _dispatcher; -// private AccountManager _accountMgr = null; -// private Account _systemAccount = null; -// private User _systemUser = null; -// -// private static int _workerCount = 0; -// -// private static MockApiServer s_instance = null; -// private static List s_userCommands = null; -// private static List s_resellerCommands = null; // AKA domain-admin -// private static List s_adminCommands = null; -// private static List s_resourceDomainAdminCommands = null; -// private static List s_allCommands = null; -// private static List s_pluggableServiceCommands = null; -// -// private static ExecutorService _executor = new ThreadPoolExecutor(10, 150, 60, TimeUnit.SECONDS, new LinkedBlockingQueue(), new NamedThreadFactory("ApiServer")); -// -// static { -// s_userCommands = new ArrayList(); -// s_resellerCommands = new ArrayList(); -// s_adminCommands = new ArrayList(); -// s_resourceDomainAdminCommands = new ArrayList(); -// s_allCommands = new ArrayList(); -// s_pluggableServiceCommands = new ArrayList(); -// } -// -// private MockApiServer() { -// } -// -// public static void initApiServer(String[] apiConfig) { -// if (s_instance == null) { -// s_instance = new MockApiServer(); -// s_instance.init(apiConfig); -// } -// } -// -// public static MockApiServer getInstance() { -// // initApiServer(); -// return s_instance; -// } -// -// public Properties get_apiCommands() { -// return _apiCommands; -// } -// -// private void processConfigFiles(String[] apiConfig, boolean pluggableServicesConfig) { -// try { -// if (_apiCommands == null) { -// _apiCommands = new Properties(); -// } -// Properties preProcessedCommands = new Properties(); -// if (apiConfig != null) { -// for (String configFile : apiConfig) { -// File commandsFile = PropertiesUtil.findConfigFile(configFile); -// if (commandsFile != null) { -// try { -// preProcessedCommands.load(new FileInputStream(commandsFile)); -// } catch (FileNotFoundException fnfex) { -// // in case of a file within a jar in classpath, try to open stream using url -// InputStream stream = PropertiesUtil.openStreamFromURL(configFile); -// if (stream != null) { -// preProcessedCommands.load(stream); -// } else { -// s_logger.error("Unable to find properites file", fnfex); -// } -// } -// } -// } -// for (Object key : preProcessedCommands.keySet()) { -// String preProcessedCommand = preProcessedCommands.getProperty((String) key); -// String[] commandParts = preProcessedCommand.split(";"); -// _apiCommands.put(key, commandParts[0]); -// -// if (pluggableServicesConfig) { -// s_pluggableServiceCommands.add(commandParts[0]); -// } -// -// if (commandParts.length > 1) { -// try { -// short cmdPermissions = Short.parseShort(commandParts[1]); -// if ((cmdPermissions & ADMIN_COMMAND) != 0) { -// s_adminCommands.add((String) key); -// } -// if ((cmdPermissions & RESOURCE_DOMAIN_ADMIN_COMMAND) != 0) { -// s_resourceDomainAdminCommands.add((String) key); -// } -// if ((cmdPermissions & DOMAIN_ADMIN_COMMAND) != 0) { -// s_resellerCommands.add((String) key); -// } -// if ((cmdPermissions & USER_COMMAND) != 0) { -// s_userCommands.add((String) key); -// } -// } catch (NumberFormatException nfe) { -// s_logger.info("Malformed command.properties permissions value, key = " + key + ", value = " + preProcessedCommand); -// } -// } -// } -// -// s_allCommands.addAll(s_adminCommands); -// s_allCommands.addAll(s_resourceDomainAdminCommands); -// s_allCommands.addAll(s_userCommands); -// s_allCommands.addAll(s_resellerCommands); -// } -// } catch (FileNotFoundException fnfex) { -// s_logger.error("Unable to find properites file", fnfex); -// } catch (IOException ioex) { -// s_logger.error("Exception loading properties file", ioex); -// } -// } -// -// public void init(String[] apiConfig) { -// BaseCmd.setComponents(new ApiResponseHelper()); -// BaseListCmd.configure(); -// processConfigFiles(apiConfig, false); -// -// ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); -// _accountMgr = locator.getManager(AccountManager.class); -// _systemAccount = _accountMgr.getSystemAccount(); -// _systemUser = _accountMgr.getSystemUser(); -// _dispatcher = ApiDispatcher.getInstance(); -// -// Integer apiPort = null; // api port, null by default -// ConfigurationDao configDao = locator.getDao(ConfigurationDao.class); -// SearchCriteria sc = configDao.createSearchCriteria(); -// sc.addAnd("name", SearchCriteria.Op.EQ, "integration.api.port"); -// List values = configDao.search(sc, null); -// if ((values != null) && (values.size() > 0)) { -// ConfigurationVO apiPortConfig = values.get(0); -// if (apiPortConfig.getValue() != null) { -// apiPort = Integer.parseInt(apiPortConfig.getValue()); -// } -// } -// -// encodeApiResponse = Boolean.valueOf(configDao.getValue(Config.EncodeApiResponse.key())); -// -// String jsonType = configDao.getValue(Config.JavaScriptDefaultContentType.key()); -// if (jsonType != null) { -// jsonContentType = jsonType; -// } -// -// if (apiPort != null) { -// ListenerThread listenerThread = new ListenerThread(this, apiPort); -// listenerThread.start(); -// } -// } -// -// @SuppressWarnings({ "unchecked", "rawtypes" }) -// @Override -// public void handle(HttpRequest request, HttpResponse response, HttpContext context) throws HttpException, IOException { -// // get some information for the access log... -// StringBuffer sb = new StringBuffer(); -// HttpServerConnection connObj = (HttpServerConnection) context.getAttribute("http.connection"); -// if (connObj instanceof SocketHttpServerConnection) { -// InetAddress remoteAddr = ((SocketHttpServerConnection) connObj).getRemoteAddress(); -// sb.append(remoteAddr.toString() + " -- "); -// } -// sb.append(request.getRequestLine()); -// -// try { -// String uri = request.getRequestLine().getUri(); -// int requestParamsStartIndex = uri.indexOf('?'); -// if (requestParamsStartIndex >= 0) { -// uri = uri.substring(requestParamsStartIndex + 1); -// } -// -// String[] paramArray = uri.split("&"); -// if (paramArray.length < 1) { -// s_logger.info("no parameters received for request: " + uri + ", aborting..."); -// return; -// } -// -// Map parameterMap = new HashMap(); -// -// String responseType = BaseCmd.RESPONSE_TYPE_XML; -// for (String paramEntry : paramArray) { -// String[] paramValue = paramEntry.split("="); -// if (paramValue.length != 2) { -// s_logger.info("malformed parameter: " + paramEntry + ", skipping"); -// continue; -// } -// if ("response".equalsIgnoreCase(paramValue[0])) { -// responseType = paramValue[1]; -// } else { -// // according to the servlet spec, the parameter map should be in the form (name=String, -// // value=String[]), so -// // parameter values will be stored in an array -// parameterMap.put(/* name */paramValue[0], /* value */new String[] { paramValue[1] }); -// } -// } -// try { -// // always trust commands from API port, user context will always be UID_SYSTEM/ACCOUNT_ID_SYSTEM -// UserContext.registerContext(_systemUser.getId(), _systemAccount, null, true); -// sb.insert(0, "(userId=" + User.UID_SYSTEM + " accountId=" + Account.ACCOUNT_ID_SYSTEM + " sessionId=" + null + ") "); -// String responseText = handleRequest(parameterMap, true, responseType, sb); -// sb.append(" 200 " + ((responseText == null) ? 0 : responseText.length())); -// -// writeResponse(response, responseText, HttpStatus.SC_OK, responseType, null); -// } catch (ServerApiException se) { -// String responseText = getSerializedApiError(se.getErrorCode(), se.getDescription(), parameterMap, responseType, se); -// writeResponse(response, responseText, se.getErrorCode(), responseType, se.getDescription()); -// sb.append(" " + se.getErrorCode() + " " + se.getDescription()); -// } catch (RuntimeException e) { -// // log runtime exception like NullPointerException to help identify the source easier -// s_logger.error("Unhandled exception, ", e); -// throw e; -// } catch (Exception e){ -// s_logger.info("Error: "+e.getMessage()); -// } -// } finally { -// UserContext.unregisterContext(); -// } -// } -// -// @SuppressWarnings("rawtypes") -// public String handleRequest(Map params, boolean decode, String responseType, StringBuffer auditTrailSb) throws ServerApiException { -// String response = null; -// String[] command = null; -// try { -// command = (String[]) params.get("command"); -// if (command == null) { -// s_logger.error("invalid request, no command sent"); -// if (s_logger.isTraceEnabled()) { -// s_logger.trace("dumping request parameters"); -// for (Object key : params.keySet()) { -// String keyStr = (String) key; -// String[] value = (String[]) params.get(key); -// s_logger.trace(" key: " + keyStr + ", value: " + ((value == null) ? "'null'" : value[0])); -// } -// } -// throw new ServerApiException(BaseCmd.UNSUPPORTED_ACTION_ERROR, "Invalid request, no command sent"); -// } else { -// Map paramMap = new HashMap(); -// Set keys = params.keySet(); -// Iterator keysIter = keys.iterator(); -// while (keysIter.hasNext()) { -// String key = (String) keysIter.next(); -// if ("command".equalsIgnoreCase(key)) { -// continue; -// } -// String[] value = (String[]) params.get(key); -// -// String decodedValue = null; -// if (decode) { -// try { -// decodedValue = URLDecoder.decode(value[0], "UTF-8"); -// } catch (UnsupportedEncodingException usex) { -// s_logger.warn(key + " could not be decoded, value = " + value[0]); -// throw new ServerApiException(ApiErrorCode.PARAM_ERROR, key + " could not be decoded, received value " + value[0]); -// } catch (IllegalArgumentException iae) { -// s_logger.warn(key + " could not be decoded, value = " + value[0]); -// throw new ServerApiException(ApiErrorCode.PARAM_ERROR, key + " could not be decoded, received value " + value[0] + " which contains illegal characters eg.%"); -// } -// } else { -// decodedValue = value[0]; -// } -// paramMap.put(key, decodedValue); -// } -// String cmdClassName = _apiCommands.getProperty(command[0]); -// if (cmdClassName != null) { -// Class cmdClass = Class.forName(cmdClassName); -// BaseCmd cmdObj = (BaseCmd) cmdClass.newInstance(); -// cmdObj.setFullUrlParams(paramMap); -// cmdObj.setResponseType(responseType); -// // This is where the command is either serialized, or directly dispatched -// response = queueCommand(cmdObj, paramMap); -// } else { -// if (!command[0].equalsIgnoreCase("login") && !command[0].equalsIgnoreCase("logout")) { -// String errorString = "Unknown API command: " + ((command == null) ? "null" : command[0]); -// s_logger.warn(errorString); -// auditTrailSb.append(" " + errorString); -// throw new ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, errorString); -// } -// } -// } -// } catch (Exception ex) { -// if (ex instanceof InvalidParameterValueException) { -// InvalidParameterValueException ref = (InvalidParameterValueException)ex; -// ServerApiException e = new ServerApiException(ApiErrorCode.PARAM_ERROR, ex.getMessage()); -// // copy over the IdentityProxy information as well and throw the serverapiexception. -// ArrayList idList = ref.getIdProxyList(); -// if (idList != null) { -// // Iterate through entire arraylist and copy over each proxy id. -// for (int i = 0 ; i < idList.size(); i++) { -// IdentityProxy obj = idList.get(i); -// e.addProxyObject(obj.getTableName(), obj.getValue(), obj.getidFieldName()); -// } -// } -// // Also copy over the cserror code and the function/layer in which it was thrown. -// e.setCSErrorCode(ref.getCSErrorCode()); -// throw e; -// } else if (ex instanceof PermissionDeniedException) { -// PermissionDeniedException ref = (PermissionDeniedException)ex; -// ServerApiException e = new ServerApiException(ApiErrorCode.ACCOUNT_ERROR, ex.getMessage()); -// // copy over the IdentityProxy information as well and throw the serverapiexception. -// ArrayList idList = ref.getIdProxyList(); -// if (idList != null) { -// // Iterate through entire arraylist and copy over each proxy id. -// for (int i = 0 ; i < idList.size(); i++) { -// IdentityProxy obj = idList.get(i); -// e.addProxyObject(obj.getTableName(), obj.getValue(), obj.getidFieldName()); -// } -// } -// e.setCSErrorCode(ref.getCSErrorCode()); -// throw e; -// } else if (ex instanceof ServerApiException) { -// throw (ServerApiException) ex; -// } else { -// s_logger.error("unhandled exception executing api command: " + ((command == null) ? "null" : command[0]), ex); -// ServerApiException e = new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Internal server error, unable to execute request."); -// e.setCSErrorCode(CSExceptionErrorCode.getCSErrCode("ServerApiException")); -// throw e; -// } -// } -// return response; -// } -// -// private String queueCommand(BaseCmd cmdObj, Map params) { -// params.put("ctxStartEventId", String.valueOf(0L)); -// _dispatcher.dispatch(cmdObj, params); -// SerializationContext.current().setUuidTranslation(true); -// return ApiResponseSerializer.toSerializedString((ResponseObject) cmdObj.getResponseObject(), cmdObj.getResponseType()); -// } -// -// // FIXME: rather than isError, we might was to pass in the status code to give more flexibility -// private void writeResponse(HttpResponse resp, final String responseText, final int statusCode, String responseType, String reasonPhrase) { -// try { -// resp.setStatusCode(statusCode); -// resp.setReasonPhrase(reasonPhrase); -// -// BasicHttpEntity body = new BasicHttpEntity(); -// if (BaseCmd.RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) { -// // JSON response -// body.setContentType(jsonContentType); -// if (responseText == null) { -// body.setContent(new ByteArrayInputStream("{ \"error\" : { \"description\" : \"Internal Server Error\" } }".getBytes("UTF-8"))); -// } -// } else { -// body.setContentType("text/xml"); -// if (responseText == null) { -// body.setContent(new ByteArrayInputStream("Internal Server Error".getBytes("UTF-8"))); -// } -// } -// -// if (responseText != null) { -// body.setContent(new ByteArrayInputStream(responseText.getBytes("UTF-8"))); -// } -// resp.setEntity(body); -// } catch (Exception ex) { -// s_logger.error("error!", ex); -// } -// } -// -// // FIXME: the following two threads are copied from -// // http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpServer.java -// // we have to cite a license if we are using this code directly, so we need to add the appropriate citation or -// // modify the -// // code to be very specific to our needs -// static class ListenerThread extends Thread { -// private HttpService _httpService = null; -// private ServerSocket _serverSocket = null; -// private HttpParams _params = null; -// -// public ListenerThread(MockApiServer requestHandler, int port) { -// try { -// _serverSocket = new ServerSocket(port); -// } catch (IOException ioex) { -// s_logger.error("error initializing api server", ioex); -// return; -// } -// -// _params = new BasicHttpParams(); -// _params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 30000).setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024) -// .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false).setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true) -// .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1"); -// -// // Set up the HTTP protocol processor -// BasicHttpProcessor httpproc = new BasicHttpProcessor(); -// httpproc.addInterceptor(new ResponseDate()); -// httpproc.addInterceptor(new ResponseServer()); -// httpproc.addInterceptor(new ResponseContent()); -// httpproc.addInterceptor(new ResponseConnControl()); -// -// // Set up request handlers -// HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry(); -// reqistry.register("*", requestHandler); -// -// // Set up the HTTP service -// _httpService = new HttpService(httpproc, new NoConnectionReuseStrategy(), new DefaultHttpResponseFactory()); -// _httpService.setParams(_params); -// _httpService.setHandlerResolver(reqistry); -// } -// -// @Override -// public void run() { -// s_logger.info("ApiServer listening on port " + _serverSocket.getLocalPort()); -// while (!Thread.interrupted()) { -// try { -// // Set up HTTP connection -// Socket socket = _serverSocket.accept(); -// DefaultHttpServerConnection conn = new DefaultHttpServerConnection(); -// conn.bind(socket, _params); -// -// // Execute a new worker task to handle the request -// _executor.execute(new WorkerTask(_httpService, conn, _workerCount++)); -// } catch (InterruptedIOException ex) { -// break; -// } catch (IOException e) { -// s_logger.error("I/O error initializing connection thread", e); -// break; -// } -// } -// } -// } -// -// static class WorkerTask implements Runnable { -// private final HttpService _httpService; -// private final HttpServerConnection _conn; -// -// public WorkerTask(final HttpService httpService, final HttpServerConnection conn, final int count) { -// _httpService = httpService; -// _conn = conn; -// } -// -// @Override -// public void run() { -// HttpContext context = new BasicHttpContext(null); -// try { -// while (!Thread.interrupted() && _conn.isOpen()) { -// try { -// _httpService.handleRequest(_conn, context); -// _conn.close(); -// } finally { -// StackMaid.current().exitCleanup(); -// } -// } -// } catch (ConnectionClosedException ex) { -// if (s_logger.isTraceEnabled()) { -// s_logger.trace("ApiServer: Client closed connection"); -// } -// } catch (IOException ex) { -// if (s_logger.isTraceEnabled()) { -// s_logger.trace("ApiServer: IOException - " + ex); -// } -// } catch (HttpException ex) { -// s_logger.warn("ApiServer: Unrecoverable HTTP protocol violation" + ex); -// } finally { -// try { -// _conn.shutdown(); -// } catch (IOException ignore) { -// } -// } -// } -// } -// -// public String getSerializedApiError(int errorCode, String errorText, Map apiCommandParams, String responseType, Exception ex) { -// String responseName = null; -// String cmdClassName = null; -// -// String responseText = null; -// -// try { -// if (errorCode == ApiErrorCode.UNSUPPORTED_ACTION_ERROR.ordinal() || apiCommandParams == null || apiCommandParams.isEmpty()) { -// responseName = "errorresponse"; -// } else { -// Object cmdObj = apiCommandParams.get("command"); -// // cmd name can be null when "command" parameter is missing in the request -// if (cmdObj != null) { -// String cmdName = ((String[]) cmdObj)[0]; -// cmdClassName = _apiCommands.getProperty(cmdName); -// if (cmdClassName != null) { -// Class claz = Class.forName(cmdClassName); -// responseName = ((BaseCmd) claz.newInstance()).getCommandName(); -// } else { -// responseName = "errorresponse"; -// } -// } -// } -// ExceptionResponse apiResponse = new ExceptionResponse(); -// apiResponse.setErrorCode(errorCode); -// apiResponse.setErrorText(errorText); -// apiResponse.setResponseName(responseName); -// // Also copy over the IdentityProxy object List into this new apiResponse, from -// // the exception caught. When invoked from handle(), the exception here can -// // be either ServerApiException, PermissionDeniedException or InvalidParameterValue -// // Exception. When invoked from ApiServlet's processRequest(), this can be -// // a standard exception like NumberFormatException. We'll leave the standard ones alone. -//// if (ex != null) { -//// if (ex instanceof ServerApiException || ex instanceof PermissionDeniedException -//// || ex instanceof InvalidParameterValueException) { -//// // Cast the exception appropriately and retrieve the IdentityProxy -//// if (ex instanceof ServerApiException) { -//// ServerApiException ref = (ServerApiException) ex; -//// ArrayList idList = ref.getIdProxyList(); -//// if (idList != null) { -//// for (int i=0; i < idList.size(); i++) { -//// IdentityProxy id = idList.get(i); -//// apiResponse.addProxyObject(id.getTableName(), id.getValue(), id.getidFieldName()); -//// } -//// } -//// // Also copy over the cserror code and the function/layer in which it was thrown. -//// apiResponse.setCSErrorCode(ref.getCSErrorCode()); -//// } else if (ex instanceof PermissionDeniedException) { -//// PermissionDeniedException ref = (PermissionDeniedException) ex; -//// ArrayList idList = ref.getIdProxyList(); -//// if (idList != null) { -//// for (int i=0; i < idList.size(); i++) { -//// IdentityProxy id = idList.get(i); -//// apiResponse.addProxyObject(id.getTableName(), id.getValue(), id.getidFieldName()); -//// } -//// } -//// // Also copy over the cserror code and the function/layer in which it was thrown. -//// apiResponse.setCSErrorCode(ref.getCSErrorCode()); -//// } else if (ex instanceof InvalidParameterValueException) { -//// InvalidParameterValueException ref = (InvalidParameterValueException) ex; -//// ArrayList idList = ref.getIdProxyList(); -//// if (idList != null) { -//// for (int i=0; i < idList.size(); i++) { -//// IdentityProxy id = idList.get(i); -//// apiResponse.addProxyObject(id.getTableName(), id.getValue(), id.getidFieldName()); -//// } -//// } -//// // Also copy over the cserror code and the function/layer in which it was thrown. -//// apiResponse.setCSErrorCode(ref.getCSErrorCode()); -//// } -//// } -//// } -// SerializationContext.current().setUuidTranslation(true); -// responseText = ApiResponseSerializer.toSerializedString(apiResponse, responseType); -// -// } catch (Exception e) { -// s_logger.error("Exception responding to http request", e); -// } -// return responseText; -// } -// -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ea660cd0/server/test/com/cloud/api/RegionTest.java ---------------------------------------------------------------------- diff --git a/server/test/com/cloud/api/RegionTest.java b/server/test/com/cloud/api/RegionTest.java deleted file mode 100644 index 9ddade3..0000000 --- a/server/test/com/cloud/api/RegionTest.java +++ /dev/null @@ -1,42 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you 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 -// -// 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.cloud.api; - -import java.io.File; - -import org.apache.log4j.Logger; -import org.apache.log4j.xml.DOMConfigurator; - -import com.cloud.server.ManagementService; -import com.cloud.utils.PropertiesUtil; -import com.cloud.utils.component.ComponentLocator; - -public class RegionTest { - private static final Logger s_logger = Logger.getLogger(RegionTest.class.getName()); - - public static void main(String args[]){ - System.out.println("Starting"); - File file = PropertiesUtil.findConfigFile("log4j-cloud.xml"); - if (file != null) { - s_logger.info("log4j configuration found at " + file.getAbsolutePath()); - DOMConfigurator.configureAndWatch(file.getAbsolutePath()); - } - final ComponentLocator _locator = ComponentLocator.getLocator(ManagementService.Name, "components-regions.xml", "log4j-cloud"); - MockApiServer.initApiServer(new String[] { "commands.properties" }); - System.out.println("Started"); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ea660cd0/server/test/com/cloud/configuration/RegionsComponentLibrary.java ---------------------------------------------------------------------- diff --git a/server/test/com/cloud/configuration/RegionsComponentLibrary.java b/server/test/com/cloud/configuration/RegionsComponentLibrary.java deleted file mode 100755 index 75ac6b6..0000000 --- a/server/test/com/cloud/configuration/RegionsComponentLibrary.java +++ /dev/null @@ -1,230 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you 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 -// -// 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.cloud.configuration; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.cloud.alert.AlertManagerImpl; -import com.cloud.alert.dao.AlertDaoImpl; -import com.cloud.capacity.dao.CapacityDaoImpl; -import com.cloud.configuration.dao.ConfigurationDaoImpl; -import com.cloud.configuration.dao.ResourceCountDaoImpl; -import com.cloud.configuration.dao.ResourceLimitDaoImpl; -import com.cloud.dao.EntityManager; -import com.cloud.dao.EntityManagerImpl; -import com.cloud.dc.dao.AccountVlanMapDaoImpl; -import com.cloud.dc.dao.ClusterDaoImpl; -import com.cloud.dc.dao.DataCenterDaoImpl; -import com.cloud.dc.dao.HostPodDaoImpl; -import com.cloud.dc.dao.VlanDaoImpl; -import com.cloud.domain.dao.DomainDaoImpl; -import com.cloud.host.dao.HostDaoImpl; -import com.cloud.network.MockNetworkManagerImpl; -import com.cloud.network.dao.FirewallRulesCidrsDaoImpl; -import com.cloud.network.dao.IPAddressDaoImpl; -import com.cloud.network.dao.LoadBalancerDaoImpl; -import com.cloud.network.dao.NetworkDaoImpl; -import com.cloud.network.dao.NetworkDomainDaoImpl; -import com.cloud.network.dao.NetworkRuleConfigDaoImpl; -import com.cloud.network.dao.RemoteAccessVpnDaoImpl; -import com.cloud.network.dao.Site2SiteCustomerGatewayDaoImpl; -import com.cloud.network.dao.Site2SiteVpnGatewayDaoImpl; -import com.cloud.network.dao.VpnUserDaoImpl; -import com.cloud.network.security.MockSecurityGroupManagerImpl; -import com.cloud.network.security.dao.SecurityGroupDaoImpl; -import com.cloud.network.vpc.dao.VpcDaoImpl; -import com.cloud.network.vpn.MockRemoteAccessVpnManagerImpl; -import com.cloud.offerings.dao.NetworkOfferingDaoImpl; -import com.cloud.projects.MockProjectManagerImpl; -import com.cloud.projects.dao.ProjectAccountDaoImpl; -import com.cloud.projects.dao.ProjectDaoImpl; -import com.cloud.region.RegionManagerImpl; -import com.cloud.region.dao.RegionDaoImpl; -import com.cloud.resourcelimit.ResourceLimitManagerImpl; -import com.cloud.service.dao.ServiceOfferingDaoImpl; -import com.cloud.storage.MockStorageManagerImpl; -import com.cloud.storage.dao.DiskOfferingDaoImpl; -import com.cloud.storage.dao.GuestOSCategoryDaoImpl; -import com.cloud.storage.dao.GuestOSDaoImpl; -import com.cloud.storage.dao.LaunchPermissionDaoImpl; -import com.cloud.storage.dao.SnapshotDaoImpl; -import com.cloud.storage.dao.StoragePoolDaoImpl; -import com.cloud.storage.dao.UploadDaoImpl; -import com.cloud.storage.dao.VMTemplateDaoImpl; -import com.cloud.storage.dao.VMTemplateDetailsDaoImpl; -import com.cloud.storage.dao.VMTemplateHostDaoImpl; -import com.cloud.storage.dao.VMTemplateSwiftDaoImpl; -import com.cloud.storage.dao.VMTemplateZoneDaoImpl; -import com.cloud.storage.dao.VolumeDaoImpl; -import com.cloud.storage.dao.VolumeHostDaoImpl; -import com.cloud.storage.snapshot.MockSnapshotManagerImpl; -import com.cloud.template.MockTemplateManagerImpl; -import com.cloud.user.AccountDetailsDaoImpl; -import com.cloud.user.AccountManagerImpl; -import com.cloud.user.DomainManagerImpl; -import com.cloud.user.dao.AccountDaoImpl; -import com.cloud.user.dao.SSHKeyPairDaoImpl; -import com.cloud.user.dao.UserAccountDaoImpl; -import com.cloud.user.dao.UserDaoImpl; -import com.cloud.user.dao.UserStatisticsDaoImpl; -import com.cloud.utils.component.Adapter; -import com.cloud.utils.component.ComponentLibrary; -import com.cloud.utils.component.ComponentLibraryBase; -import com.cloud.utils.component.ComponentLocator.ComponentInfo; -import com.cloud.utils.component.Manager; -import com.cloud.utils.component.PluggableService; -import com.cloud.utils.db.GenericDao; -import com.cloud.uuididentity.dao.IdentityDaoImpl; -import com.cloud.vm.MockUserVmManagerImpl; -import com.cloud.vm.MockVirtualMachineManagerImpl; -import com.cloud.vm.dao.ConsoleProxyDaoImpl; -import com.cloud.vm.dao.DomainRouterDaoImpl; -import com.cloud.vm.dao.InstanceGroupDaoImpl; -import com.cloud.vm.dao.UserVmDaoImpl; -import com.cloud.vm.dao.UserVmDetailsDaoImpl; -import com.cloud.vm.dao.VMInstanceDaoImpl; -import com.cloud.vpc.MockConfigurationManagerImpl; -import com.cloud.vpc.MockResourceLimitManagerImpl; -import com.cloud.vpc.MockSite2SiteVpnManagerImpl; -import com.cloud.vpc.MockVpcManagerImpl; - - -public class RegionsComponentLibrary extends ComponentLibraryBase implements ComponentLibrary { - protected void populateDaos() { - addDao("DomainDao", DomainDaoImpl.class); - addDao("AccountDao", AccountDaoImpl.class); - addDao("UserDao", UserDaoImpl.class); - addDao("UserAccountDao", UserAccountDaoImpl.class); - addDao("NetworkOfferingDao", NetworkOfferingDaoImpl.class); - addDao("RegionDao", RegionDaoImpl.class); - addDao("IdentityDao", IdentityDaoImpl.class); - addDao("AccountVlanMapDao", AccountVlanMapDaoImpl.class); - addDao("CapacityDao", CapacityDaoImpl.class); - addDao("ClusterDao", ClusterDaoImpl.class); - addDao("ServiceOfferingDao", ServiceOfferingDaoImpl.class); - addDao("DiskOfferingDao", DiskOfferingDaoImpl.class); - addDao("DomainRouterDao", DomainRouterDaoImpl.class); - addDao("GuestOSDao", GuestOSDaoImpl.class); - addDao("GuestOSCategoryDao", GuestOSCategoryDaoImpl.class); - addDao("HostDao", HostDaoImpl.class); - addDao("IPAddressDao", IPAddressDaoImpl.class); - addDao("LoadBalancerDao", LoadBalancerDaoImpl.class); - addDao("NetworkRuleConfigDao", NetworkRuleConfigDaoImpl.class); - addDao("HostPodDao", HostPodDaoImpl.class); - addDao("SnapshotDao", SnapshotDaoImpl.class); - addDao("StoragePoolDao", StoragePoolDaoImpl.class); - addDao("ConfigurationDao", ConfigurationDaoImpl.class); - addDao("DataCenterDao", DataCenterDaoImpl.class); - addDao("VMTemplateZoneDao", VMTemplateZoneDaoImpl.class); - addDao("VMTemplateDetailsDao", VMTemplateDetailsDaoImpl.class); - addDao("VMTemplateDao", VMTemplateDaoImpl.class); - addDao("VMTemplateHostDao", VMTemplateHostDaoImpl.class); - addDao("VMTemplateSwiftDao", VMTemplateSwiftDaoImpl.class); - addDao("UploadDao", UploadDaoImpl.class); - addDao("UserDao", UserDaoImpl.class); - addDao("UserStatisticsDao", UserStatisticsDaoImpl.class); - addDao("UserVmDao", UserVmDaoImpl.class); - addDao("VlanDao", VlanDaoImpl.class); - addDao("VolumeDao", VolumeDaoImpl.class); - addDao("Site2SiteVpnGatewayDao", Site2SiteVpnGatewayDaoImpl.class); - addDao("Site2SiteCustomerGatewayDao", Site2SiteCustomerGatewayDaoImpl.class); - addDao("VolumeHostDao", VolumeHostDaoImpl.class); - addDao("SecurityGroupDao", SecurityGroupDaoImpl.class); - addDao("NetworkConfigurationDao", NetworkDaoImpl.class); - addDao("ConsoleProxyDao", ConsoleProxyDaoImpl.class); - addDao("FirewallRulesCidrsDao", FirewallRulesCidrsDaoImpl.class); - addDao("VMInstanceDao", VMInstanceDaoImpl.class); - addDao("AccountDetailsDao", AccountDetailsDaoImpl.class); - addDao("NetworkDomainDao", NetworkDomainDaoImpl.class); - addDao("SSHKeyPairDao", SSHKeyPairDaoImpl.class); - addDao("UserVmDetailsDao", UserVmDetailsDaoImpl.class); - addDao("ResourceCountDao", ResourceCountDaoImpl.class); - addDao("InstanceGroupDao", InstanceGroupDaoImpl.class); - addDao("RemoteAccessVpnDao", RemoteAccessVpnDaoImpl.class); - addDao("VpnUserDao", VpnUserDaoImpl.class); - addDao("ProjectDao", ProjectDaoImpl.class); - addDao("ProjectAccountDao", ProjectAccountDaoImpl.class); - addDao("LaunchPermissionDao", LaunchPermissionDaoImpl.class); - } - - @Override - public synchronized Map>> getDaos() { - if (_daos.size() == 0) { - populateDaos(); - } - return _daos; - } - - protected void populateManagers() { - addManager("configuration manager", MockConfigurationManagerImpl.class); - addManager("account manager", AccountManagerImpl.class); - addManager("domain manager", DomainManagerImpl.class); - addManager("Region Manager", RegionManagerImpl.class); - addManager("ResourceLimit Manager", MockResourceLimitManagerImpl.class); - addManager("Network Manager", MockNetworkManagerImpl.class); - addManager("UserVm Manager", MockUserVmManagerImpl.class); - addManager("Vm Manager", MockVirtualMachineManagerImpl.class); - addManager("Project Manager", MockProjectManagerImpl.class); - addManager("Vpc Manager", MockVpcManagerImpl.class); - addManager("Site2SiteVpn Manager", MockSite2SiteVpnManagerImpl.class); - addManager("SecurityGroup Manager", MockSecurityGroupManagerImpl.class); - addManager("Snapshot Manager", MockSnapshotManagerImpl.class); - addManager("Template Manager", MockTemplateManagerImpl.class); - addManager("Storage Manager", MockStorageManagerImpl.class); - addManager("RemoteAccessVpn Manager", MockRemoteAccessVpnManagerImpl.class); - addManager("Entity Manager", EntityManagerImpl.class); - } - - @Override - public synchronized Map> getManagers() { - if (_managers.size() == 0) { - populateManagers(); - } - return _managers; - } - - protected void populateAdapters() { - } - - @Override - public synchronized Map>> getAdapters() { - if (_adapters.size() == 0) { - populateAdapters(); - } - return _adapters; - } - - @Override - public synchronized Map, Class> getFactories() { - HashMap, Class> factories = new HashMap, Class>(); - factories.put(EntityManager.class, EntityManagerImpl.class); - return factories; - } - - protected void populateServices() { - } - - @Override - public synchronized Map> getPluggableServices() { - if (_pluggableServices.size() == 0) { - populateServices(); - } - return _pluggableServices; - } -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ea660cd0/server/test/com/cloud/network/security/MockSecurityGroupManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/test/com/cloud/network/security/MockSecurityGroupManagerImpl.java b/server/test/com/cloud/network/security/MockSecurityGroupManagerImpl.java deleted file mode 100755 index 9c71c62..0000000 --- a/server/test/com/cloud/network/security/MockSecurityGroupManagerImpl.java +++ /dev/null @@ -1,198 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you 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 -// -// 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.cloud.network.security; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.ejb.Local; -import javax.naming.ConfigurationException; - -import com.cloud.api.commands.AuthorizeSecurityGroupEgressCmd; -import com.cloud.api.commands.AuthorizeSecurityGroupIngressCmd; -import com.cloud.api.commands.CreateSecurityGroupCmd; -import com.cloud.api.commands.DeleteSecurityGroupCmd; -import com.cloud.api.commands.ListSecurityGroupsCmd; -import com.cloud.api.commands.RevokeSecurityGroupEgressCmd; -import com.cloud.api.commands.RevokeSecurityGroupIngressCmd; -import com.cloud.exception.InvalidParameterValueException; -import com.cloud.exception.PermissionDeniedException; -import com.cloud.exception.ResourceInUseException; -import com.cloud.utils.Pair; -import com.cloud.utils.component.Manager; -import com.cloud.utils.fsm.StateListener; -import com.cloud.vm.VirtualMachine; -import com.cloud.vm.VirtualMachine.Event; -import com.cloud.vm.VirtualMachine.State; - -@Local(value = { SecurityGroupManager.class, SecurityGroupService.class }) -public class MockSecurityGroupManagerImpl implements SecurityGroupManager, SecurityGroupService, Manager, StateListener { - - @Override - public boolean preStateTransitionEvent(State oldState, Event event, - State newState, VirtualMachine vo, boolean status, Object opaque) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean postStateTransitionEvent(State oldState, Event event, - State newState, VirtualMachine vo, boolean status, Object opaque) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean configure(String name, Map params) - throws ConfigurationException { - return true; - } - - @Override - public boolean start() { - return true; - } - - @Override - public boolean stop() { - // TODO Auto-generated method stub - return false; - } - - @Override - public String getName() { - // TODO Auto-generated method stub - return null; - } - - @Override - public SecurityGroup createSecurityGroup(CreateSecurityGroupCmd command) - throws PermissionDeniedException, InvalidParameterValueException { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean revokeSecurityGroupIngress(RevokeSecurityGroupIngressCmd cmd) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean revokeSecurityGroupEgress(RevokeSecurityGroupEgressCmd cmd) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean deleteSecurityGroup(DeleteSecurityGroupCmd cmd) - throws ResourceInUseException { - // TODO Auto-generated method stub - return false; - } - - @Override - public List searchForSecurityGroupRules( - ListSecurityGroupsCmd cmd) throws PermissionDeniedException, - InvalidParameterValueException { - // TODO Auto-generated method stub - return null; - } - - @Override - public List authorizeSecurityGroupIngress( - AuthorizeSecurityGroupIngressCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List authorizeSecurityGroupEgress( - AuthorizeSecurityGroupEgressCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public SecurityGroupVO createSecurityGroup(String name, String description, - Long domainId, Long accountId, String accountName) { - // TODO Auto-generated method stub - return null; - } - - @Override - public SecurityGroupVO createDefaultSecurityGroup(Long accountId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean addInstanceToGroups(Long userVmId, List groups) { - // TODO Auto-generated method stub - return false; - } - - @Override - public void removeInstanceFromGroups(long userVmId) { - // TODO Auto-generated method stub - - } - - @Override - public void fullSync(long agentId, - HashMap> newGroupStates) { - // TODO Auto-generated method stub - - } - - @Override - public String getSecurityGroupsNamesForVm(long vmId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List getSecurityGroupsForVm(long vmId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean isVmSecurityGroupEnabled(Long vmId) { - // TODO Auto-generated method stub - return false; - } - - @Override - public SecurityGroup getDefaultSecurityGroup(long accountId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public SecurityGroup getSecurityGroup(String name, long accountId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean isVmMappedToDefaultSecurityGroup(long vmId) { - // TODO Auto-generated method stub - return false; - } - } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ea660cd0/server/test/com/cloud/network/vpn/MockRemoteAccessVpnManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/test/com/cloud/network/vpn/MockRemoteAccessVpnManagerImpl.java b/server/test/com/cloud/network/vpn/MockRemoteAccessVpnManagerImpl.java deleted file mode 100755 index efda5c6..0000000 --- a/server/test/com/cloud/network/vpn/MockRemoteAccessVpnManagerImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you 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 -// -// 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.cloud.network.vpn; - -import java.util.List; -import java.util.Map; - -import javax.ejb.Local; -import javax.naming.ConfigurationException; - -import com.cloud.api.commands.ListRemoteAccessVpnsCmd; -import com.cloud.api.commands.ListVpnUsersCmd; -import com.cloud.exception.NetworkRuleConflictException; -import com.cloud.exception.ResourceUnavailableException; -import com.cloud.network.RemoteAccessVpn; -import com.cloud.network.VpnUser; -import com.cloud.utils.component.Manager; - -@Local(value = RemoteAccessVpnService.class) -public class MockRemoteAccessVpnManagerImpl implements RemoteAccessVpnService, Manager { - - @Override - public boolean configure(String name, Map params) - throws ConfigurationException { - return true; - } - - @Override - public boolean start() { - return true; - } - - @Override - public boolean stop() { - // TODO Auto-generated method stub - return false; - } - - @Override - public String getName() { - // TODO Auto-generated method stub - return null; - } - - @Override - public RemoteAccessVpn createRemoteAccessVpn(long vpnServerAddressId, - String ipRange, boolean openFirewall, long networkId) - throws NetworkRuleConflictException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void destroyRemoteAccessVpn(long vpnServerAddressId) - throws ResourceUnavailableException { - // TODO Auto-generated method stub - - } - - @Override - public RemoteAccessVpn startRemoteAccessVpn(long vpnServerAddressId, - boolean openFirewall) throws ResourceUnavailableException { - // TODO Auto-generated method stub - return null; - } - - @Override - public VpnUser addVpnUser(long vpnOwnerId, String userName, String password) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean removeVpnUser(long vpnOwnerId, String userName) { - // TODO Auto-generated method stub - return false; - } - - @Override - public List listVpnUsers(long vpnOwnerId, String userName) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean applyVpnUsers(long vpnOwnerId, String userName) { - // TODO Auto-generated method stub - return false; - } - - @Override - public List searchForRemoteAccessVpns( - ListRemoteAccessVpnsCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchForVpnUsers(ListVpnUsersCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List listRemoteAccessVpns(long networkId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public RemoteAccessVpn getRemoteAccessVpn(long vpnId) { - // TODO Auto-generated method stub - return null; - } -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ea660cd0/server/test/com/cloud/server/MockManagementServerImpl.java ---------------------------------------------------------------------- diff --git a/server/test/com/cloud/server/MockManagementServerImpl.java b/server/test/com/cloud/server/MockManagementServerImpl.java deleted file mode 100755 index d505ff4..0000000 --- a/server/test/com/cloud/server/MockManagementServerImpl.java +++ /dev/null @@ -1,483 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you 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 -// -// 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.cloud.server; - -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.cloud.alert.Alert; -import com.cloud.api.commands.CreateSSHKeyPairCmd; -import com.cloud.api.commands.DeleteSSHKeyPairCmd; -import com.cloud.api.commands.DestroySystemVmCmd; -import com.cloud.api.commands.ExtractVolumeCmd; -import com.cloud.api.commands.GetVMPasswordCmd; -import com.cloud.api.commands.ListAlertsCmd; -import com.cloud.api.commands.ListAsyncJobsCmd; -import com.cloud.api.commands.ListCapabilitiesCmd; -import com.cloud.api.commands.ListCapacityCmd; -import com.cloud.api.commands.ListCfgsByCmd; -import com.cloud.api.commands.ListClustersCmd; -import com.cloud.api.commands.ListDiskOfferingsCmd; -import com.cloud.api.commands.ListEventsCmd; -import com.cloud.api.commands.ListGuestOsCategoriesCmd; -import com.cloud.api.commands.ListGuestOsCmd; -import com.cloud.api.commands.ListHostsCmd; -import com.cloud.api.commands.ListIsosCmd; -import com.cloud.api.commands.ListPodsByCmd; -import com.cloud.api.commands.ListPublicIpAddressesCmd; -import com.cloud.api.commands.ListRoutersCmd; -import com.cloud.api.commands.ListSSHKeyPairsCmd; -import com.cloud.api.commands.ListServiceOfferingsCmd; -import com.cloud.api.commands.ListStoragePoolsCmd; -import com.cloud.api.commands.ListSystemVMsCmd; -import com.cloud.api.commands.ListTemplatesCmd; -import com.cloud.api.commands.ListVMGroupsCmd; -import com.cloud.api.commands.ListVlanIpRangesCmd; -import com.cloud.api.commands.ListZonesByCmd; -import com.cloud.api.commands.RebootSystemVmCmd; -import com.cloud.api.commands.RegisterSSHKeyPairCmd; -import com.cloud.api.commands.StopSystemVmCmd; -import com.cloud.api.commands.UpdateHostPasswordCmd; -import com.cloud.api.commands.UpdateIsoCmd; -import com.cloud.api.commands.UpdateTemplateCmd; -import com.cloud.api.commands.UpdateVMGroupCmd; -import com.cloud.api.commands.UpgradeSystemVMCmd; -import com.cloud.api.commands.UploadCustomCertificateCmd; -import com.cloud.async.AsyncJob; -import com.cloud.capacity.Capacity; -import com.cloud.configuration.Configuration; -import com.cloud.dc.DataCenter; -import com.cloud.dc.Pod; -import com.cloud.dc.Vlan; -import com.cloud.event.Event; -import com.cloud.event.EventVO; -import com.cloud.exception.ConcurrentOperationException; -import com.cloud.exception.ResourceUnavailableException; -import com.cloud.host.Host; -import com.cloud.host.HostVO; -import com.cloud.hypervisor.Hypervisor.HypervisorType; -import com.cloud.hypervisor.HypervisorCapabilities; -import com.cloud.info.ConsoleProxyInfo; -import com.cloud.network.IpAddress; -import com.cloud.network.router.VirtualRouter; -import com.cloud.offering.DiskOffering; -import com.cloud.offering.ServiceOffering; -import com.cloud.org.Cluster; -import com.cloud.storage.GuestOS; -import com.cloud.storage.GuestOSVO; -import com.cloud.storage.GuestOsCategory; -import com.cloud.storage.StoragePool; -import com.cloud.storage.StoragePoolVO; -import com.cloud.template.VirtualMachineTemplate; -import com.cloud.user.SSHKeyPair; -import com.cloud.utils.Pair; -import com.cloud.vm.InstanceGroup; -import com.cloud.vm.VirtualMachine; - -public class MockManagementServerImpl implements ManagementServer { - - @Override - public List listDataCenters(ListZonesByCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchForConfigurations(ListCfgsByCmd c) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchForServiceOfferings( - ListServiceOfferingsCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchForClusters(ListClustersCmd c) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchForClusters(long zoneId, - Long startIndex, Long pageSizeVal, String hypervisorType) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchForPods(ListPodsByCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchForServers(ListHostsCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public VirtualMachineTemplate updateTemplate(UpdateIsoCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public VirtualMachineTemplate updateTemplate(UpdateTemplateCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchForEvents(ListEventsCmd c) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchForRouters(ListRoutersCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchForIPAddresses( - ListPublicIpAddressesCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List listGuestOSByCriteria(ListGuestOsCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List listGuestOSCategoriesByCriteria( - ListGuestOsCategoriesCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public VirtualMachine stopSystemVM(StopSystemVmCmd cmd) - throws ResourceUnavailableException, ConcurrentOperationException { - // TODO Auto-generated method stub - return null; - } - - @Override - public VirtualMachine startSystemVM(long vmId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public VirtualMachine rebootSystemVM(RebootSystemVmCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public VirtualMachine destroySystemVM(DestroySystemVmCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public VirtualMachine upgradeSystemVM(UpgradeSystemVMCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchForAlerts(ListAlertsCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List listCapacities(ListCapacityCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Set> listIsos(ListIsosCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Set> listTemplates(ListTemplatesCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchForDiskOfferings( - ListDiskOfferingsCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchForStoragePools( - ListStoragePoolsCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchForSystemVm(ListSystemVMsCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public ArrayList getCloudIdentifierResponse(long userId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean updateHostPassword(UpdateHostPasswordCmd cmd) { - // TODO Auto-generated method stub - return false; - } - - @Override - public InstanceGroup updateVmGroup(UpdateVMGroupCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchForVmGroups(ListVMGroupsCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Map listCapabilities(ListCapabilitiesCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Long extractVolume(ExtractVolumeCmd cmd) throws URISyntaxException { - // TODO Auto-generated method stub - return null; - } - - @Override - public List getHypervisors(Long zoneId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String uploadCertificate(UploadCustomCertificateCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchForVlans(ListVlanIpRangesCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchForAsyncJobs(ListAsyncJobsCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String generateRandomPassword() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Long saveStartedEvent(Long userId, Long accountId, String type, - String description, long startEventId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Long saveCompletedEvent(Long userId, Long accountId, String level, - String type, String description, long startEventId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List listSSHKeyPairs(ListSSHKeyPairsCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public SSHKeyPair registerSSHKeyPair(RegisterSSHKeyPairCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public SSHKeyPair createSSHKeyPair(CreateSSHKeyPairCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean deleteSSHKeyPair(DeleteSSHKeyPairCmd cmd) { - // TODO Auto-generated method stub - return false; - } - - @Override - public String getVMPassword(GetVMPasswordCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public com.cloud.vm.VirtualMachine.Type findSystemVMTypeById(long instanceId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Pair, List> listHostsForMigrationOfVM( - Long vmId, Long startIndex, Long pageSize) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String[] listEventTypes() { - // TODO Auto-generated method stub - return null; - } - - @Override - public List listHypervisorCapabilities( - Long id, HypervisorType hypervisorType, String keyword, - Long startIndex, Long pageSizeVal) { - // TODO Auto-generated method stub - return null; - } - - @Override - public HypervisorCapabilities updateHypervisorCapabilities(Long id, - Long maxGuestsLimit, Boolean securityGroupEnabled) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List listTopConsumedResources(ListCapacityCmd cmd) { - // TODO Auto-generated method stub - return null; - } - - @Override - public long getId() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public String getVersion() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String[] getApiConfig() { - // TODO Auto-generated method stub - return null; - } - - @Override - public HostVO getHostBy(long hostId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List getEvents(long userId, long accountId, Long domainId, - String type, String level, Date startDate, Date endDate) { - // TODO Auto-generated method stub - return null; - } - - @Override - public ConsoleProxyInfo getConsoleProxyForVm(long dataCenterId, - long userVmId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getConsoleAccessUrlRoot(long vmId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public GuestOSVO getGuestOs(Long guestOsId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Pair getVncPort(VirtualMachine vm) { - // TODO Auto-generated method stub - return null; - } - - @Override - public long getMemoryOrCpuCapacityByHost(Long hostId, short capacityType) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public List searchForStoragePools(Criteria c) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getHashKey() { - // TODO Auto-generated method stub - return null; - } -}