Package net.sf.uadetector

Examples of net.sf.uadetector.UserAgent


  }

  @Test
  public void parse_browser_BLACKBERRY_9000() throws Exception {
    final String userAgent = "BlackBerry 9000: BlackBerry9000/4.6.0.65 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/102";
    final UserAgent agent = PARSER.parse(userAgent);
    assertThat(agent).isNotNull();

    // check user agent informations
    assertThat(agent.getFamily()).isEqualTo(UserAgentFamily.BLACKBERRY_BROWSER);
    assertThat(agent.getName()).isEqualTo("BlackBerry Browser");
    assertThat(agent.getProducer()).isEqualTo("Research In Motion Limited");
    assertThat(agent.getProducerUrl()).isEqualTo("http://www.rim.com/");
    assertThat(agent.getTypeName()).isEqualTo("Mobile Browser");
    assertThat(agent.getUrl()).isEqualTo("http://www.blackberry.com/");
    assertThat(agent.getVersionNumber().toVersionString()).isEqualTo("");

    // check operating system informations
    final OperatingSystem os = agent.getOperatingSystem();
    assertThat(os.getFamily()).isEqualTo(OperatingSystemFamily.BLACKBERRY_OS);
    assertThat(os.getFamilyName()).isEqualTo("BlackBerry OS");
    assertThat(os.getName()).isEqualTo("BlackBerry OS");
    assertThat(os.getProducer()).isEqualTo("BlackBerry Ltd");
    assertThat(os.getProducerUrl()).isEqualTo("http://www.blackberry.com/");
    assertThat(os.getUrl()).isEqualTo("http://en.wikipedia.org/wiki/BlackBerry_OS");

    // check device category informations
    final DeviceCategory category = agent.getDeviceCategory();
    assertThat(category.getCategory()).isEqualTo(Category.SMARTPHONE);
    assertThat(category.getName()).isEqualTo(Category.SMARTPHONE.getName());
    assertThat(category.getIcon()).isEqualTo("phone.png");
    assertThat(category.getInfoUrl()).isEqualTo("/list-of-ua/device-detail?device=Smartphone");
  }
View Full Code Here


  }

  @Test
  public void parse_browser_BLACKBERRY_9900() throws Exception {
    final String userAgent = "Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.346 Mobile Safari/534.11+";
    final UserAgent agent = PARSER.parse(userAgent);
    assertThat(agent).isNotNull();

    // check user agent informations
    assertThat(agent.getFamily()).isEqualTo(UserAgentFamily.BLACKBERRY_BROWSER);
    assertThat(agent.getName()).isEqualTo("BlackBerry Browser");
    assertThat(agent.getProducer()).isEqualTo("Research In Motion Limited");
    assertThat(agent.getProducerUrl()).isEqualTo("http://www.rim.com/");
    assertThat(agent.getTypeName()).isEqualTo("Mobile Browser");
    assertThat(agent.getUrl()).isEqualTo("http://www.blackberry.com/");
    assertThat(agent.getVersionNumber().toVersionString()).isEqualTo("");

    // check operating system informations
    final OperatingSystem os = agent.getOperatingSystem();
    assertThat(os.getFamily()).isEqualTo(OperatingSystemFamily.BLACKBERRY_OS);
    assertThat(os.getFamilyName()).isEqualTo("BlackBerry OS");
    assertThat(os.getName()).isEqualTo("BlackBerry OS");
    assertThat(os.getProducer()).isEqualTo("BlackBerry Ltd");
    assertThat(os.getProducerUrl()).isEqualTo("http://www.blackberry.com/");
    assertThat(os.getUrl()).isEqualTo("http://en.wikipedia.org/wiki/BlackBerry_OS");

    // check device category informations
    final DeviceCategory category = agent.getDeviceCategory();
    assertThat(category.getCategory()).isEqualTo(Category.SMARTPHONE);
    assertThat(category.getName()).isEqualTo(Category.SMARTPHONE.getName());
    assertThat(category.getIcon()).isEqualTo("phone.png");
    assertThat(category.getInfoUrl()).isEqualTo("/list-of-ua/device-detail?device=Smartphone");
  }
View Full Code Here

  }

  @Test
  public void parse_browser_CHROME() throws Exception {
    final String userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1";
    final UserAgent agent = PARSER.parse(userAgent);
    assertThat(agent).isNotNull();

    // check user agent informations
    assertThat(agent.getFamily()).isEqualTo(UserAgentFamily.CHROME);
    assertThat(agent.getName()).isEqualTo("Chrome");
    assertThat(agent.getProducer()).isEqualTo("Google Inc.");
    assertThat(agent.getProducerUrl()).isEqualTo("http://www.google.com/");
    assertThat(agent.getTypeName()).isEqualTo("Browser");
    assertThat(agent.getUrl()).isEqualTo("http://www.google.com/chrome");
    assertThat(agent.getVersionNumber().toVersionString()).isEqualTo("13.0.782.112");

    // check operating system informations
    final OperatingSystem os = agent.getOperatingSystem();
    assertThat(os.getFamily()).isEqualTo(OperatingSystemFamily.OS_X);
    assertThat(os.getFamilyName()).isEqualTo("OS X");
    assertThat(os.getName()).isEqualTo("OS X 10.6 Snow Leopard");
    assertThat(os.getProducer()).isEqualTo("Apple Computer, Inc.");
    assertThat(os.getProducerUrl()).isEqualTo("http://www.apple.com/");
    assertThat(os.getUrl()).isEqualTo("http://www.apple.com/osx/");

    // check device category informations
    final DeviceCategory category = agent.getDeviceCategory();
    assertThat(category.getCategory()).isEqualTo(Category.PERSONAL_COMPUTER);
    assertThat(category.getName()).isEqualTo(Category.PERSONAL_COMPUTER.getName());
    assertThat(category.getIcon()).isEqualTo("desktop.png");
    assertThat(category.getInfoUrl()).isEqualTo("/list-of-ua/device-detail?device=Personal computer");
  }
View Full Code Here

  }

  @Test
  public void parse_browser_CHROME_withoutVersionInfo() throws Exception {
    final String userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/$ Safari/535.1";
    final UserAgent agent = PARSER.parse(userAgent);
    assertThat(agent).isNotNull();

    // check user agent informations
    assertThat(agent.getFamily()).isEqualTo(UserAgentFamily.SAFARI);
    assertThat(agent.getName()).isEqualTo("Safari");
    assertThat(agent.getProducer()).isEqualTo("Apple Inc.");
    assertThat(agent.getProducerUrl()).isEqualTo("http://www.apple.com/");
    assertThat(agent.getTypeName()).isEqualTo("Browser");
    assertThat(agent.getUrl()).isEqualTo("http://en.wikipedia.org/wiki/Safari_%28web_browser%29");

    // check operating system informations
    final OperatingSystem os = agent.getOperatingSystem();
    assertThat(os.getFamily()).isEqualTo(OperatingSystemFamily.OS_X);
    assertThat(os.getFamilyName()).isEqualTo("OS X");
    assertThat(os.getName()).isEqualTo("OS X 10.6 Snow Leopard");
    assertThat(os.getProducer()).isEqualTo("Apple Computer, Inc.");
    assertThat(os.getProducerUrl()).isEqualTo("http://www.apple.com/");
    assertThat(os.getUrl()).isEqualTo("http://www.apple.com/osx/");

    // check device category informations
    final DeviceCategory category = agent.getDeviceCategory();
    assertThat(category.getCategory()).isEqualTo(Category.PERSONAL_COMPUTER);
    assertThat(category.getName()).isEqualTo(Category.PERSONAL_COMPUTER.getName());
    assertThat(category.getIcon()).isEqualTo("desktop.png");
    assertThat(category.getInfoUrl()).isEqualTo("/list-of-ua/device-detail?device=Personal computer");
  }
View Full Code Here

  }

  @Test
  public void parse_browser_CHROME13() throws Exception {
    final String userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1";
    final UserAgent agent = PARSER.parse(userAgent);
    assertThat(agent).isNotNull();

    // check user agent informations
    assertThat(agent.getFamily()).isEqualTo(UserAgentFamily.CHROME);
    assertThat(agent.getIcon()).isEqualTo("chrome.png");
    assertThat(agent.getName()).isEqualTo("Chrome");
    assertThat(agent.getProducer()).isEqualTo("Google Inc.");
    assertThat(agent.getProducerUrl()).isEqualTo("http://www.google.com/");
    assertThat(agent.getType()).isEqualTo(UserAgentType.BROWSER);
    assertThat(agent.getTypeName()).isEqualTo("Browser");
    assertThat(agent.getUrl()).isEqualTo("http://www.google.com/chrome");
    assertThat(agent.getVersionNumber().toVersionString()).isEqualTo("13.0.782.112");

    // check operating system informations
    final OperatingSystem os = agent.getOperatingSystem();
    assertThat(os.getFamily()).isEqualTo(OperatingSystemFamily.OS_X);
    assertThat(os.getFamilyName()).isEqualTo("OS X");
    assertThat(os.getIcon()).isEqualTo("macosx.png");
    assertThat(os.getName()).isEqualTo("OS X 10.6 Snow Leopard");
    assertThat(os.getProducer()).isEqualTo("Apple Computer, Inc.");
    assertThat(os.getProducerUrl()).isEqualTo("http://www.apple.com/");
    assertThat(os.getUrl()).isEqualTo("http://www.apple.com/osx/");
    assertThat(os.getVersionNumber().toVersionString()).isEqualTo("10.6.8");

    // check device category informations
    final DeviceCategory category = agent.getDeviceCategory();
    assertThat(category.getCategory()).isEqualTo(Category.PERSONAL_COMPUTER);
    assertThat(category.getName()).isEqualTo(Category.PERSONAL_COMPUTER.getName());
    assertThat(category.getIcon()).isEqualTo("desktop.png");
    assertThat(category.getInfoUrl()).isEqualTo("/list-of-ua/device-detail?device=Personal computer");
  }
View Full Code Here

  }

  @Test
  public void parse_browser_CHROME19() throws Exception {
    final String userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5";
    final UserAgent agent = PARSER.parse(userAgent);
    assertThat(agent).isNotNull();

    // check user agent informations
    assertThat(agent.getFamily()).isEqualTo(UserAgentFamily.CHROME);
    assertThat(agent.getIcon()).isEqualTo("chrome.png");
    assertThat(agent.getName()).isEqualTo("Chrome");
    assertThat(agent.getProducer()).isEqualTo("Google Inc.");
    assertThat(agent.getProducerUrl()).isEqualTo("http://www.google.com/");
    assertThat(agent.getType()).isEqualTo(UserAgentType.BROWSER);
    assertThat(agent.getTypeName()).isEqualTo("Browser");
    assertThat(agent.getUrl()).isEqualTo("http://www.google.com/chrome");
    assertThat(agent.getVersionNumber().toVersionString()).isEqualTo("19.0.1084.46");

    // check operating system informations
    final OperatingSystem os = agent.getOperatingSystem();
    assertThat(os.getFamily()).isEqualTo(OperatingSystemFamily.OS_X);
    assertThat(os.getFamilyName()).isEqualTo("OS X");
    assertThat(os.getIcon()).isEqualTo("macosx.png");
    assertThat(os.getName()).isEqualTo("OS X 10.7 Lion");
    assertThat(os.getProducer()).isEqualTo("Apple Computer, Inc.");
    assertThat(os.getProducerUrl()).isEqualTo("http://www.apple.com/");
    assertThat(os.getUrl()).isEqualTo("http://www.apple.com/osx/");
    assertThat(os.getVersionNumber().toVersionString()).isEqualTo("10.7.4");

    // check device category informations
    final DeviceCategory category = agent.getDeviceCategory();
    assertThat(category.getCategory()).isEqualTo(Category.PERSONAL_COMPUTER);
    assertThat(category.getName()).isEqualTo(Category.PERSONAL_COMPUTER.getName());
    assertThat(category.getIcon()).isEqualTo("desktop.png");
    assertThat(category.getInfoUrl()).isEqualTo("/list-of-ua/device-detail?device=Personal computer");
  }
View Full Code Here

  }

  @Test
  public void parse_browser_EUDORA() throws Exception {
    final String userAgent = "Eudora";
    final UserAgent agent = PARSER.parse(userAgent);
    assertThat(agent).isNotNull();
    assertThat(OperatingSystem.EMPTY.equals(agent.getOperatingSystem())).isTrue();

    // check user agent informations
    assertThat(agent.getFamily()).isEqualTo(UserAgentFamily.EUDORA);
    assertThat(agent.getIcon()).isEqualTo("eudora.png");
    assertThat(agent.getName()).isEqualTo("Eudora");
    assertThat(agent.getProducer()).isEqualTo("Qualcomm Incorporated.");
    assertThat(agent.getProducerUrl()).isEqualTo("http://www.qualcomm.com/");
    assertThat(agent.getType()).isEqualTo(UserAgentType.EMAIL_CLIENT);
    assertThat(agent.getTypeName()).isEqualTo("Email client");
    assertThat(agent.getUrl()).isEqualTo("http://www.eudora.com/archive.html");
    assertThat(agent.getVersionNumber().toVersionString()).isEqualTo("");

    // check device category informations
    final DeviceCategory category = agent.getDeviceCategory();
    assertThat(category.getCategory()).isEqualTo(Category.PERSONAL_COMPUTER);
    assertThat(category.getName()).isEqualTo(Category.PERSONAL_COMPUTER.getName());
    assertThat(category.getIcon()).isEqualTo("desktop.png");
    assertThat(category.getInfoUrl()).isEqualTo("/list-of-ua/device-detail?device=Personal computer");
  }
View Full Code Here

  }

  @Test
  public void parse_browser_EUDORA_withVersion() throws Exception {
    final String userAgent = "Eudora/6.2.4b8 (MacOS)";
    final UserAgent agent = PARSER.parse(userAgent);
    assertThat(agent).isNotNull();

    // check user agent informations
    assertThat(agent.getFamily()).isEqualTo(UserAgentFamily.EUDORA);
    assertThat(agent.getIcon()).isEqualTo("eudora.png");
    assertThat(agent.getName()).isEqualTo("Eudora");
    assertThat(agent.getProducer()).isEqualTo("Qualcomm Incorporated.");
    assertThat(agent.getProducerUrl()).isEqualTo("http://www.qualcomm.com/");
    assertThat(agent.getType()).isEqualTo(UserAgentType.EMAIL_CLIENT);
    assertThat(agent.getTypeName()).isEqualTo("Email client");
    assertThat(agent.getUrl()).isEqualTo("http://www.eudora.com/archive.html");
    assertThat(agent.getVersionNumber().toVersionString()).isEqualTo("6.2.4b8");

    // check operating system informations
    final OperatingSystem os = agent.getOperatingSystem();
    assertThat(os.getFamily()).isEqualTo(OperatingSystemFamily.MAC_OS);
    assertThat(os.getFamilyName()).isEqualTo("Mac OS");
    assertThat(os.getIcon()).isEqualTo("macos.png");
    assertThat(os.getName()).isEqualTo("Mac OS");
    assertThat(os.getProducer()).isEqualTo("Apple Computer, Inc.");
    assertThat(os.getProducerUrl()).isEqualTo("http://www.apple.com/");
    assertThat(os.getUrl()).isEqualTo("http://en.wikipedia.org/wiki/Mac_OS");
    assertThat(os.getVersionNumber().toVersionString()).isEqualTo("");

    // check device category informations
    final DeviceCategory category = agent.getDeviceCategory();
    assertThat(category.getCategory()).isEqualTo(Category.PERSONAL_COMPUTER);
    assertThat(category.getName()).isEqualTo(Category.PERSONAL_COMPUTER.getName());
    assertThat(category.getIcon()).isEqualTo("desktop.png");
    assertThat(category.getInfoUrl()).isEqualTo("/list-of-ua/device-detail?device=Personal computer");
  }
View Full Code Here

  }

  @Test
  public void parse_browser_FIREFOX6() throws Exception {
    final String userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:6.0) Gecko/20100101 Firefox/6.0";
    final UserAgent agent = PARSER.parse(userAgent);
    assertThat(agent).isNotNull();

    // check user agent informations
    assertThat(agent.getFamily()).isEqualTo(UserAgentFamily.FIREFOX);
    assertThat(agent.getIcon()).isEqualTo("firefox.png");
    assertThat(agent.getName()).isEqualTo("Firefox");
    assertThat(agent.getProducer()).isEqualTo("Mozilla Foundation");
    assertThat(agent.getProducerUrl()).isEqualTo("http://www.mozilla.org/");
    assertThat(agent.getType()).isEqualTo(UserAgentType.BROWSER);
    assertThat(agent.getTypeName()).isEqualTo("Browser");
    assertThat(agent.getUrl()).isEqualTo("http://www.firefox.com/");
    assertThat(agent.getVersionNumber().toVersionString()).isEqualTo("6.0");

    // check operating system informations
    final OperatingSystem os = agent.getOperatingSystem();
    assertThat(os.getFamily()).isEqualTo(OperatingSystemFamily.OS_X);
    assertThat(os.getFamilyName()).isEqualTo("OS X");
    assertThat(os.getIcon()).isEqualTo("macosx.png");
    assertThat(os.getName()).isEqualTo("OS X 10.7 Lion");
    assertThat(os.getProducer()).isEqualTo("Apple Computer, Inc.");
    assertThat(os.getProducerUrl()).isEqualTo("http://www.apple.com/");
    assertThat(os.getUrl()).isEqualTo("http://www.apple.com/osx/");
    assertThat(os.getVersionNumber().toVersionString()).isEqualTo("10.7");

    // check device category informations
    final DeviceCategory category = agent.getDeviceCategory();
    assertThat(category.getCategory()).isEqualTo(Category.PERSONAL_COMPUTER);
    assertThat(category.getName()).isEqualTo(Category.PERSONAL_COMPUTER.getName());
    assertThat(category.getIcon()).isEqualTo("desktop.png");
    assertThat(category.getInfoUrl()).isEqualTo("/list-of-ua/device-detail?device=Personal computer");
  }
View Full Code Here

  }

  @Test
  public void parse_browser_ICEWEASEL() throws Exception {
    final String userAgent = "Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.1.5) Gecko/20091112 Iceweasel/3.5.5 (like Firefox/3.5.5; Debian-3.5.5-1)";
    final UserAgent agent = PARSER.parse(userAgent);
    assertThat(agent).isNotNull();

    // check user agent informations
    assertThat(agent.getFamily()).isEqualTo(UserAgentFamily.ICEWEASEL);
    assertThat(agent.getIcon()).isEqualTo("iceweasel.png");
    assertThat(agent.getName()).isEqualTo("IceWeasel");
    assertThat(agent.getProducer()).isEqualTo("Software in the Public Interest, Inc.");
    assertThat(agent.getProducerUrl()).isEqualTo("http://www.spi-inc.org/");
    assertThat(agent.getType()).isEqualTo(UserAgentType.BROWSER);
    assertThat(agent.getTypeName()).isEqualTo("Browser");
    assertThat(agent.getUrl()).isEqualTo("http://www.gnu.org/software/gnuzilla/");
    assertThat(agent.getVersionNumber().toVersionString()).isEqualTo("3.5.5");

    // check operating system informations
    final OperatingSystem os = agent.getOperatingSystem();
    assertThat(os.getFamily()).isEqualTo(OperatingSystemFamily.LINUX);
    assertThat(os.getFamilyName()).isEqualTo("Linux");
    assertThat(os.getIcon()).isEqualTo("linux_debian.png");
    assertThat(os.getName()).isEqualTo("Linux (Debian)");
    assertThat(os.getProducer()).isEqualTo("Software in the Public Interest, Inc.");
    assertThat(os.getProducerUrl()).isEqualTo("http://www.spi-inc.org/");
    assertThat(os.getUrl()).isEqualTo("http://www.debian.org/");
    assertThat(os.getVersionNumber()).isEqualTo(VersionNumber.UNKNOWN);

    // check device category informations
    final DeviceCategory category = agent.getDeviceCategory();
    assertThat(category.getCategory()).isEqualTo(Category.PERSONAL_COMPUTER);
    assertThat(category.getName()).isEqualTo(Category.PERSONAL_COMPUTER.getName());
    assertThat(category.getIcon()).isEqualTo("desktop.png");
    assertThat(category.getInfoUrl()).isEqualTo("/list-of-ua/device-detail?device=Personal computer");
  }
View Full Code Here

TOP

Related Classes of net.sf.uadetector.UserAgent

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.