JBoss Native SVN: r2265 - in trunk/mod_cluster/src: test/java/org/jboss/modcluster/load/metric and 1 other directory.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-02-03 11:04:29 -0500 (Tue, 03 Feb 2009)
New Revision: 2265
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/DeterministicLoadStateImpl.java
trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/DeterministicLoadMetricTestCase.java
Log:
Cosmetic internal changes
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/DeterministicLoadStateImpl.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/DeterministicLoadStateImpl.java 2009-02-03 16:02:19 UTC (rev 2264)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/DeterministicLoadStateImpl.java 2009-02-03 16:04:29 UTC (rev 2265)
@@ -32,8 +32,8 @@
*/
public class DeterministicLoadStateImpl implements DeterministicLoadState
{
- private final AtomicReference<Double> currentLoad = new AtomicReference<Double>(new Double(0));
- private final AtomicLong currentTime = new AtomicLong(System.currentTimeMillis());
+ private final AtomicReference<Double> previousLoad = new AtomicReference<Double>(new Double(0));
+ private final AtomicLong previousTime = new AtomicLong(System.currentTimeMillis());
/**
* @{inheritDoc}
@@ -42,9 +42,9 @@
public double delta(double currentLoad)
{
long currentTime = System.currentTimeMillis();
- long previousTime = this.currentTime.getAndSet(currentTime);
+ long previousTime = this.previousTime.getAndSet(currentTime);
- double previousLoad = this.currentLoad.getAndSet(new Double(currentLoad)).doubleValue();
+ double previousLoad = this.previousLoad.getAndSet(new Double(currentLoad)).doubleValue();
double seconds = (currentTime - previousTime) / 1000d;
@@ -52,8 +52,8 @@
return (currentLoad - previousLoad) / seconds;
}
- public long getCurrentTime()
+ public long getPreviousTime()
{
- return this.currentTime.get();
+ return this.previousTime.get();
}
}
Modified: trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/DeterministicLoadMetricTestCase.java
===================================================================
--- trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/DeterministicLoadMetricTestCase.java 2009-02-03 16:02:19 UTC (rev 2264)
+++ trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/DeterministicLoadMetricTestCase.java 2009-02-03 16:04:29 UTC (rev 2265)
@@ -36,25 +36,25 @@
@Test
public void testDelta() throws InterruptedException
{
- long lastTime = this.state.getCurrentTime();
+ long lastTime = this.state.getPreviousTime();
Thread.sleep(500);
double result = this.state.delta(20);
- long nextTime = this.state.getCurrentTime();
+ long nextTime = this.state.getPreviousTime();
double elapsed = (nextTime - lastTime) / 1000d;
Assert.assertEquals(20 / elapsed, result, 0);
- lastTime = this.state.getCurrentTime();
+ lastTime = this.state.getPreviousTime();
Thread.sleep(1000);
result = this.state.delta(50);
- nextTime = this.state.getCurrentTime();
+ nextTime = this.state.getPreviousTime();
elapsed = (nextTime - lastTime) / 1000d;
15 years, 10 months
JBoss Native SVN: r2264 - trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-02-03 11:02:19 -0500 (Tue, 03 Feb 2009)
New Revision: 2264
Added:
trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/DeterministicLoadMetricTestCase.java
Log:
Created
Added: trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/DeterministicLoadMetricTestCase.java
===================================================================
--- trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/DeterministicLoadMetricTestCase.java (rev 0)
+++ trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/DeterministicLoadMetricTestCase.java 2009-02-03 16:02:19 UTC (rev 2264)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.modcluster.load.metric;
+
+import org.jboss.modcluster.load.metric.impl.DeterministicLoadStateImpl;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author Paul Ferraro
+ *
+ */
+public class DeterministicLoadMetricTestCase
+{
+ private DeterministicLoadStateImpl state = new DeterministicLoadStateImpl();
+
+ @Test
+ public void testDelta() throws InterruptedException
+ {
+ long lastTime = this.state.getCurrentTime();
+
+ Thread.sleep(500);
+
+ double result = this.state.delta(20);
+
+ long nextTime = this.state.getCurrentTime();
+
+ double elapsed = (nextTime - lastTime) / 1000d;
+
+ Assert.assertEquals(20 / elapsed, result, 0);
+
+ lastTime = this.state.getCurrentTime();
+
+ Thread.sleep(1000);
+
+ result = this.state.delta(50);
+
+ nextTime = this.state.getCurrentTime();
+
+ elapsed = (nextTime - lastTime) / 1000d;
+
+ Assert.assertEquals(30 / elapsed, result, 0);
+ }
+}
15 years, 10 months
JBoss Native SVN: r2263 - in trunk/mod_cluster/src: main/java/org/jboss/modcluster/load/metric/impl and 1 other directories.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-02-03 10:48:21 -0500 (Tue, 03 Feb 2009)
New Revision: 2263
Added:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/DeterministicLoadState.java
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/DeterministicLoadStateImpl.java
Removed:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/DeterministicLoadState.java
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/ReceiveTrafficLoadMetric.java
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/RequestCountLoadMetric.java
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/SendTrafficLoadMetric.java
trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/ActiveSessionsLoadMetricTestCase.java
trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/MBeanAttributeLoadMetricTestCase.java
trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/ReceiveTrafficLoadMetricTestCase.java
trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/RequestCountLoadMetricTestCase.java
trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/SendTrafficLoadMetricTestCase.java
Log:
Extract mockable interface from DeterministicLoadState so to simplify the unit testing of deterministic load metrics
Added: trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/DeterministicLoadState.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/DeterministicLoadState.java (rev 0)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/DeterministicLoadState.java 2009-02-03 15:48:21 UTC (rev 2263)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.modcluster.load.metric;
+
+/**
+ * @author Paul Ferraro
+ *
+ */
+public interface DeterministicLoadState
+{
+ double delta(double currentLoad);
+}
\ No newline at end of file
Deleted: trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/DeterministicLoadState.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/DeterministicLoadState.java 2009-02-03 08:47:31 UTC (rev 2262)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/DeterministicLoadState.java 2009-02-03 15:48:21 UTC (rev 2263)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.modcluster.load.metric.impl;
-
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.AtomicReference;
-
-/**
- * Computes incremental load change per second from record of previous load.
- * @author Paul Ferraro
- */
-public class DeterministicLoadState
-{
- private final AtomicReference<Double> currentLoad = new AtomicReference<Double>(new Double(0));
- private final AtomicLong currentTime = new AtomicLong(System.currentTimeMillis());
-
- public double delta(double currentLoad)
- {
- long currentTime = System.currentTimeMillis();
- long previousTime = this.currentTime.getAndSet(currentTime);
-
- double previousLoad = this.currentLoad.getAndSet(new Double(currentLoad)).doubleValue();
-
- double seconds = (currentTime - previousTime) / 1000d;
-
- // Normalize by time interval (in seconds)
- return (currentLoad - previousLoad) / seconds;
- }
-}
Copied: trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/DeterministicLoadStateImpl.java (from rev 2246, trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/DeterministicLoadState.java)
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/DeterministicLoadStateImpl.java (rev 0)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/DeterministicLoadStateImpl.java 2009-02-03 15:48:21 UTC (rev 2263)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.modcluster.load.metric.impl;
+
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.jboss.modcluster.load.metric.DeterministicLoadState;
+
+/**
+ * Computes incremental load change per second from record of previous load.
+ * @author Paul Ferraro
+ */
+public class DeterministicLoadStateImpl implements DeterministicLoadState
+{
+ private final AtomicReference<Double> currentLoad = new AtomicReference<Double>(new Double(0));
+ private final AtomicLong currentTime = new AtomicLong(System.currentTimeMillis());
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.modcluster.load.metric.DeterministicLoadState#delta(double)
+ */
+ public double delta(double currentLoad)
+ {
+ long currentTime = System.currentTimeMillis();
+ long previousTime = this.currentTime.getAndSet(currentTime);
+
+ double previousLoad = this.currentLoad.getAndSet(new Double(currentLoad)).doubleValue();
+
+ double seconds = (currentTime - previousTime) / 1000d;
+
+ // Normalize by time interval (in seconds)
+ return (currentLoad - previousLoad) / seconds;
+ }
+
+ public long getCurrentTime()
+ {
+ return this.currentTime.get();
+ }
+}
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/ReceiveTrafficLoadMetric.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/ReceiveTrafficLoadMetric.java 2009-02-03 08:47:31 UTC (rev 2262)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/ReceiveTrafficLoadMetric.java 2009-02-03 15:48:21 UTC (rev 2263)
@@ -24,6 +24,7 @@
import javax.management.JMException;
import javax.management.MalformedObjectNameException;
+import org.jboss.modcluster.load.metric.DeterministicLoadState;
import org.jboss.modcluster.load.metric.LoadMetric;
/**
@@ -34,21 +35,38 @@
{
public static final String DEFAULT_ATTRIBUTE = "bytesReceived";
- private final DeterministicLoadState state = new DeterministicLoadState();
+ private final DeterministicLoadState state;
public ReceiveTrafficLoadMetric() throws MalformedObjectNameException
{
this(new RequestProcessorLoadMetricSource());
}
+ public ReceiveTrafficLoadMetric(DeterministicLoadState state) throws MalformedObjectNameException
+ {
+ this(new RequestProcessorLoadMetricSource(), state);
+ }
+
public ReceiveTrafficLoadMetric(RequestProcessorLoadMetricSource source)
{
- super(source, DEFAULT_ATTRIBUTE);
+ this(source, DEFAULT_ATTRIBUTE);
}
+ public ReceiveTrafficLoadMetric(RequestProcessorLoadMetricSource source, DeterministicLoadState state)
+ {
+ this(source, DEFAULT_ATTRIBUTE, state);
+ }
+
public ReceiveTrafficLoadMetric(RequestProcessorLoadMetricSource source, String attribute)
{
+ this(source, attribute, new DeterministicLoadStateImpl());
+ }
+
+ public ReceiveTrafficLoadMetric(RequestProcessorLoadMetricSource source, String attribute, DeterministicLoadState state)
+ {
super(source, attribute);
+
+ this.state = state;
}
/**
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/RequestCountLoadMetric.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/RequestCountLoadMetric.java 2009-02-03 08:47:31 UTC (rev 2262)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/RequestCountLoadMetric.java 2009-02-03 15:48:21 UTC (rev 2263)
@@ -24,6 +24,7 @@
import javax.management.JMException;
import javax.management.MalformedObjectNameException;
+import org.jboss.modcluster.load.metric.DeterministicLoadState;
import org.jboss.modcluster.load.metric.LoadMetric;
/**
@@ -35,21 +36,38 @@
{
public static final String DEFAULT_ATTRIBUTE = "requestCount";
- private final DeterministicLoadState state = new DeterministicLoadState();
+ private final DeterministicLoadState state;
public RequestCountLoadMetric() throws MalformedObjectNameException
{
this(new RequestProcessorLoadMetricSource());
}
+ public RequestCountLoadMetric(DeterministicLoadState state) throws MalformedObjectNameException
+ {
+ this(new RequestProcessorLoadMetricSource(), state);
+ }
+
public RequestCountLoadMetric(RequestProcessorLoadMetricSource source)
{
- super(source, DEFAULT_ATTRIBUTE);
+ this(source, DEFAULT_ATTRIBUTE);
}
+ public RequestCountLoadMetric(RequestProcessorLoadMetricSource source, DeterministicLoadState state)
+ {
+ this(source, DEFAULT_ATTRIBUTE, state);
+ }
+
public RequestCountLoadMetric(RequestProcessorLoadMetricSource source, String attribute)
{
+ this(source, attribute, new DeterministicLoadStateImpl());
+ }
+
+ public RequestCountLoadMetric(RequestProcessorLoadMetricSource source, String attribute, DeterministicLoadState state)
+ {
super(source, attribute);
+
+ this.state = state;
}
/**
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/SendTrafficLoadMetric.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/SendTrafficLoadMetric.java 2009-02-03 08:47:31 UTC (rev 2262)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/SendTrafficLoadMetric.java 2009-02-03 15:48:21 UTC (rev 2263)
@@ -24,6 +24,7 @@
import javax.management.JMException;
import javax.management.MalformedObjectNameException;
+import org.jboss.modcluster.load.metric.DeterministicLoadState;
import org.jboss.modcluster.load.metric.LoadMetric;
/**
@@ -35,21 +36,38 @@
{
public static final String DEFAULT_ATTRIBUTE = "bytesSent";
- private final DeterministicLoadState state = new DeterministicLoadState();
+ private final DeterministicLoadState state;
public SendTrafficLoadMetric() throws MalformedObjectNameException
{
this(new RequestProcessorLoadMetricSource());
}
+ public SendTrafficLoadMetric(DeterministicLoadState state) throws MalformedObjectNameException
+ {
+ this(new RequestProcessorLoadMetricSource(), state);
+ }
+
public SendTrafficLoadMetric(RequestProcessorLoadMetricSource source)
{
this(source, DEFAULT_ATTRIBUTE);
}
+ public SendTrafficLoadMetric(RequestProcessorLoadMetricSource source, DeterministicLoadState state)
+ {
+ this(source, DEFAULT_ATTRIBUTE, state);
+ }
+
public SendTrafficLoadMetric(RequestProcessorLoadMetricSource source, String attribute)
{
+ this(source, attribute, new DeterministicLoadStateImpl());
+ }
+
+ public SendTrafficLoadMetric(RequestProcessorLoadMetricSource source, String attribute, DeterministicLoadState state)
+ {
super(source, attribute);
+
+ this.state = state;
}
/**
Modified: trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/ActiveSessionsLoadMetricTestCase.java
===================================================================
--- trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/ActiveSessionsLoadMetricTestCase.java 2009-02-03 08:47:31 UTC (rev 2262)
+++ trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/ActiveSessionsLoadMetricTestCase.java 2009-02-03 15:48:21 UTC (rev 2263)
@@ -24,6 +24,7 @@
import javax.management.MalformedObjectNameException;
import org.jboss.modcluster.load.metric.impl.ActiveSessionsLoadMetric;
+import org.jboss.modcluster.load.metric.impl.MBeanQueryLoadContext;
/**
* @author Paul Ferraro
@@ -31,8 +32,23 @@
*/
public class ActiveSessionsLoadMetricTestCase extends MBeanAttributeLoadMetricTestCase
{
- public ActiveSessionsLoadMetricTestCase() throws MalformedObjectNameException
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.modcluster.load.metric.MBeanAttributeLoadMetricTestCase#getAttribute()
+ */
+ @Override
+ protected String getAttribute()
{
- super(new ActiveSessionsLoadMetric(), ActiveSessionsLoadMetric.DEFAULT_ATTRIBUTE);
+ return ActiveSessionsLoadMetric.DEFAULT_ATTRIBUTE;
}
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.modcluster.load.metric.MBeanAttributeLoadMetricTestCase#getLoadMetric()
+ */
+ @Override
+ protected LoadMetric<MBeanQueryLoadContext> getLoadMetric() throws MalformedObjectNameException
+ {
+ return new ActiveSessionsLoadMetric();
+ }
}
Modified: trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/MBeanAttributeLoadMetricTestCase.java
===================================================================
--- trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/MBeanAttributeLoadMetricTestCase.java 2009-02-03 08:47:31 UTC (rev 2262)
+++ trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/MBeanAttributeLoadMetricTestCase.java 2009-02-03 15:48:21 UTC (rev 2263)
@@ -51,25 +51,12 @@
private String attribute;
LoadMetric<MBeanQueryLoadContext> metric;
- public MBeanAttributeLoadMetricTestCase() throws MalformedObjectNameException
- {
- this("attribute");
- }
-
- private MBeanAttributeLoadMetricTestCase(String attribute) throws MalformedObjectNameException
- {
- this(new MBeanAttributeLoadMetric(new MBeanQueryLoadMetricSource("domain:*"), attribute), attribute);
- }
-
- protected MBeanAttributeLoadMetricTestCase(LoadMetric<MBeanQueryLoadContext> metric, String attribute)
- {
- this.metric = metric;
- this.attribute = attribute;
- }
-
@Before
public void prepare() throws MalformedObjectNameException
{
+ this.attribute = this.getAttribute();
+ this.metric = this.getLoadMetric();
+
ObjectName pattern = ObjectName.getInstance("domain:*");
this.name1 = ObjectName.getInstance("domain:name=test1");
this.name2 = ObjectName.getInstance("domain:name=test2");
@@ -84,6 +71,16 @@
EasyMock.reset(this.server);
}
+ protected LoadMetric<MBeanQueryLoadContext> getLoadMetric() throws MalformedObjectNameException
+ {
+ return new MBeanAttributeLoadMetric(new MBeanQueryLoadMetricSource("domain:*"), this.attribute);
+ }
+
+ protected String getAttribute()
+ {
+ return "attribute";
+ }
+
@Test
public void getLoad() throws Exception
{
Modified: trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/ReceiveTrafficLoadMetricTestCase.java
===================================================================
--- trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/ReceiveTrafficLoadMetricTestCase.java 2009-02-03 08:47:31 UTC (rev 2262)
+++ trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/ReceiveTrafficLoadMetricTestCase.java 2009-02-03 15:48:21 UTC (rev 2263)
@@ -24,6 +24,7 @@
import javax.management.MalformedObjectNameException;
import org.easymock.EasyMock;
+import org.jboss.modcluster.load.metric.impl.MBeanQueryLoadContext;
import org.jboss.modcluster.load.metric.impl.ReceiveTrafficLoadMetric;
import org.junit.Assert;
import org.junit.Test;
@@ -35,72 +36,42 @@
@SuppressWarnings("boxing")
public class ReceiveTrafficLoadMetricTestCase extends MBeanAttributeLoadMetricTestCase
{
- public ReceiveTrafficLoadMetricTestCase() throws MalformedObjectNameException
+ private DeterministicLoadState state = EasyMock.createStrictMock(DeterministicLoadState.class);
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.modcluster.load.metric.MBeanAttributeLoadMetricTestCase#getAttribute()
+ */
+ @Override
+ protected String getAttribute()
{
- super(new ReceiveTrafficLoadMetric(), ReceiveTrafficLoadMetric.DEFAULT_ATTRIBUTE);
+ return ReceiveTrafficLoadMetric.DEFAULT_ATTRIBUTE;
}
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.modcluster.load.metric.MBeanAttributeLoadMetricTestCase#getLoadMetric()
+ */
+ @Override
+ protected LoadMetric<MBeanQueryLoadContext> getLoadMetric() throws MalformedObjectNameException
+ {
+ return new ReceiveTrafficLoadMetric(this.state);
+ }
+
@Test
@Override
public void getLoad() throws Exception
{
- Thread.sleep(1);
-
- EasyMock.expect(this.server.getAttribute(this.name1, ReceiveTrafficLoadMetric.DEFAULT_ATTRIBUTE)).andReturn(0);
- EasyMock.expect(this.server.getAttribute(this.name2, ReceiveTrafficLoadMetric.DEFAULT_ATTRIBUTE)).andReturn(0);
-
- EasyMock.replay(this.server);
-
- long start = System.currentTimeMillis();
-
- double load = this.metric.getLoad(this.context);
-
- EasyMock.verify(this.server);
-
- Assert.assertEquals(0, load, 0);
-
- EasyMock.reset(this.server);
-
EasyMock.expect(this.server.getAttribute(this.name1, ReceiveTrafficLoadMetric.DEFAULT_ATTRIBUTE)).andReturn(10000L);
EasyMock.expect(this.server.getAttribute(this.name2, ReceiveTrafficLoadMetric.DEFAULT_ATTRIBUTE)).andReturn(20000L);
+ EasyMock.expect(this.state.delta(30)).andReturn(10d);
- EasyMock.replay(this.server);
-
- long sleep = 1000 - (System.currentTimeMillis() - start);
+ EasyMock.replay(this.server, this.state);
- if (sleep > 0)
- {
- Thread.sleep(sleep);
- }
-
- start = System.currentTimeMillis();
+ double load = this.metric.getLoad(this.context);
- load = this.metric.getLoad(this.context);
-
- EasyMock.verify(this.server);
+ EasyMock.verify(this.server, this.state);
- Assert.assertEquals(30.0, load, 2.0);
-
- EasyMock.reset(this.server);
-
- EasyMock.expect(this.server.getAttribute(this.name1, ReceiveTrafficLoadMetric.DEFAULT_ATTRIBUTE)).andReturn(20000L);
- EasyMock.expect(this.server.getAttribute(this.name2, ReceiveTrafficLoadMetric.DEFAULT_ATTRIBUTE)).andReturn(30000L);
-
- EasyMock.replay(this.server);
-
- sleep = 1000 - (System.currentTimeMillis() - start);
-
- if (sleep > 0)
- {
- Thread.sleep(sleep);
- }
-
- load = this.metric.getLoad(this.context);
-
- EasyMock.verify(this.server);
-
- Assert.assertEquals(20.0, load, 2.0);
-
- EasyMock.reset(this.server);
+ Assert.assertEquals(10, load, 0);
}
}
Modified: trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/RequestCountLoadMetricTestCase.java
===================================================================
--- trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/RequestCountLoadMetricTestCase.java 2009-02-03 08:47:31 UTC (rev 2262)
+++ trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/RequestCountLoadMetricTestCase.java 2009-02-03 15:48:21 UTC (rev 2263)
@@ -24,6 +24,7 @@
import javax.management.MalformedObjectNameException;
import org.easymock.EasyMock;
+import org.jboss.modcluster.load.metric.impl.MBeanQueryLoadContext;
import org.jboss.modcluster.load.metric.impl.RequestCountLoadMetric;
import org.junit.Assert;
import org.junit.Test;
@@ -35,71 +36,42 @@
@SuppressWarnings("boxing")
public class RequestCountLoadMetricTestCase extends MBeanAttributeLoadMetricTestCase
{
- public RequestCountLoadMetricTestCase() throws MalformedObjectNameException
+ private DeterministicLoadState state = EasyMock.createStrictMock(DeterministicLoadState.class);
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.modcluster.load.metric.MBeanAttributeLoadMetricTestCase#getAttribute()
+ */
+ @Override
+ protected String getAttribute()
{
- super(new RequestCountLoadMetric(), RequestCountLoadMetric.DEFAULT_ATTRIBUTE);
+ return RequestCountLoadMetric.DEFAULT_ATTRIBUTE;
}
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.modcluster.load.metric.MBeanAttributeLoadMetricTestCase#getLoadMetric()
+ */
+ @Override
+ protected LoadMetric<MBeanQueryLoadContext> getLoadMetric() throws MalformedObjectNameException
+ {
+ return new RequestCountLoadMetric(this.state);
+ }
+
@Test
@Override
public void getLoad() throws Exception
{
- EasyMock.expect(this.server.getAttribute(this.name1, RequestCountLoadMetric.DEFAULT_ATTRIBUTE)).andReturn(0);
- EasyMock.expect(this.server.getAttribute(this.name2, RequestCountLoadMetric.DEFAULT_ATTRIBUTE)).andReturn(0);
-
- EasyMock.replay(this.server);
-
- long start = System.currentTimeMillis();
-
- double load = this.metric.getLoad(this.context);
-
- EasyMock.verify(this.server);
-
- Assert.assertEquals(0, load, 0);
-
- EasyMock.reset(this.server);
-
EasyMock.expect(this.server.getAttribute(this.name1, RequestCountLoadMetric.DEFAULT_ATTRIBUTE)).andReturn(10);
EasyMock.expect(this.server.getAttribute(this.name2, RequestCountLoadMetric.DEFAULT_ATTRIBUTE)).andReturn(20);
+ EasyMock.expect(this.state.delta(30)).andReturn(10d);
- EasyMock.replay(this.server);
-
- long sleep = 1000 - (System.currentTimeMillis() - start);
+ EasyMock.replay(this.server, this.state);
- if (sleep > 0)
- {
- Thread.sleep(sleep);
- }
-
- start = System.currentTimeMillis();
+ double load = this.metric.getLoad(this.context);
- load = this.metric.getLoad(this.context);
+ EasyMock.verify(this.server, this.state);
- EasyMock.verify(this.server);
-
- Assert.assertEquals(30.0, load, 2.0);
-
- EasyMock.reset(this.server);
-
- // Test incremental load
- EasyMock.expect(this.server.getAttribute(this.name1, RequestCountLoadMetric.DEFAULT_ATTRIBUTE)).andReturn(20);
- EasyMock.expect(this.server.getAttribute(this.name2, RequestCountLoadMetric.DEFAULT_ATTRIBUTE)).andReturn(30);
-
- EasyMock.replay(this.server);
-
- sleep = 1000 - (System.currentTimeMillis() - start);
-
- if (sleep > 0)
- {
- Thread.sleep(sleep);
- }
-
- load = this.metric.getLoad(this.context);
-
- EasyMock.verify(this.server);
-
- Assert.assertEquals(20.0, load, 2.0);
-
- EasyMock.reset(this.server);
+ Assert.assertEquals(10, load, 0);
}
}
Modified: trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/SendTrafficLoadMetricTestCase.java
===================================================================
--- trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/SendTrafficLoadMetricTestCase.java 2009-02-03 08:47:31 UTC (rev 2262)
+++ trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/SendTrafficLoadMetricTestCase.java 2009-02-03 15:48:21 UTC (rev 2263)
@@ -24,6 +24,7 @@
import javax.management.MalformedObjectNameException;
import org.easymock.EasyMock;
+import org.jboss.modcluster.load.metric.impl.MBeanQueryLoadContext;
import org.jboss.modcluster.load.metric.impl.SendTrafficLoadMetric;
import org.junit.Assert;
import org.junit.Test;
@@ -35,70 +36,42 @@
@SuppressWarnings("boxing")
public class SendTrafficLoadMetricTestCase extends MBeanAttributeLoadMetricTestCase
{
- public SendTrafficLoadMetricTestCase() throws MalformedObjectNameException
+ private DeterministicLoadState state = EasyMock.createStrictMock(DeterministicLoadState.class);
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.modcluster.load.metric.MBeanAttributeLoadMetricTestCase#getAttribute()
+ */
+ @Override
+ protected String getAttribute()
{
- super(new SendTrafficLoadMetric(), SendTrafficLoadMetric.DEFAULT_ATTRIBUTE);
+ return SendTrafficLoadMetric.DEFAULT_ATTRIBUTE;
}
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.modcluster.load.metric.MBeanAttributeLoadMetricTestCase#getLoadMetric()
+ */
+ @Override
+ protected LoadMetric<MBeanQueryLoadContext> getLoadMetric() throws MalformedObjectNameException
+ {
+ return new SendTrafficLoadMetric(this.state);
+ }
+
@Test
@Override
public void getLoad() throws Exception
{
- EasyMock.expect(this.server.getAttribute(this.name1, SendTrafficLoadMetric.DEFAULT_ATTRIBUTE)).andReturn(0);
- EasyMock.expect(this.server.getAttribute(this.name2, SendTrafficLoadMetric.DEFAULT_ATTRIBUTE)).andReturn(0);
-
- EasyMock.replay(this.server);
-
- long start = System.currentTimeMillis();
-
- double load = this.metric.getLoad(this.context);
-
- EasyMock.verify(this.server);
-
- Assert.assertEquals(0, load, 0);
-
- EasyMock.reset(this.server);
-
EasyMock.expect(this.server.getAttribute(this.name1, SendTrafficLoadMetric.DEFAULT_ATTRIBUTE)).andReturn(10000L);
EasyMock.expect(this.server.getAttribute(this.name2, SendTrafficLoadMetric.DEFAULT_ATTRIBUTE)).andReturn(20000L);
+ EasyMock.expect(this.state.delta(30)).andReturn(10d);
- EasyMock.replay(this.server);
+ EasyMock.replay(this.server, this.state);
- long sleep = 1000 - (System.currentTimeMillis() - start);
+ double load = this.metric.getLoad(this.context);
- if (sleep > 0)
- {
- Thread.sleep(sleep);
- }
+ EasyMock.verify(this.server, this.state);
- start = System.currentTimeMillis();
-
- load = this.metric.getLoad(this.context);
-
- EasyMock.verify(this.server);
-
- Assert.assertEquals(30.0, load, 2.0);
-
- EasyMock.reset(this.server);
-
- EasyMock.expect(this.server.getAttribute(this.name1, SendTrafficLoadMetric.DEFAULT_ATTRIBUTE)).andReturn(20000L);
- EasyMock.expect(this.server.getAttribute(this.name2, SendTrafficLoadMetric.DEFAULT_ATTRIBUTE)).andReturn(30000L);
-
- EasyMock.replay(this.server);
-
- sleep = 1000 - (System.currentTimeMillis() - start);
-
- if (sleep > 0)
- {
- Thread.sleep(sleep);
- }
-
- load = this.metric.getLoad(this.context);
-
- EasyMock.verify(this.server);
-
- Assert.assertEquals(20.0, load, 2.0);
-
- EasyMock.reset(this.server);
+ Assert.assertEquals(10, load, 0);
}
}
15 years, 10 months
JBoss Native SVN: r2262 - in trunk/mod_cluster/test/java: org/jboss/mod_cluster and 1 other directory.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-02-03 03:47:31 -0500 (Tue, 03 Feb 2009)
New Revision: 2262
Added:
trunk/mod_cluster/test/java/load.sh
Modified:
trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java
Log:
A test for case 258618.
Added: trunk/mod_cluster/test/java/load.sh
===================================================================
--- trunk/mod_cluster/test/java/load.sh (rev 0)
+++ trunk/mod_cluster/test/java/load.sh 2009-02-03 08:47:31 UTC (rev 2262)
@@ -0,0 +1,2 @@
+java -classpath $HOME/java/commons-codec-1.3.jar:$HOME/java//commons-logging-1.0.4/commons-logging.jar:$HOME/java//commons-httpclient-3.1/commons-httpclient-3.1.jar:output/classes/ org.jboss.mod_cluster.Client http://dev12:9999/myapp/MyCount
+
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java 2009-02-02 08:42:01 UTC (rev 2261)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java 2009-02-03 08:47:31 UTC (rev 2262)
@@ -58,6 +58,8 @@
public int httpResponseCode = 0;
public String requestedSessionId = null;
+
+ private HttpClient httpClient = null;
/*
*
* Usage:
@@ -75,14 +77,21 @@
System.err.println("missing command line arguments");
System.exit(1);
}
- Client client = new Client();
- client.runit(args[0], 10, true);
- client.start();
- try {
- client.join();
- } catch (InterruptedException ex) {
- ex.printStackTrace();
+ Client client[] = new Client[200];
+ for (int i=0; i<client.length; i++) {
+ client[i] = new Client();
+ client[i].runit(args[0], 100, true);
}
+ for (int i=0; i<client.length; i++) {
+ client[i].start();
+ }
+ for (int i=0; i<client.length; i++) {
+ try {
+ client[i].join();
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+ }
}
/**
@@ -138,10 +147,11 @@
public int runit() throws Exception
{
- HttpClient httpClient = new HttpClient();
PostMethod pm = null;
GetMethod gm = null;
HttpMethodBase bm = null;
+ if (httpClient == null)
+ httpClient = new HttpClient();
if (fd != null) {
pm = new PostMethod(URL);
// InputStreamRequestEntity buf = new InputStreamRequestEntity(fd);
@@ -208,7 +218,7 @@
return 0; // first time ok.
} else {
if (jsessionid.compareTo(cookie.getValue()) == 0) {
- System.out.println("cookie ok");
+ // System.out.println("cookie ok");
bm.releaseConnection();
return 0;
} else {
@@ -256,11 +266,13 @@
System.out.println("response: " + httpResponseCode);
System.out.println("response: " + bm.getStatusLine());
success = false;
+ httpClient = null;
}
// System.out.println("response:\n" + bm.getResponseBodyAsString(len));
} catch(HttpException e) {
e.printStackTrace();
success = false;
+ httpClient = null;
}
System.out.println("DONE: " + httpResponseCode);
bm.releaseConnection();
15 years, 11 months
JBoss Native SVN: r2261 - trunk/mod_cluster/test/java.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-02-02 03:42:01 -0500 (Mon, 02 Feb 2009)
New Revision: 2261
Modified:
trunk/mod_cluster/test/java/build.properties.default
trunk/mod_cluster/test/java/build.xml
Log:
Use base.apache for httpd because the lab machines share the home directory which brings
very weird behaviour....
Modified: trunk/mod_cluster/test/java/build.properties.default
===================================================================
--- trunk/mod_cluster/test/java/build.properties.default 2009-02-01 19:12:43 UTC (rev 2260)
+++ trunk/mod_cluster/test/java/build.properties.default 2009-02-02 08:42:01 UTC (rev 2261)
@@ -2,6 +2,7 @@
base-apache.loc=http://archive.apache.org/dist/
base.path=${user.home}/java
+base.apache=${user.home}/java/${os.name}-${os.arch}
commons-httpclient.loc=${base-apache.loc}/httpcomponents/commons-httpclient/binary/commons-httpclient-3.1.tar.gz
commons-httpclient.jar=${base.path}/commons-httpclient-3.1/commons-httpclient-3.1.jar
Modified: trunk/mod_cluster/test/java/build.xml
===================================================================
--- trunk/mod_cluster/test/java/build.xml 2009-02-01 19:12:43 UTC (rev 2260)
+++ trunk/mod_cluster/test/java/build.xml 2009-02-02 08:42:01 UTC (rev 2261)
@@ -62,7 +62,7 @@
</path>
<target name="base">
- <echo message="${base.path}"/>
+ <echo message="${base.apache}"/>
</target>
<target name="compile" depends="download">
@@ -91,20 +91,21 @@
<!-- Download and install httpd -->
<target name="testhttpd">
- <available file="${base.path}/opt/jboss/httpd/sbin/apachectl" property="exist"/>
+ <available file="${base.apache}/opt/jboss/httpd/sbin/apachectl" property="exist"/>
</target>
<!--
<target name="installhttpd" unless="exist" depends="testhttpd">
-->
<target name="installhttpd">
+ <mkdir dir="${base.apache}" />
<exec executable="bash">
<arg value="installhttpd.sh"/>
</exec>
</target>
<target name="httpd" depends="installhttpd">
<copy file="apachectl.bat" tofile="apache.bat" />
- <replace file="apache.bat" token="@BASELOC@" value="${base.path}"/>
- <exec executable="${base.path}/opt/jboss/httpd/sbin/apachectl" os="Linux,SunOS,HP-UX">
+ <replace file="apache.bat" token="@BASELOC@" value="${base.apache}"/>
+ <exec executable="${base.apache}/opt/jboss/httpd/sbin/apachectl" os="Linux,SunOS,HP-UX">
<arg value="start"/>
</exec>
<exec executable="apache.bat" os="Windows 2003">
@@ -112,13 +113,13 @@
</exec>
</target>
<target name="stophttpd">
- <exec executable="${base.path}/opt/jboss/httpd/sbin/apachectl" os="Linux,SunOS,HP-UX">
+ <exec executable="${base.apache}/opt/jboss/httpd/sbin/apachectl" os="Linux,SunOS,HP-UX">
<arg value="stop"/>
</exec>
- <exec executable="${base.path}/httpd-2.2/bin/httpd.exe" os="Windows 2003">
+ <exec executable="${base.apache}/httpd-2.2/bin/httpd.exe" os="Windows 2003">
<arg value="-k stop"/>
</exec>
- <exec executable="${base.path}/httpd-2.2/bin/httpd.exe" os="Windows 2003">
+ <exec executable="${base.apache}/httpd-2.2/bin/httpd.exe" os="Windows 2003">
<arg value="-k uninstall"/>
</exec>
</target>
15 years, 11 months
JBoss Native SVN: r2260 - trunk/build/unix.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-02-01 14:12:43 -0500 (Sun, 01 Feb 2009)
New Revision: 2260
Modified:
trunk/build/unix/buildsrc.cluster.sh
Log:
Need gnu patch (dev24 tells: "Hmm... I can't seem to find a patch in there anywhere."
Modified: trunk/build/unix/buildsrc.cluster.sh
===================================================================
--- trunk/build/unix/buildsrc.cluster.sh 2009-02-01 17:24:21 UTC (rev 2259)
+++ trunk/build/unix/buildsrc.cluster.sh 2009-02-01 19:12:43 UTC (rev 2260)
@@ -70,5 +70,5 @@
# Fix the config.m4 to build mod_cluster
(cd ${destdir}/modules/proxy
- patch -p0 < config.m4.patch
+ $patch -p0 < config.m4.patch
)
15 years, 11 months
JBoss Native SVN: r2259 - in trunk: mod_cluster/test/java and 1 other directory.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-02-01 12:24:21 -0500 (Sun, 01 Feb 2009)
New Revision: 2259
Modified:
trunk/build/unix/build.sh
trunk/mod_cluster/test/java/installhttpd.sh
Log:
Using the PACKAGE and version exported by build.sh
Modified: trunk/build/unix/build.sh
===================================================================
--- trunk/build/unix/build.sh 2009-01-31 18:27:39 UTC (rev 2258)
+++ trunk/build/unix/build.sh 2009-02-01 17:24:21 UTC (rev 2259)
@@ -164,6 +164,7 @@
echo "Using version ${build_version} from `basename ${package_list}`"
fi
export build_version
+export PACKAGE
# Check for some gnu mandadory tools.
patch=`util/find_gnu.sh patch`
Modified: trunk/mod_cluster/test/java/installhttpd.sh
===================================================================
--- trunk/mod_cluster/test/java/installhttpd.sh 2009-01-31 18:27:39 UTC (rev 2258)
+++ trunk/mod_cluster/test/java/installhttpd.sh 2009-02-01 17:24:21 UTC (rev 2259)
@@ -109,8 +109,15 @@
ADDMODULES=true
;;
esac
-#PACKAGE=rhel-httpd-2.2.8-1.el5s2
-PACKAGE=mod_cluster-1.0.0.dev
+#PACKVER=rhel-httpd-2.2.8-1.el5s2
+if [ "x${PACKAGE}" = "x" ]
+then
+ PACKVER=mod_cluster-1.0.0.dev
+else
+ # The PACKVER and build_version from the build.sh script.
+ echo "Using ${build_version} for ${PACKVER}"
+ PACKVER=${PACKAGE}-${build_version}
+fi
# Something like (note don't use ssl for the moment.
# http://hudson.qa.jboss.com/hudson/view/Native/job/mod_cluster-linux-x86_6...
@@ -118,26 +125,26 @@
# The result of the build is something like:
# /qa/services/hudson/hudson_workspace/workspace/mod_cluster-linux-i686/jbossnative/build/unix/output/mod_cluster-1.0.0.dev-linux2-x86.tar.gz
#
-TARBALL=http://hudson.qa.jboss.com/hudson/view/Native/job/${BASE}/lastSuccessfulBuild/artifact/jbossnative/build/unix/output/${PACKAGE}-${BUILD_SYS}-${BUILD_CPU}.${EXT}
+TARBALL=http://hudson.qa.jboss.com/hudson/view/Native/job/${BASE}/lastSuccessfulBuild/artifact/jbossnative/build/unix/output/${PACKVER}-${BUILD_SYS}-${BUILD_CPU}.${EXT}
BASELOC=`ant base | grep echo | sed 's:\[echo\]::' | sed 's:^ *::'`
if [ "x${BASELOC}" = "x" ]
then
BASELOC=`pwd`
- if [ ! -f ${PACKAGE}-${BUILD_SYS}-${BUILD_CPU}.${EXT} ]
+ if [ ! -f ${PACKVER}-${BUILD_SYS}-${BUILD_CPU}.${EXT} ]
then
- ant downloadfile -Dsourcefile=${TARBALL} -Ddestfile=${PACKAGE}-${BUILD_SYS}-${BUILD_CPU}.${EXT} -Ddestdir=$BASELOC
+ ant downloadfile -Dsourcefile=${TARBALL} -Ddestfile=${PACKVER}-${BUILD_SYS}-${BUILD_CPU}.${EXT} -Ddestdir=$BASELOC
fi
else
if [ "x${BUILDTEST}" = "x" ]
then
- rm -f ${PACKAGE}-${BUILD_SYS}-${BUILD_CPU}.${EXT}
- ant downloadfile -Dsourcefile=${TARBALL} -Ddestfile=${PACKAGE}-${BUILD_SYS}-${BUILD_CPU}.${EXT} -Ddestdir=$BASELOC
+ rm -f ${PACKVER}-${BUILD_SYS}-${BUILD_CPU}.${EXT}
+ ant downloadfile -Dsourcefile=${TARBALL} -Ddestfile=${PACKVER}-${BUILD_SYS}-${BUILD_CPU}.${EXT} -Ddestdir=$BASELOC
else
echo "Using $root"
EXT=file
fi
fi
-TARBALL=`pwd`/${PACKAGE}-${BUILD_SYS}-${BUILD_CPU}.${EXT}
+TARBALL=`pwd`/${PACKVER}-${BUILD_SYS}-${BUILD_CPU}.${EXT}
export BASELOC
echo "Base is: $BASELOC !!!"
15 years, 11 months