You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devicemap.apache.org by re...@apache.org on 2014/07/18 14:57:40 UTC

svn commit: r1611633 [2/4] - in /incubator/devicemap/branches/devicemap-java-client-1.0.1: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/devicemap/ src/main/java/org/apache/devicemap/cmd/ src/mai...

Added: incubator/devicemap/branches/devicemap-java-client-1.0.1/src/test/java/org/apache/devicemap/DeviceMapClientUrlTestOptional.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/branches/devicemap-java-client-1.0.1/src/test/java/org/apache/devicemap/DeviceMapClientUrlTestOptional.java?rev=1611633&view=auto
==============================================================================
--- incubator/devicemap/branches/devicemap-java-client-1.0.1/src/test/java/org/apache/devicemap/DeviceMapClientUrlTestOptional.java (added)
+++ incubator/devicemap/branches/devicemap-java-client-1.0.1/src/test/java/org/apache/devicemap/DeviceMapClientUrlTestOptional.java Fri Jul 18 12:57:38 2014
@@ -0,0 +1,54 @@
+/*
+ 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.devicemap;
+
+import java.util.Map;
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.apache.devicemap.loader.LoaderOption;
+
+public class DeviceMapClientUrlTestOptional {
+
+    @Test
+    public void DeviceMapClientUrlTest() throws Exception {
+        DeviceMapClient client = new DeviceMapClient();
+
+        client.initDeviceData(LoaderOption.URL);
+
+        String test = "Mozilla/5.0 (Linux; U; Android 2.2; en; HTC Aria A6380 Build/ERE27) AppleWebKit/540.13+ (KHTML, like Gecko) Version/3.1 Mobile Safari/524.15.0";
+
+        Map<String, String> m = client.classify(test);
+
+        Assert.assertEquals("test ua not htc aria", "HTC Aria", m.get("id"));
+    }
+    
+    @Test
+    public void DeviceMapClientCustomUrlTest() throws Exception {
+        DeviceMapClient client = new DeviceMapClient();
+
+        client.initDeviceData(LoaderOption.URL, "http://www.rezsoft.org/dmap-data/");
+
+        String test = "Mozilla/5.0 (Linux; U; Android 2.2; en; HTC Aria A6380 Build/ERE27) AppleWebKit/540.13+ (KHTML, like Gecko) Version/3.1 Mobile Safari/524.15.0";
+
+        Map<String, String> m = client.classify(test);
+
+        Assert.assertEquals("test ua not htc aria", "HTC Aria", m.get("id"));
+    }
+}

Propchange: incubator/devicemap/branches/devicemap-java-client-1.0.1/src/test/java/org/apache/devicemap/DeviceMapClientUrlTestOptional.java
------------------------------------------------------------------------------
    svn:executable = *