You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sirona.apache.org by va...@apache.org on 2013/11/15 18:57:39 UTC
svn commit: r1542348 -
/incubator/sirona/trunk/agent/store/cube/src/test/java/org/apache/sirona/cube/CubeDataStoreTest.java
Author: vanto
Date: Fri Nov 15 17:57:39 2013
New Revision: 1542348
URL: http://svn.apache.org/r1542348
Log:
fixing a locale specific test failure -- and a string parsing issue.
Modified:
incubator/sirona/trunk/agent/store/cube/src/test/java/org/apache/sirona/cube/CubeDataStoreTest.java
Modified: incubator/sirona/trunk/agent/store/cube/src/test/java/org/apache/sirona/cube/CubeDataStoreTest.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/store/cube/src/test/java/org/apache/sirona/cube/CubeDataStoreTest.java?rev=1542348&r1=1542347&r2=1542348&view=diff
==============================================================================
--- incubator/sirona/trunk/agent/store/cube/src/test/java/org/apache/sirona/cube/CubeDataStoreTest.java (original)
+++ incubator/sirona/trunk/agent/store/cube/src/test/java/org/apache/sirona/cube/CubeDataStoreTest.java Fri Nov 15 17:57:39 2013
@@ -16,28 +16,32 @@
*/
package org.apache.sirona.cube;
-import org.apache.sirona.Role;
-import org.apache.sirona.counters.Counter;
-import org.apache.sirona.gauges.Gauge;
-import org.apache.sirona.repositories.Repository;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Locale;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import org.apache.sirona.Role;
+import org.apache.sirona.counters.Counter;
+import org.apache.sirona.gauges.Gauge;
+import org.apache.sirona.repositories.Repository;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
public class CubeDataStoreTest {
private CubeServer server;
private Gauge.LoaderHelper gauges;
+ private static Locale oldLocale;
@Before
public void startCube() throws IOException {
@@ -53,6 +57,17 @@ public class CubeDataStoreTest {
server.stop();
}
+ @BeforeClass
+ public static void setDefaultLocale() {
+ oldLocale = Locale.getDefault();
+ Locale.setDefault(Locale.ENGLISH);
+ }
+
+ @AfterClass
+ public static void restoreLocale() {
+ Locale.setDefault(oldLocale);
+ }
+
@Test
public void store() throws InterruptedException, UnknownHostException {
{ // force some counter data
@@ -79,7 +94,7 @@ public class CubeDataStoreTest {
final String valueStr = "value\":";
final int start = m.indexOf(valueStr) + valueStr.length();
- gauges.add(Double.parseDouble(m.substring(start, Math.max(m.indexOf('"', start + 1), m.indexOf('}', start + 1)))));
+ gauges.add(Double.parseDouble(m.substring(start, Math.min(m.indexOf(',', start + 1), m.indexOf('}', start + 1)))));
} else if (m.contains("\"type\": \"counter\"")) {
counters++;
aCounterMessage = m;