You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ace.apache.org by br...@apache.org on 2013/08/21 09:47:03 UTC
svn commit: r1516104 - in /ace/trunk/org.apache.ace.agent:
src/org/apache/ace/agent/ src/org/apache/ace/agent/impl/
test/org/apache/ace/agent/impl/ test/org/apache/ace/agent/testutil/
Author: bramk
Date: Wed Aug 21 07:47:02 2013
New Revision: 1516104
URL: http://svn.apache.org/r1516104
Log:
ACE-347 Some renaming / javadoc
Added:
ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DeploymentHandlerImplTest.java
- copied, changed from r1515849, ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DeploymentHandlerTest.java
ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/IdentificationHandlerImplTest.java
- copied, changed from r1515849, ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/IdentificationhandlerImplTest.java
Removed:
ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DeploymentHandlerTest.java
ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/IdentificationhandlerImplTest.java
Modified:
ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/AgentUpdateHandler.java
ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/ConfigurationHandler.java
ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ConfigurationHandlerImpl.java
ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/ConfigurationHandlerImplTest.java
ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/ConnectionHandlerImplTest.java
ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/CustomControllerTest.java
ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DiscoveryHandlerImplTest.java
ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DownloadHandlerTest.java
ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/testutil/BaseAgentTest.java
ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/testutil/TestWebServer.java
Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/AgentUpdateHandler.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/AgentUpdateHandler.java?rev=1516104&r1=1516103&r2=1516104&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/AgentUpdateHandler.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/AgentUpdateHandler.java Wed Aug 21 07:47:02 2013
@@ -6,22 +6,27 @@ import java.util.SortedSet;
import org.osgi.framework.Version;
+/**
+ * Agent control delegate interface that is responsible for managing agent updates.
+ *
+ */
public interface AgentUpdateHandler {
+
/** Returns the locally installed version of the agent. */
Version getInstalledVersion();
-
+
/** Returns the versions available on the server. */
SortedSet<Version> getAvailableVersions() throws RetryAfterException, IOException;
-
+
/** Returns an input stream for the update of the agent. */
InputStream getInputStream(Version version) throws RetryAfterException, IOException;
-
+
/** Returns a download handle to download the update of the agent. */
DownloadHandle getDownloadHandle(Version version) throws RetryAfterException, IOException;
-
+
/** Returns the size of the update of the agent. */
long getSize(Version version) throws RetryAfterException, IOException;
-
+
/** Installs the update of the agent. */
void install(InputStream stream) throws IOException;
}
Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/ConfigurationHandler.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/ConfigurationHandler.java?rev=1516104&r1=1516103&r2=1516104&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/ConfigurationHandler.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/ConfigurationHandler.java Wed Aug 21 07:47:02 2013
@@ -32,12 +32,13 @@ import java.util.Set;
* <code>agent.controller.syncinterval=3000</code><br/>
* <code>agent.controller.syncinterval.override=true</code>
*/
+// TODO Configuration by launcher will probably be the primary use case. Should we flip the override default?
public interface ConfigurationHandler {
/**
* Key namespace; All system property keys that start with this are considered.
*/
- String CONFIG_KEY_NAMESPACE = "agent";
+ String CONFIG_KEY_NAMESPACE = "ace.agent";
/**
* Override postfix; The postfix for override property keys.
Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ConfigurationHandlerImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ConfigurationHandlerImpl.java?rev=1516104&r1=1516103&r2=1516104&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ConfigurationHandlerImpl.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ConfigurationHandlerImpl.java Wed Aug 21 07:47:02 2013
@@ -33,8 +33,18 @@ import java.util.Set;
import org.apache.ace.agent.ConfigurationHandler;
import org.osgi.service.log.LogService;
+/**
+ * Default configuration handler that reads the serverURL(s) from the configuration using key
+ * {@link DISCOVERY_CONFIG_KEY}.
+ */
public class ConfigurationHandlerImpl implements ConfigurationHandler {
+ /** Directory name use for storage. It is relative to the agent context work directory. */
+ public static final String CONFIG_STORAGE_SUBDIR = "config";
+
+ /** File name use for storage. */
+ public static final String CONFIG_STORAGE_FILENAME = "config.properties";
+
private final AgentContext m_agentContext;
private Properties m_configProps = null;
@@ -191,14 +201,14 @@ public class ConfigurationHandlerImpl im
}
private File getConfigFile() throws IOException {
- File file = new File(getConfigDir(), "config.properties");
+ File file = new File(getConfigDir(), CONFIG_STORAGE_FILENAME);
if (!file.exists() && !file.createNewFile())
throw new IOException("Unable to acces configuration file: " + file.getAbsolutePath());
return file;
}
private File getConfigDir() throws IOException {
- File dir = new File(m_agentContext.getWorkDir(), "config");
+ File dir = new File(m_agentContext.getWorkDir(), CONFIG_STORAGE_SUBDIR);
if (!dir.exists() && !dir.mkdir())
throw new IOException("Unable to acces configuration directory: " + dir.getAbsolutePath());
return dir;
Modified: ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/ConfigurationHandlerImplTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/ConfigurationHandlerImplTest.java?rev=1516104&r1=1516103&r2=1516104&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/ConfigurationHandlerImplTest.java (original)
+++ ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/ConfigurationHandlerImplTest.java Wed Aug 21 07:47:02 2013
@@ -1,3 +1,21 @@
+/*
+ * 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 org.apache.ace.agent.impl;
import static org.easymock.EasyMock.expect;
@@ -14,6 +32,9 @@ import org.testng.annotations.AfterMetho
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+/**
+ * Testing {@link ConfigurationHandlerImpl}.
+ */
public class ConfigurationHandlerImplTest extends BaseAgentTest {
private AgentContext m_agentContext;
Modified: ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/ConnectionHandlerImplTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/ConnectionHandlerImplTest.java?rev=1516104&r1=1516103&r2=1516104&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/ConnectionHandlerImplTest.java (original)
+++ ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/ConnectionHandlerImplTest.java Wed Aug 21 07:47:02 2013
@@ -18,10 +18,11 @@
*/
package org.apache.ace.agent.impl;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.eq;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.notNull;
+import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.reset;
import static org.testng.Assert.assertEquals;
@@ -46,8 +47,7 @@ import org.testng.annotations.BeforeTest
import org.testng.annotations.Test;
/**
- * Testing {@link ConnectionHandlerImpl}
- *
+ * Testing {@link ConnectionHandlerImpl},
*/
// TODO test CLIENT_CERT
public class ConnectionHandlerImplTest extends BaseAgentTest {
Modified: ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/CustomControllerTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/CustomControllerTest.java?rev=1516104&r1=1516103&r2=1516104&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/CustomControllerTest.java (original)
+++ ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/CustomControllerTest.java Wed Aug 21 07:47:02 2013
@@ -42,6 +42,9 @@ import org.testng.annotations.BeforeMeth
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
+/**
+ * Testing {@link CustomController}.
+ */
public class CustomControllerTest extends BaseAgentTest {
AgentControl m_agentControl;
Copied: ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DeploymentHandlerImplTest.java (from r1515849, ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DeploymentHandlerTest.java)
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DeploymentHandlerImplTest.java?p2=ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DeploymentHandlerImplTest.java&p1=ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DeploymentHandlerTest.java&r1=1515849&r2=1516104&rev=1516104&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DeploymentHandlerTest.java (original)
+++ ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DeploymentHandlerImplTest.java Wed Aug 21 07:47:02 2013
@@ -58,7 +58,10 @@ import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-public class DeploymentHandlerTest extends BaseAgentTest {
+/**
+ * Testing {@link DeploymentHandlerImpl}.
+ */
+public class DeploymentHandlerImplTest extends BaseAgentTest {
static class TestDeploymentServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
Modified: ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DiscoveryHandlerImplTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DiscoveryHandlerImplTest.java?rev=1516104&r1=1516103&r2=1516104&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DiscoveryHandlerImplTest.java (original)
+++ ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DiscoveryHandlerImplTest.java Wed Aug 21 07:47:02 2013
@@ -18,11 +18,12 @@
*/
package org.apache.ace.agent.impl;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.eq;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.reset;
+import static org.easymock.EasyMock.resetToNice;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
@@ -38,6 +39,9 @@ import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
+/**
+ * Testing {@link DiscoveryHandlerImpl}.
+ */
public class DiscoveryHandlerImplTest extends BaseAgentTest {
private final int PORT = 8882;
Modified: ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DownloadHandlerTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DownloadHandlerTest.java?rev=1516104&r1=1516103&r2=1516104&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DownloadHandlerTest.java (original)
+++ ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/DownloadHandlerTest.java Wed Aug 21 07:47:02 2013
@@ -57,6 +57,9 @@ import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
+/**
+ * Testing {@link DownloadHandlerImpl}.
+ */
public class DownloadHandlerTest extends BaseAgentTest {
static class TestErrorServlet extends HttpServlet {
Copied: ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/IdentificationHandlerImplTest.java (from r1515849, ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/IdentificationhandlerImplTest.java)
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/IdentificationHandlerImplTest.java?p2=ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/IdentificationHandlerImplTest.java&p1=ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/IdentificationhandlerImplTest.java&r1=1515849&r2=1516104&rev=1516104&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/IdentificationhandlerImplTest.java (original)
+++ ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/impl/IdentificationHandlerImplTest.java Wed Aug 21 07:47:02 2013
@@ -33,7 +33,10 @@ import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-public class IdentificationhandlerImplTest extends BaseAgentTest {
+/**
+ * Testing {@link IdentificationHandlerImpl}.
+ */
+public class IdentificationHandlerImplTest extends BaseAgentTest {
private IdentificationHandler m_identificationHandler;
private ConfigurationHandler m_configurationHandler;
Modified: ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/testutil/BaseAgentTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/testutil/BaseAgentTest.java?rev=1516104&r1=1516103&r2=1516104&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/testutil/BaseAgentTest.java (original)
+++ ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/testutil/BaseAgentTest.java Wed Aug 21 07:47:02 2013
@@ -27,7 +27,10 @@ import java.util.HashSet;
import java.util.Set;
import java.util.Stack;
-public class BaseAgentTest {
+/**
+ * Simple base class.
+ */
+public abstract class BaseAgentTest {
Set<Object> m_mocks = new HashSet<Object>();
Modified: ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/testutil/TestWebServer.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/testutil/TestWebServer.java?rev=1516104&r1=1516103&r2=1516104&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/testutil/TestWebServer.java (original)
+++ ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/testutil/TestWebServer.java Wed Aug 21 07:47:02 2013
@@ -41,6 +41,10 @@ import org.eclipse.jetty.servlet.FilterH
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
+/**
+ * Test utility that manages a Jetty webserver with a {@link DefaultServlet} that support HTTP range downloads and a simple
+ * HTTP protocol dump filter. It can be extended with custom test servlets.
+ */
public class TestWebServer {
private Server m_server;