karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Schneider <ch...@die-schneider.net>
Subject Re: svn commit: r1394106 - in /karaf/trunk/itests/src/test/java/org/apache/karaf/itests: BootFeaturesTest.java FeatureTest.java KarafTestSupport.java
Date Sat, 06 Oct 2012 06:23:28 GMT
Hi Andreas,

I also answered inline.

Christian

Am 06.10.2012 06:09, schrieb Andreas Pieber:
> Hey,
>
> Questions inline
>
> On Thu, Oct 4, 2012 at 5:00 PM,  <cschneider@apache.org> wrote:
>> Author: cschneider
>> Date: Thu Oct  4 15:00:02 2012
>> New Revision: 1394106
>>
>> URL: http://svn.apache.org/viewvc?rev=1394106&view=rev
>> Log:
>> KARAF-1897 Use different ports for itests. Switch off ssh for tests where it is not
used
>>
>> Modified:
>>      karaf/trunk/itests/src/test/java/org/apache/karaf/itests/BootFeaturesTest.java
>>      karaf/trunk/itests/src/test/java/org/apache/karaf/itests/FeatureTest.java
>>      karaf/trunk/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
>>
>> Modified: karaf/trunk/itests/src/test/java/org/apache/karaf/itests/BootFeaturesTest.java
>> URL: http://svn.apache.org/viewvc/karaf/trunk/itests/src/test/java/org/apache/karaf/itests/BootFeaturesTest.java?rev=1394106&r1=1394105&r2=1394106&view=diff
>> ==============================================================================
>> --- karaf/trunk/itests/src/test/java/org/apache/karaf/itests/BootFeaturesTest.java
(original)
>> +++ karaf/trunk/itests/src/test/java/org/apache/karaf/itests/BootFeaturesTest.java
Thu Oct  4 15:00:02 2012
>> @@ -12,6 +12,6 @@ public class BootFeaturesTest extends Ka
>>
>>       @Test
>>       public void testBootFeatures() throws Exception {
>> -        assertFeaturesInstalled("standard", "config", "region", "package", "kar",
"ssh", "management");
>> +        assertFeaturesInstalled("standard", "config", "region", "package", "kar",
"management");
>>       }
>>   }
>>
>> Modified: karaf/trunk/itests/src/test/java/org/apache/karaf/itests/FeatureTest.java
>> URL: http://svn.apache.org/viewvc/karaf/trunk/itests/src/test/java/org/apache/karaf/itests/FeatureTest.java?rev=1394106&r1=1394105&r2=1394106&view=diff
>> ==============================================================================
>> --- karaf/trunk/itests/src/test/java/org/apache/karaf/itests/FeatureTest.java (original)
>> +++ karaf/trunk/itests/src/test/java/org/apache/karaf/itests/FeatureTest.java Thu
Oct  4 15:00:02 2012
>> @@ -36,12 +36,6 @@ public class FeatureTest extends KarafTe
>>           String featureListOutput = executeCommand("feature:list -i");
>>           System.out.println(featureListOutput);
>>           assertTrue(featureListOutput.contains("standard"));
>> -        assertTrue(featureListOutput.contains("config"));
>> -        assertTrue(featureListOutput.contains("region"));
>> -        assertTrue(featureListOutput.contains("package"));
>> -        assertTrue(featureListOutput.contains("kar"));
>> -        assertTrue(featureListOutput.contains("ssh"));
>> -        assertTrue(featureListOutput.contains("management"));
> I don't understand that change. Why remove that validation?

I created a separate BootFeaturesTest. So testing for all details would 
be redundant and we need to change it whenever we change boo features. 
If you prefer I can revert this part.
>
>>       }
>>
>>       @Test
>>
>> Modified: karaf/trunk/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
>> URL: http://svn.apache.org/viewvc/karaf/trunk/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java?rev=1394106&r1=1394105&r2=1394106&view=diff
>> ==============================================================================
>> --- karaf/trunk/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
(original)
>> +++ karaf/trunk/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
Thu Oct  4 15:00:02 2012
>> @@ -13,6 +13,7 @@
>>    */
>>   package org.apache.karaf.itests;
>>
>> +import static org.apache.karaf.tooling.exam.options.KarafDistributionOption.editConfigurationFilePut;
>>   import static org.apache.karaf.tooling.exam.options.KarafDistributionOption.karafDistributionConfiguration;
>>   import static org.apache.karaf.tooling.exam.options.KarafDistributionOption.keepRuntimeFolder;
>>   import static org.apache.karaf.tooling.exam.options.KarafDistributionOption.logLevel;
>> @@ -51,6 +52,7 @@ import org.ops4j.pax.exam.Option;
>>   import org.ops4j.pax.exam.TestProbeBuilder;
>>   import org.ops4j.pax.exam.junit.Configuration;
>>   import org.ops4j.pax.exam.junit.ProbeBuilder;
>> +import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
>>   import org.osgi.framework.BundleContext;
>>   import org.osgi.framework.Constants;
>>   import org.osgi.framework.Filter;
>> @@ -61,6 +63,8 @@ import org.osgi.util.tracker.ServiceTrac
>>
>>   public class KarafTestSupport {
>>
>> +    private static final String RMI_PORT = "1100";
>> +
>>       static final Long COMMAND_TIMEOUT = 10000L;
>>       static final Long SERVICE_TIMEOUT = 30000L;
>>
>> @@ -86,11 +90,16 @@ public class KarafTestSupport {
>>
>>       @Configuration
>>       public Option[] config() {
>> +        MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf").versionAsInProject().type("tar.gz");
>>           return new Option[]{
>> -            karafDistributionConfiguration().frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf").versionAsInProject().type("tar.gz"))
>> -                    .name("Apache Karaf").unpackDirectory(new File("target/exam")),
>> -                keepRuntimeFolder(),
>> -                logLevel(LogLevelOption.LogLevel.INFO) };
>> +            karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache
Karaf").unpackDirectory(new File("target/exam")),
>> +            keepRuntimeFolder(),
>> +            logLevel(LogLevelOption.LogLevel.INFO),
>> +            editConfigurationFilePut("etc/org.apache.karaf.features.cfg", "featuresBoot",
"config,standard,region,package,kar,management"),
>> +            editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port",
"9080"),
>> +            editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort",
RMI_PORT),
>> +            editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort",
"44445")
>> +        };
> Wouldn't it be better to retrieve the ports using the
> build-helper-maven-plugin:reserve-network-port-mojo to generate those
> ports and simply load them here?
Absolutely. The idea was to change the ports in statically in the first 
step to allow a build to run parallel to a running karaf. Using real 
dynamic ports is the next logic step. I just had no idea how to do it.
>>       }
>>
>>       /**
>> @@ -223,7 +232,7 @@ public class KarafTestSupport {
>>       }
>>
>>       public JMXConnector getJMXConnector() throws Exception {
>> -        JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1099/karaf-root");
>> +        JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:"
+ RMI_PORT+ "/karaf-root");
>>           Hashtable<String, Object> env = new Hashtable<String, Object>();
>>           String[] credentials = new String[]{ "karaf", "karaf" };
>>           env.put("jmx.remote.credentials", credentials);
>>
>>


-- 
  
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


Mime
View raw message