Package ua_parser

Examples of ua_parser.Parser


public class UserAgentMorphlineTest extends AbstractMorphlineTest {

  @Test
  public void testRawAPI() throws Exception {
    String userAgentStr = "Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3";
    Client client = new Parser().parse(userAgentStr);

    assertEquals("Mobile Safari", client.userAgent.family);
    assertEquals("5", client.userAgent.major);
    assertEquals("1", client.userAgent.minor);
    assertNull(client.userAgent.patch);
View Full Code Here


 

  @Test
  public void testRawAPIWithUnknownUserAgent() throws Exception {
    String userAgentStr = "fp@$%3489jvp#3E";
    Client client = new Parser().parse(userAgentStr);
   
    assertNotNull(client);
    assertEquals("Other", client.userAgent.family);
    assertNull(client.userAgent.major);
    assertNull(client.userAgent.minor);
View Full Code Here

      this.inputFieldName = getConfigs().getString(config, "inputField");
      String databaseFile = getConfigs().getString(config, "database", null);
      int cacheCapacity = getConfigs().getInt(config, "cacheCapacity", 1000);
      String nullReplacement = getConfigs().getString(config, "nullReplacement", "");

      Parser parser;
      try {
        if (databaseFile == null) {
          parser = new Parser();
        } else {
          InputStream in = new BufferedInputStream(new FileInputStream(databaseFile));
          try {
            parser = new Parser(in);
          } finally {
            Closeables.closeQuietly(in);
          }
        }       
      } catch (IOException e) {
View Full Code Here

public class UserAgentMorphlineTest extends AbstractMorphlineTest {

  @Test
  public void testRawAPI() throws Exception {
    String userAgentStr = "Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3";
    Client client = new Parser().parse(userAgentStr);

    assertEquals("Mobile Safari", client.userAgent.family);
    assertEquals("5", client.userAgent.major);
    assertEquals("1", client.userAgent.minor);
    assertNull(client.userAgent.patch);
View Full Code Here

 

  @Test
  public void testRawAPIWithUnknownUserAgent() throws Exception {
    String userAgentStr = "fp@$%3489jvp#3E";
    Client client = new Parser().parse(userAgentStr);
   
    assertNotNull(client);
    assertEquals("Other", client.userAgent.family);
    assertNull(client.userAgent.major);
    assertNull(client.userAgent.minor);
View Full Code Here

      this.inputFieldName = getConfigs().getString(config, "inputField");
      String databaseFile = getConfigs().getString(config, "database", null);
      int cacheCapacity = getConfigs().getInt(config, "cacheCapacity", 1000);
      String nullReplacement = getConfigs().getString(config, "nullReplacement", "");

      Parser parser;
      try {
        if (databaseFile == null) {
          parser = new Parser();
        } else {
          InputStream in = new BufferedInputStream(new FileInputStream(databaseFile));
          try {
            parser = new Parser(in);
          } finally {
            Closeables.closeQuietly(in);
          }
        }       
      } catch (IOException e) {
View Full Code Here

TOP

Related Classes of ua_parser.Parser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.