Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

graph example

  • Loading branch information...
commit 013ac47231e879e5e53d3826b333ac99173c0fd2 1 parent 6544865
Dann authored April 13, 2012
36  src/test/java/com/github/dann/wspusher/test/common/util/HttpPostTestDataFactory.java
... ...
@@ -1,17 +1,15 @@
1 1
 /*
2 2
  * Copyright 2012 Dann.
3  
- *
4  
- * Licensed under the Apache License, Version 2.0 (the "License");
5  
- * you may not use this file except in compliance with the License.
6  
- * You may obtain a copy of the License at
7  
- *
8  
- *     http://www.apache.org/licenses/LICENSE-2.0
9  
- *
10  
- * Unless required by applicable law or agreed to in writing, software
11  
- * distributed under the License is distributed on an "AS IS" BASIS,
12  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  
- * either express or implied. See the License for the specific language
14  
- * governing permissions and limitations under the License.
  3
+ * 
  4
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  5
+ * in compliance with the License. You may obtain a copy of the License at
  6
+ * 
  7
+ * http://www.apache.org/licenses/LICENSE-2.0
  8
+ * 
  9
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
  10
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  11
+ * or implied. See the License for the specific language governing permissions and limitations under
  12
+ * the License.
15 13
  */
16 14
 package com.github.dann.wspusher.test.common.util;
17 15
 
@@ -22,6 +20,8 @@
22 20
 
23 21
 public class HttpPostTestDataFactory {
24 22
 
  23
+  private static final int TIMELINE_LENGTH = 5;
  24
+
25 25
   public static String createTestData() {
26 26
     JSONObject channel1 = createTimelineData();
27 27
     String jsonText = JSONValue.toJSONString(channel1);
@@ -30,11 +30,17 @@ public static String createTestData() {
30 30
 
31 31
   private static JSONObject createTimelineData() {
32 32
     LinkedList<Double> timeline = new LinkedList<Double>();
33  
-    timeline.add(new Double(0.1));
34  
-    timeline.add(new Double(0.1));
  33
+
  34
+    for (int i = 0; i < TIMELINE_LENGTH; i++) {
  35
+      timeline.add(createRandomeData());
  36
+    }
35 37
 
36 38
     JSONObject channel1 = new JSONObject();
37  
-    channel1.put("channel1", timeline);
  39
+    channel1.put("ch1", timeline);
38 40
     return channel1;
39 41
   }
  42
+
  43
+  private static Double createRandomeData() {
  44
+    return new Double(Math.random() * 10);
  45
+  }
40 46
 }
22  src/test/java/com/github/dann/wspusher/websocket/DataPusherWebSocketServletTest.java
... ...
@@ -1,17 +1,15 @@
1 1
 /*
2 2
  * Copyright 2012 Dann.
3  
- *
4  
- * Licensed under the Apache License, Version 2.0 (the "License");
5  
- * you may not use this file except in compliance with the License.
6  
- * You may obtain a copy of the License at
7  
- *
8  
- *     http://www.apache.org/licenses/LICENSE-2.0
9  
- *
10  
- * Unless required by applicable law or agreed to in writing, software
11  
- * distributed under the License is distributed on an "AS IS" BASIS,
12  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  
- * either express or implied. See the License for the specific language
14  
- * governing permissions and limitations under the License.
  3
+ * 
  4
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  5
+ * in compliance with the License. You may obtain a copy of the License at
  6
+ * 
  7
+ * http://www.apache.org/licenses/LICENSE-2.0
  8
+ * 
  9
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
  10
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  11
+ * or implied. See the License for the specific language governing permissions and limitations under
  12
+ * the License.
15 13
  */
16 14
 package com.github.dann.wspusher.websocket;
17 15
 

0 notes on commit 013ac47

Please sign in to comment.
Something went wrong with that request. Please try again.