Author: jawi
Date: Mon Oct 14 14:40:39 2013
New Revision: 1531917
URL: http://svn.apache.org/r1531917
Log:
Started work on an integration test for ACE-330, but stopped worked
(temporarily):
- the framework is almost ready for writing actual tests;
- a stub test is available.
Added:
ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Ace330Test.java
(with props)
ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Constants.java
(with props)
Modified:
ace/trunk/org.apache.ace.deployment.itest/bnd.bnd
Modified: ace/trunk/org.apache.ace.deployment.itest/bnd.bnd
URL:
http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment.itest/bnd.bnd?rev=1531917&r1=1531916&r2=1531917&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.deployment.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.deployment.itest/bnd.bnd Mon Oct 14 14:40:39 2013
@@ -29,26 +29,37 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
org.apache.felix.gogo.shell,\
org.apache.felix.dependencymanager.shell,\
org.apache.felix.deploymentadmin,\
+ org.apache.felix.log,\
+ org.apache.felix.prefs,\
org.apache.ace.http.listener;version=latest,\
org.apache.ace.authentication.api;version=latest,\
org.apache.ace.connectionfactory;version=latest,\
- org.apache.ace.scheduler.impl;version=latest,\
- org.apache.ace.scheduler.api;version=latest,\
+ org.apache.ace.deployment.api;version=latest,\
+ org.apache.ace.deployment.deploymentadmin;version=latest,\
org.apache.ace.deployment.provider.api;version=latest,\
+ org.apache.ace.deployment.provider.base;version=latest,\
org.apache.ace.deployment.provider.filebased;version=latest,\
+ org.apache.ace.deployment.provider.repositorybased;version=latest,\
+ org.apache.ace.deployment.servlet;version=latest,\
+ org.apache.ace.deployment.streamgenerator;version=latest,\
+ org.apache.ace.deployment.task;version=latest,\
+ org.apache.ace.deployment.task.base;version=latest,\
org.apache.ace.discovery.api;version=latest,\
org.apache.ace.discovery.property;version=latest,\
+ org.apache.ace.feedback.common;version=latest,\
org.apache.ace.identification.api;version=latest,\
org.apache.ace.identification.property;version=latest,\
- org.apache.ace.deployment.api;version=latest,\
- org.apache.ace.deployment.deploymentadmin;version=latest,\
- org.apache.ace.deployment.servlet;version=latest,\
- org.apache.ace.deployment.task;version=latest,\
- org.apache.ace.deployment.task.base;version=latest,\
- org.apache.ace.deployment.streamgenerator;version=latest,\
- org.apache.ace.deployment.provider.base;version=latest,\
+ org.apache.ace.obr.metadata;version=latest,\
+ org.apache.ace.obr.servlet;version=latest,\
+ org.apache.ace.obr.storage;version=latest,\
+ org.apache.ace.repository.api;version=latest,\
+ org.apache.ace.repository.ext;version=latest,\
+ org.apache.ace.repository.impl;version=latest,\
+ org.apache.ace.repository.servlet;version=latest,\
+ org.apache.ace.repository.task;version=latest,\
+ org.apache.ace.scheduler.impl;version=latest,\
+ org.apache.ace.scheduler.api;version=latest,\
org.apache.ace.test;version=latest,\
- org.apache.ace.feedback.common;version=latest,\
org.apache.ace.range.api;version=latest
Private-Package: org.apache.ace.it.deployment,
org.apache.ace.deployment.util.test
Bundle-Version: 1.0.0
Added:
ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Ace330Test.java
URL:
http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Ace330Test.java?rev=1531917&view=auto
==============================================================================
---
ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Ace330Test.java
(added)
+++
ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Ace330Test.java
Mon Oct 14 14:40:39 2013
@@ -0,0 +1,112 @@
+/*
+ * 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.it.deployment;
+
+import static org.apache.ace.it.deployment.Constants.TEST_AUTH_SCHEME;
+import static org.apache.ace.it.deployment.Constants.TEST_CUSTOMER;
+import static org.apache.ace.it.deployment.Constants.TEST_HTTP_PORT;
+import static org.apache.ace.it.deployment.Constants.TEST_TARGETID;
+
+import java.io.File;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.ace.deployment.provider.DeploymentProvider;
+import org.apache.ace.it.IntegrationTestBase;
+import org.apache.ace.test.utils.NetUtils;
+import org.apache.felix.dm.Component;
+
+/**
+ * Integration tests for ACE-330.
+ */
+public class Ace330Test extends IntegrationTestBase {
+ // Injected by Felix DM...
+ private volatile DeploymentProvider m_deploymentProvider;
+
+ private String m_host;
+ private String m_obrStorePath;
+
+ private URL m_repoLocation;
+ private URL m_obrLocation;
+
+ /**
+ * TODO this is only a placeholder test.
+ */
+ public void testInitiallyNoVersions() throws Exception {
+ List<String> versions =
m_deploymentProvider.getVersions(TEST_TARGETID);
+ assertNotNull(versions);
+ assertTrue(versions.isEmpty());
+ }
+
+ @Override
+ protected void configureProvisionedServices() throws Exception {
+ m_host = String.format("http://localhost:%d", TEST_HTTP_PORT);
+ m_obrStorePath = new File("generated/store").getAbsolutePath();
+ m_repoLocation = new URL(String.format("%s/repository", m_host));
+ m_obrLocation = new URL(String.format("%s/obr/", m_host));
+
+ String repoLocation = m_repoLocation.toExternalForm();
+ String obrLocation = m_obrLocation.toExternalForm();
+
+ // configureFactory("org.apache.ace.log.server.servlet.factory",
"name", "auditlog",
+ // "org.apache.ace.server.servlet.endpoint", "/auditlog",
"authentication.enabled", "false");
+ // configureFactory("org.apache.ace.log.server.store.factory", "name",
"auditlog");
+ // the various repositories...
+ configureFactory("org.apache.ace.server.repository.factory", "name",
"deployment", "customer", TEST_CUSTOMER, "master", "true");
+ configureFactory("org.apache.ace.server.repository.factory", "name",
"shop", "customer", TEST_CUSTOMER, "master", "true");
+ configureFactory("org.apache.ace.server.repository.factory", "name",
"target", "customer", TEST_CUSTOMER, "master", "true");
+ configureFactory("org.apache.ace.server.repository.factory", "name",
"user", "customer", TEST_CUSTOMER, "master", "true", "initial",
TEST_AUTH_SCHEME);
+
+ configure("org.apache.ace.client.repository",
"showunregisteredtargets", "true", "deploymentversionlimit", "3",
"obrlocation", obrLocation);
+ configure("org.apache.ace.client.rest",
"org.apache.ace.server.servlet.endpoint", "/client", "repository.url",
repoLocation, "authentication.enabled", "false",
+ "customer.name", TEST_CUSTOMER, "store.repository.name", "shop",
+ "distribution.repository.name", "target",
"deployment.repository.name", "deployment");
+
+
configure("org.apache.ace.configurator.useradmin.task.UpdateUserAdminTask",
"repositoryLocation", repoLocation, "repositoryCustomer", TEST_CUSTOMER,
"repositoryName", "user");
+
+ configure("org.apache.ace.deployment.provider.repositorybased", "url",
repoLocation, "name", "deployment", "customer", TEST_CUSTOMER);
+ configure("org.apache.ace.deployment.servlet",
"org.apache.ace.server.servlet.endpoint", "/deployment",
"authentication.enabled", "false");
+ configure("org.apache.ace.deployment.servlet.agent",
"org.apache.ace.server.servlet.endpoint", "/agent", "obr.url", obrLocation,
"authentication.enabled", "false");
+
+ configure("org.apache.ace.discovery.property", "serverURL", m_host);
+ configure("org.apache.ace.identification.property", "targetID",
TEST_TARGETID);
+
+ configure("org.apache.ace.obr.servlet",
"org.apache.ace.server.servlet.endpoint", "/obr", "authentication.enabled",
"false");
+ configure("org.apache.ace.obr.storage.file", "fileLocation",
m_obrStorePath);
+
+
configure("org.apache.ace.repository.servlet.RepositoryReplicationServlet",
"org.apache.ace.server.servlet.endpoint", "/replication",
"authentication.enabled", "false");
+ configure("org.apache.ace.repository.servlet.RepositoryServlet",
"org.apache.ace.server.servlet.endpoint", "/repository",
"authentication.enabled", "false");
+
+ configure("org.apache.ace.scheduler", "auditlog", "2000",
"org.apache.ace.configurator.useradmin.task.UpdateUserAdminTask", "2000");
+ }
+
+ @Override
+ protected void configureAdditionalServices() throws Exception {
+ // Wait until one of important repositories is online...
+
NetUtils.waitForURL(String.format("%s/repository/query?customer=%s&name=deployment",
m_host, TEST_CUSTOMER), 200, 100);
+ }
+
+ protected Component[] getDependencies() {
+ return new Component[] {
+ createComponent()
+ .setImplementation(this)
+
.add(createServiceDependency().setService(DeploymentProvider.class).setRequired(true))
+ };
+ }
+}
Propchange:
ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Ace330Test.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Constants.java
URL:
http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Constants.java?rev=1531917&view=auto
==============================================================================
---
ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Constants.java
(added)
+++
ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Constants.java
Mon Oct 14 14:40:39 2013
@@ -0,0 +1,47 @@
+/*
+ * 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.it.deployment;
+
+import org.apache.ace.test.constants.TestConstants;
+
+/**
+ * Constants for use in the integration tests.
+ */
+public interface Constants {
+ /**
+ * Provides a simple authentication scheme for a single user 'd' (password
'f') that has all rights. The XML format
+ * can be used by the "user admin configurator".
+ */
+ String TEST_AUTH_SCHEME = "<roles><group
name=\"TestGroup\"><properties><type>userGroup</type></properties></group>"
+ + "<user
name=\"d\"><properties><username>d</username></properties><credentials>"
+ +
"<password>f</password></credentials><memberof>TestGroup</memberof></user></roles>";
+ /**
+ * Customer name for testing purposes.
+ */
+ String TEST_CUSTOMER = "apache";
+ /**
+ * The TCP port on which the HTTP server should run.
+ */
+ int TEST_HTTP_PORT = TestConstants.PORT;
+ /**
+ * Target ID for use in tests.
+ */
+ String TEST_TARGETID = "test-target";
+}
Propchange:
ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Constants.java
------------------------------------------------------------------------------
svn:eol-style = native