Package net.sf.uadetector.internal.data.domain

Examples of net.sf.uadetector.internal.data.domain.Device


        b.setPatterns(patterns);
      }
    }

    // create device
    Device d = null;
    try {
      // build
      d = b.build();

      // check hash when option is set
View Full Code Here


  }

  @Nullable
  public Device findDevice(@Nonnull final String hash) {
    Check.notEmpty(hash, "hash");
    final Device d = devices.get(hash);
    if (d == null) {
      addWarning("Can not find device for hash '" + hash + "'.");
    }
    return d;
  }
View Full Code Here

    final String icon = "icon";
    final String infoUrl = "info url";
    final SortedSet<DevicePattern> patterns = new TreeSet<DevicePattern>();
    patterns.add(new DevicePattern(1, Pattern.compile("[0-9]"), 1));
    patterns.add(new DevicePattern(2, Pattern.compile("[a-z]"), 2));
    return new Device(name, id, category, icon, infoUrl, patterns);
  }
View Full Code Here

    final TreeSet<DevicePattern> devicePatternSet = Sets.newTreeSet();
    final DevicePattern devicePattern = new DevicePattern(1, Pattern.compile("[a-z]+"), 1);
    devicePatternSet.add(devicePattern);
    devicePatterns.put(1, devicePatternSet);

    final Device device = new Device("device-category-name", 1, Category.OTHER, "device.png", "device-info", devicePatternSet);
    devices.add(device);

    patternToDeviceMap.put(devicePattern, device);

    final Robot robot = new Robot(12, "Majestic-12", UserAgentFamily.MJ12BOT, "Majestic-12 bot", "http://majestic12.co.uk/bot.php",
View Full Code Here

    assertThat(a.hashCode() == b.hashCode()).isFalse();
  }

  @Test
  public void equals_different_DEVICES() {
    final Device device1 = new Device("dev1", 123, Category.OTHER, "icon", "infoUrl", new TreeSet<DevicePattern>());
    final Data a = new DataBlueprint().devices(Sets.newHashSet(device1)).build();

    final Device device2 = new Device("dev2", 234, Category.OTHER, "icon", "infoUrl", new TreeSet<DevicePattern>());
    final Data b = new DataBlueprint().devices(Sets.newHashSet(device2)).build();

    assertThat(a.equals(b)).isFalse();
    assertThat(a.hashCode() == b.hashCode()).isFalse();
  }
View Full Code Here

  }

  @Test
  public void equals_different_PATTERNTODEVICEMAP() {
    final DevicePattern pattern1 = new DevicePattern(1, Pattern.compile("1"), 1);
    final Device device1 = new Device("dev1", 234, Category.OTHER, "icon", "infoUrl", new TreeSet<DevicePattern>());
    final SortedMap<DevicePattern, Device> map1 = Maps.newTreeMap();
    map1.put(pattern1, device1);
    final Data a = new DataBlueprint().patternToDeviceMap(map1).build();

    final DevicePattern pattern2 = new DevicePattern(1, Pattern.compile("2"), 1);
    final Device device2 = new Device("dev2", 235, Category.OTHER, "icon", "infoUrl", new TreeSet<DevicePattern>());
    final SortedMap<DevicePattern, Device> map2 = Maps.newTreeMap();
    map2.put(pattern2, device2);
    final Data b = new DataBlueprint().patternToDeviceMap(map2).build();

    assertThat(a.equals(b)).isFalse();
View Full Code Here

TOP

Related Classes of net.sf.uadetector.internal.data.domain.Device

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.