target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testAction() throws IOException{ final Map<String, Object> container = new LinkedHashMap<>(); final Map<String, Object> messageObject = new LinkedHashMap<>(); final Map<String, Object> apnsObject = new LinkedHashMap<>(); apnsObject.put("action", "View"); messageObject.put("alert", "howdy"); messageObj... | public Message getMessage() { return message; } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonStrin... | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonStrin... |
@Test public void testActionCategory() throws IOException { final Map<String, Object> container = new LinkedHashMap<>(); final Map<String, Object> messageObject = new LinkedHashMap<>(); final Map<String, Object> apnsObject = new LinkedHashMap<>(); apnsObject.put("action-category", "POSTS"); messageObject.put("alert", "... | public Message getMessage() { return message; } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonStrin... | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonStrin... |
@Test public void testLocalizedKey() throws IOException { final Map<String, Object> container = new LinkedHashMap<>(); final Map<String, Object> messageObject = new LinkedHashMap<>(); final Map<String, Object> apnsObject = new LinkedHashMap<>(); apnsObject.put("localized-key", "myLocalizedKey"); messageObject.put("aler... | public Message getMessage() { return message; } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonStrin... | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonStrin... |
@Test public void testLocalizedTitleKey() throws IOException { final Map<String, Object> container = new LinkedHashMap<>(); final Map<String, Object> messageObject = new LinkedHashMap<>(); final Map<String, Object> apnsObject = new LinkedHashMap<>(); apnsObject.put("localized-title-key", "myLocalizedTitle"); messageObj... | public Message getMessage() { return message; } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonStrin... | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonStrin... |
@Test public void testMultipleAliasCriteria() throws IOException { final Map<String, Object> container = new LinkedHashMap<>(); final Map<String, Object> messageObject = new LinkedHashMap<>(); messageObject.put("alert", "Howdy"); messageObject.put("sound", "default"); messageObject.put("badge", 2); Map<String, String> ... | public Criteria getCriteria() { return criteria; } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonSt... | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonSt... |
@Test public void testDeviceTypeCriteria() throws IOException { final Map<String, Object> container = new LinkedHashMap<>(); final Map<String, Object> messageObject = new LinkedHashMap<>(); messageObject.put("alert", "Howdy"); messageObject.put("sound", "default"); messageObject.put("badge", 2); Map<String, String> dat... | public Criteria getCriteria() { return criteria; } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonSt... | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonSt... |
@Test public void testDeviceTypesCriteria() throws IOException { final Map<String, Object> container = new LinkedHashMap<>(); final Map<String, Object> messageObject = new LinkedHashMap<>(); messageObject.put("alert", "Howdy"); messageObject.put("sound", "default"); messageObject.put("badge", 2); container.put("message... | public Criteria getCriteria() { return criteria; } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonSt... | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonSt... |
@Test public void testCategoriesCriteria() throws IOException { final Map<String, Object> container = new LinkedHashMap<>(); final Map<String, Object> messageObject = new LinkedHashMap<>(); messageObject.put("alert", "Howdy"); messageObject.put("sound", "default"); messageObject.put("badge", 2); container.put("message"... | public Criteria getCriteria() { return criteria; } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonSt... | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonSt... |
@Test public void testMultipleCategoriesCriteria() throws IOException { final Map<String, Object> container = new LinkedHashMap<>(); final Map<String, Object> messageObject = new LinkedHashMap<>(); messageObject.put("alert", "Howdy"); messageObject.put("sound", "default"); messageObject.put("badge", 2); container.put("... | public Criteria getCriteria() { return criteria; } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonSt... | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonSt... |
@Test public void testEmptyString() { final VariantType andVariantType = VariantType.ANDROID; assertThat(DeviceTokenValidator.isValidDeviceTokenForVariant("", andVariantType)).isFalse(); } | public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVICE_TOKEN.matcher(deviceToken).matches(); case WEB_PUSH: return isWebPushRegistration(d... | DeviceTokenValidator implements ConstraintValidator<DeviceTokenCheck, Installation> { public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVI... | DeviceTokenValidator implements ConstraintValidator<DeviceTokenCheck, Installation> { public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVI... | DeviceTokenValidator implements ConstraintValidator<DeviceTokenCheck, Installation> { public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVI... | DeviceTokenValidator implements ConstraintValidator<DeviceTokenCheck, Installation> { public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVI... |
@Test public void testVariantsCriteria() throws IOException { final Map<String, Object> container = new LinkedHashMap<>(); final Map<String, Object> messageObject = new LinkedHashMap<>(); messageObject.put("alert", "Howdy"); messageObject.put("sound", "default"); messageObject.put("badge", 2); container.put("message", ... | public Criteria getCriteria() { return criteria; } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonSt... | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonSt... |
@Test public void testMultipleVariantsCriteria() throws IOException { final Map<String, Object> container = new LinkedHashMap<>(); final Map<String, Object> messageObject = new LinkedHashMap<>(); messageObject.put("alert", "Howdy"); messageObject.put("sound", "default"); messageObject.put("badge", 2); container.put("me... | public Criteria getCriteria() { return criteria; } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } } | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonSt... | UnifiedPushMessage implements Serializable { public Criteria getCriteria() { return criteria; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonSt... |
@Test public void testMessageToStrippedJson() throws IOException, URISyntaxException { final Map<String, Object> container = new LinkedHashMap<>(); final Map<String, Object> messageObject = new LinkedHashMap<>(); final Map<String, Object> apnsObject = new LinkedHashMap<>(); messageObject.put("alert", "HELLO!"); message... | public String toStrippedJsonString() { try { final Map<String, Object> json = new LinkedHashMap<>(); json.put("alert", this.message.getAlert()); json.put("priority", this.message.getPriority().toString()); if (this.getMessage().getBadge()>0) { json.put("badge", Integer.toString(this.getMessage().getBadge())); } json.pu... | UnifiedPushMessage implements Serializable { public String toStrippedJsonString() { try { final Map<String, Object> json = new LinkedHashMap<>(); json.put("alert", this.message.getAlert()); json.put("priority", this.message.getPriority().toString()); if (this.getMessage().getBadge()>0) { json.put("badge", Integer.toStr... | UnifiedPushMessage implements Serializable { public String toStrippedJsonString() { try { final Map<String, Object> json = new LinkedHashMap<>(); json.put("alert", this.message.getAlert()); json.put("priority", this.message.getPriority().toString()); if (this.getMessage().getBadge()>0) { json.put("badge", Integer.toStr... | UnifiedPushMessage implements Serializable { public String toStrippedJsonString() { try { final Map<String, Object> json = new LinkedHashMap<>(); json.put("alert", this.message.getAlert()); json.put("priority", this.message.getPriority().toString()); if (this.getMessage().getBadge()>0) { json.put("badge", Integer.toStr... | UnifiedPushMessage implements Serializable { public String toStrippedJsonString() { try { final Map<String, Object> json = new LinkedHashMap<>(); json.put("alert", this.message.getAlert()); json.put("priority", this.message.getPriority().toString()); if (this.getMessage().getBadge()>0) { json.put("badge", Integer.toStr... |
@Test public void testMessageToJson() throws IOException, URISyntaxException { final Map<String, Object> container = new LinkedHashMap<>(); final Map<String, Object> messageObject = new LinkedHashMap<>(); final Map<String, Object> apnsObject = new LinkedHashMap<>(); messageObject.put("alert", "HELLO!"); messageObject.p... | public String toStrippedJsonString() { try { final Map<String, Object> json = new LinkedHashMap<>(); json.put("alert", this.message.getAlert()); json.put("priority", this.message.getPriority().toString()); if (this.getMessage().getBadge()>0) { json.put("badge", Integer.toString(this.getMessage().getBadge())); } json.pu... | UnifiedPushMessage implements Serializable { public String toStrippedJsonString() { try { final Map<String, Object> json = new LinkedHashMap<>(); json.put("alert", this.message.getAlert()); json.put("priority", this.message.getPriority().toString()); if (this.getMessage().getBadge()>0) { json.put("badge", Integer.toStr... | UnifiedPushMessage implements Serializable { public String toStrippedJsonString() { try { final Map<String, Object> json = new LinkedHashMap<>(); json.put("alert", this.message.getAlert()); json.put("priority", this.message.getPriority().toString()); if (this.getMessage().getBadge()>0) { json.put("badge", Integer.toStr... | UnifiedPushMessage implements Serializable { public String toStrippedJsonString() { try { final Map<String, Object> json = new LinkedHashMap<>(); json.put("alert", this.message.getAlert()); json.put("priority", this.message.getPriority().toString()); if (this.getMessage().getBadge()>0) { json.put("badge", Integer.toStr... | UnifiedPushMessage implements Serializable { public String toStrippedJsonString() { try { final Map<String, Object> json = new LinkedHashMap<>(); json.put("alert", this.message.getAlert()); json.put("priority", this.message.getPriority().toString()); if (this.getMessage().getBadge()>0) { json.put("badge", Integer.toStr... |
@Test public void verifyAscendingOrderFromNullValue() { assertThat(isAscendingOrder(null)).isTrue(); } | public static Boolean isAscendingOrder(String sorting) { return "desc".equalsIgnoreCase(sorting) ? Boolean.FALSE : Boolean.TRUE; } | CommonUtils { public static Boolean isAscendingOrder(String sorting) { return "desc".equalsIgnoreCase(sorting) ? Boolean.FALSE : Boolean.TRUE; } } | CommonUtils { public static Boolean isAscendingOrder(String sorting) { return "desc".equalsIgnoreCase(sorting) ? Boolean.FALSE : Boolean.TRUE; } private CommonUtils(); } | CommonUtils { public static Boolean isAscendingOrder(String sorting) { return "desc".equalsIgnoreCase(sorting) ? Boolean.FALSE : Boolean.TRUE; } private CommonUtils(); static Boolean isAscendingOrder(String sorting); static String removeDefaultHttpPorts(final String uri); } | CommonUtils { public static Boolean isAscendingOrder(String sorting) { return "desc".equalsIgnoreCase(sorting) ? Boolean.FALSE : Boolean.TRUE; } private CommonUtils(); static Boolean isAscendingOrder(String sorting); static String removeDefaultHttpPorts(final String uri); } |
@Test public void verfiyAscendingOrderFromDescValue() { assertThat(isAscendingOrder("deSc")).isFalse(); assertThat(isAscendingOrder("desc")).isFalse(); assertThat(isAscendingOrder("DESC")).isFalse(); } | public static Boolean isAscendingOrder(String sorting) { return "desc".equalsIgnoreCase(sorting) ? Boolean.FALSE : Boolean.TRUE; } | CommonUtils { public static Boolean isAscendingOrder(String sorting) { return "desc".equalsIgnoreCase(sorting) ? Boolean.FALSE : Boolean.TRUE; } } | CommonUtils { public static Boolean isAscendingOrder(String sorting) { return "desc".equalsIgnoreCase(sorting) ? Boolean.FALSE : Boolean.TRUE; } private CommonUtils(); } | CommonUtils { public static Boolean isAscendingOrder(String sorting) { return "desc".equalsIgnoreCase(sorting) ? Boolean.FALSE : Boolean.TRUE; } private CommonUtils(); static Boolean isAscendingOrder(String sorting); static String removeDefaultHttpPorts(final String uri); } | CommonUtils { public static Boolean isAscendingOrder(String sorting) { return "desc".equalsIgnoreCase(sorting) ? Boolean.FALSE : Boolean.TRUE; } private CommonUtils(); static Boolean isAscendingOrder(String sorting); static String removeDefaultHttpPorts(final String uri); } |
@Test public void verifyAscendingOrderFromAscValue() { assertThat(isAscendingOrder("foo")).isTrue(); assertThat(isAscendingOrder("AsC")).isTrue(); } | public static Boolean isAscendingOrder(String sorting) { return "desc".equalsIgnoreCase(sorting) ? Boolean.FALSE : Boolean.TRUE; } | CommonUtils { public static Boolean isAscendingOrder(String sorting) { return "desc".equalsIgnoreCase(sorting) ? Boolean.FALSE : Boolean.TRUE; } } | CommonUtils { public static Boolean isAscendingOrder(String sorting) { return "desc".equalsIgnoreCase(sorting) ? Boolean.FALSE : Boolean.TRUE; } private CommonUtils(); } | CommonUtils { public static Boolean isAscendingOrder(String sorting) { return "desc".equalsIgnoreCase(sorting) ? Boolean.FALSE : Boolean.TRUE; } private CommonUtils(); static Boolean isAscendingOrder(String sorting); static String removeDefaultHttpPorts(final String uri); } | CommonUtils { public static Boolean isAscendingOrder(String sorting) { return "desc".equalsIgnoreCase(sorting) ? Boolean.FALSE : Boolean.TRUE; } private CommonUtils(); static Boolean isAscendingOrder(String sorting); static String removeDefaultHttpPorts(final String uri); } |
@Test public void httpsPorts() { assertThat(removeDefaultHttpPorts("https: assertThat(removeDefaultHttpPorts("https: assertThat(removeDefaultHttpPorts("https: assertThat(removeDefaultHttpPorts("localhost/auth")).isNull(); } | public static String removeDefaultHttpPorts(final String uri) { URL url; try { url = new URL(uri); if (url.getPort() == url.getDefaultPort()) { String urlPort = ":" + url.getPort(); return url.toExternalForm().replace(urlPort, ""); } } catch (MalformedURLException e) { return null; } return url.toExternalForm(); } | CommonUtils { public static String removeDefaultHttpPorts(final String uri) { URL url; try { url = new URL(uri); if (url.getPort() == url.getDefaultPort()) { String urlPort = ":" + url.getPort(); return url.toExternalForm().replace(urlPort, ""); } } catch (MalformedURLException e) { return null; } return url.toExternal... | CommonUtils { public static String removeDefaultHttpPorts(final String uri) { URL url; try { url = new URL(uri); if (url.getPort() == url.getDefaultPort()) { String urlPort = ":" + url.getPort(); return url.toExternalForm().replace(urlPort, ""); } } catch (MalformedURLException e) { return null; } return url.toExternal... | CommonUtils { public static String removeDefaultHttpPorts(final String uri) { URL url; try { url = new URL(uri); if (url.getPort() == url.getDefaultPort()) { String urlPort = ":" + url.getPort(); return url.toExternalForm().replace(urlPort, ""); } } catch (MalformedURLException e) { return null; } return url.toExternal... | CommonUtils { public static String removeDefaultHttpPorts(final String uri) { URL url; try { url = new URL(uri); if (url.getPort() == url.getDefaultPort()) { String urlPort = ":" + url.getPort(); return url.toExternalForm().replace(urlPort, ""); } } catch (MalformedURLException e) { return null; } return url.toExternal... |
@Test public void httpPorts() { assertThat(removeDefaultHttpPorts("http: assertThat(removeDefaultHttpPorts("http: assertThat(removeDefaultHttpPorts("http: assertThat(removeDefaultHttpPorts("localhost/auth")).isNull(); } | public static String removeDefaultHttpPorts(final String uri) { URL url; try { url = new URL(uri); if (url.getPort() == url.getDefaultPort()) { String urlPort = ":" + url.getPort(); return url.toExternalForm().replace(urlPort, ""); } } catch (MalformedURLException e) { return null; } return url.toExternalForm(); } | CommonUtils { public static String removeDefaultHttpPorts(final String uri) { URL url; try { url = new URL(uri); if (url.getPort() == url.getDefaultPort()) { String urlPort = ":" + url.getPort(); return url.toExternalForm().replace(urlPort, ""); } } catch (MalformedURLException e) { return null; } return url.toExternal... | CommonUtils { public static String removeDefaultHttpPorts(final String uri) { URL url; try { url = new URL(uri); if (url.getPort() == url.getDefaultPort()) { String urlPort = ":" + url.getPort(); return url.toExternalForm().replace(urlPort, ""); } } catch (MalformedURLException e) { return null; } return url.toExternal... | CommonUtils { public static String removeDefaultHttpPorts(final String uri) { URL url; try { url = new URL(uri); if (url.getPort() == url.getDefaultPort()) { String urlPort = ":" + url.getPort(); return url.toExternalForm().replace(urlPort, ""); } } catch (MalformedURLException e) { return null; } return url.toExternal... | CommonUtils { public static String removeDefaultHttpPorts(final String uri) { URL url; try { url = new URL(uri); if (url.getPort() == url.getDefaultPort()) { String urlPort = ":" + url.getPort(); return url.toExternalForm().replace(urlPort, ""); } } catch (MalformedURLException e) { return null; } return url.toExternal... |
@Test public void testIsCertificatePassPhraseValid() throws Exception { iOSApplicationUploadForm form = new iOSApplicationUploadForm(); form.setCertificate(IOUtils.toByteArray(getClass().getResourceAsStream("/Certificates.p12"))); form.setPassphrase("aero1gears"); final Set<ConstraintViolation<iOSApplicationUploadForm>... | @AssertTrue(message = "the provided certificate passphrase does not match with the uploaded certificate") public boolean isCertificatePassphraseValid() { try { PKCS12.validate(certificate, passphrase); return true; } catch (Exception e) { return false; } } | iOSApplicationUploadForm { @AssertTrue(message = "the provided certificate passphrase does not match with the uploaded certificate") public boolean isCertificatePassphraseValid() { try { PKCS12.validate(certificate, passphrase); return true; } catch (Exception e) { return false; } } } | iOSApplicationUploadForm { @AssertTrue(message = "the provided certificate passphrase does not match with the uploaded certificate") public boolean isCertificatePassphraseValid() { try { PKCS12.validate(certificate, passphrase); return true; } catch (Exception e) { return false; } } iOSApplicationUploadForm(); } | iOSApplicationUploadForm { @AssertTrue(message = "the provided certificate passphrase does not match with the uploaded certificate") public boolean isCertificatePassphraseValid() { try { PKCS12.validate(certificate, passphrase); return true; } catch (Exception e) { return false; } } iOSApplicationUploadForm(); Boolean ... | iOSApplicationUploadForm { @AssertTrue(message = "the provided certificate passphrase does not match with the uploaded certificate") public boolean isCertificatePassphraseValid() { try { PKCS12.validate(certificate, passphrase); return true; } catch (Exception e) { return false; } } iOSApplicationUploadForm(); Boolean ... |
@Test public void testInvalidToken() { final VariantType andVariantType = VariantType.ANDROID; assertThat(DeviceTokenValidator.isValidDeviceTokenForVariant("some-bogus:token", andVariantType)).isFalse(); } | public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVICE_TOKEN.matcher(deviceToken).matches(); case WEB_PUSH: return isWebPushRegistration(d... | DeviceTokenValidator implements ConstraintValidator<DeviceTokenCheck, Installation> { public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVI... | DeviceTokenValidator implements ConstraintValidator<DeviceTokenCheck, Installation> { public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVI... | DeviceTokenValidator implements ConstraintValidator<DeviceTokenCheck, Installation> { public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVI... | DeviceTokenValidator implements ConstraintValidator<DeviceTokenCheck, Installation> { public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVI... |
@Test public void shouldGenerateHeaderLinksFirstPage() throws URISyntaxException { final ResteasyUriInfo uriInfo = getUriInfo(); final LinkHeader linkHeader = endpoint.getLinkHeader(0, 3, uriInfo); assertThat(findLinkByRel(linkHeader, "prev")).isNull(); final Link next = findLinkByRel(linkHeader, "next"); assertThat(ne... | static LinkHeader getLinkHeader(Integer page, long totalPages, UriInfo uri) { LinkHeader header = new LinkHeader(); if (page != 0) { header.addLink(buildLink("prev", page - 1, uri)); header.addLink(buildLink("first", 0, uri)); } if (page < totalPages) { header.addLink(buildLink("next", page + 1, uri)); header.addLink(b... | InstallationManagementEndpoint { static LinkHeader getLinkHeader(Integer page, long totalPages, UriInfo uri) { LinkHeader header = new LinkHeader(); if (page != 0) { header.addLink(buildLink("prev", page - 1, uri)); header.addLink(buildLink("first", 0, uri)); } if (page < totalPages) { header.addLink(buildLink("next", ... | InstallationManagementEndpoint { static LinkHeader getLinkHeader(Integer page, long totalPages, UriInfo uri) { LinkHeader header = new LinkHeader(); if (page != 0) { header.addLink(buildLink("prev", page - 1, uri)); header.addLink(buildLink("first", 0, uri)); } if (page < totalPages) { header.addLink(buildLink("next", ... | InstallationManagementEndpoint { static LinkHeader getLinkHeader(Integer page, long totalPages, UriInfo uri) { LinkHeader header = new LinkHeader(); if (page != 0) { header.addLink(buildLink("prev", page - 1, uri)); header.addLink(buildLink("first", 0, uri)); } if (page < totalPages) { header.addLink(buildLink("next", ... | InstallationManagementEndpoint { static LinkHeader getLinkHeader(Integer page, long totalPages, UriInfo uri) { LinkHeader header = new LinkHeader(); if (page != 0) { header.addLink(buildLink("prev", page - 1, uri)); header.addLink(buildLink("first", 0, uri)); } if (page < totalPages) { header.addLink(buildLink("next", ... |
@Test public void shouldGenerateHeaderLinksNormalPage() throws URISyntaxException { final ResteasyUriInfo uriInfo = getUriInfo(); final LinkHeader linkHeader = endpoint.getLinkHeader(2, 3, uriInfo); final Link prev = findLinkByRel(linkHeader, "prev"); assertThat(prev).isNotNull(); assertThat(prev.getHref()).isEqualTo("... | static LinkHeader getLinkHeader(Integer page, long totalPages, UriInfo uri) { LinkHeader header = new LinkHeader(); if (page != 0) { header.addLink(buildLink("prev", page - 1, uri)); header.addLink(buildLink("first", 0, uri)); } if (page < totalPages) { header.addLink(buildLink("next", page + 1, uri)); header.addLink(b... | InstallationManagementEndpoint { static LinkHeader getLinkHeader(Integer page, long totalPages, UriInfo uri) { LinkHeader header = new LinkHeader(); if (page != 0) { header.addLink(buildLink("prev", page - 1, uri)); header.addLink(buildLink("first", 0, uri)); } if (page < totalPages) { header.addLink(buildLink("next", ... | InstallationManagementEndpoint { static LinkHeader getLinkHeader(Integer page, long totalPages, UriInfo uri) { LinkHeader header = new LinkHeader(); if (page != 0) { header.addLink(buildLink("prev", page - 1, uri)); header.addLink(buildLink("first", 0, uri)); } if (page < totalPages) { header.addLink(buildLink("next", ... | InstallationManagementEndpoint { static LinkHeader getLinkHeader(Integer page, long totalPages, UriInfo uri) { LinkHeader header = new LinkHeader(); if (page != 0) { header.addLink(buildLink("prev", page - 1, uri)); header.addLink(buildLink("first", 0, uri)); } if (page < totalPages) { header.addLink(buildLink("next", ... | InstallationManagementEndpoint { static LinkHeader getLinkHeader(Integer page, long totalPages, UriInfo uri) { LinkHeader header = new LinkHeader(); if (page != 0) { header.addLink(buildLink("prev", page - 1, uri)); header.addLink(buildLink("first", 0, uri)); } if (page < totalPages) { header.addLink(buildLink("next", ... |
@Test public void shouldGenerateHeaderLinksLastPage() throws URISyntaxException { final ResteasyUriInfo uriInfo = getUriInfo(); final LinkHeader linkHeader = endpoint.getLinkHeader(3, 3, uriInfo); final Link prev = findLinkByRel(linkHeader, "prev"); assertThat(prev).isNotNull(); assertThat(prev.getHref()).isEqualTo("/?... | static LinkHeader getLinkHeader(Integer page, long totalPages, UriInfo uri) { LinkHeader header = new LinkHeader(); if (page != 0) { header.addLink(buildLink("prev", page - 1, uri)); header.addLink(buildLink("first", 0, uri)); } if (page < totalPages) { header.addLink(buildLink("next", page + 1, uri)); header.addLink(b... | InstallationManagementEndpoint { static LinkHeader getLinkHeader(Integer page, long totalPages, UriInfo uri) { LinkHeader header = new LinkHeader(); if (page != 0) { header.addLink(buildLink("prev", page - 1, uri)); header.addLink(buildLink("first", 0, uri)); } if (page < totalPages) { header.addLink(buildLink("next", ... | InstallationManagementEndpoint { static LinkHeader getLinkHeader(Integer page, long totalPages, UriInfo uri) { LinkHeader header = new LinkHeader(); if (page != 0) { header.addLink(buildLink("prev", page - 1, uri)); header.addLink(buildLink("first", 0, uri)); } if (page < totalPages) { header.addLink(buildLink("next", ... | InstallationManagementEndpoint { static LinkHeader getLinkHeader(Integer page, long totalPages, UriInfo uri) { LinkHeader header = new LinkHeader(); if (page != 0) { header.addLink(buildLink("prev", page - 1, uri)); header.addLink(buildLink("first", 0, uri)); } if (page < totalPages) { header.addLink(buildLink("next", ... | InstallationManagementEndpoint { static LinkHeader getLinkHeader(Integer page, long totalPages, UriInfo uri) { LinkHeader header = new LinkHeader(); if (page != 0) { header.addLink(buildLink("prev", page - 1, uri)); header.addLink(buildLink("first", 0, uri)); } if (page < totalPages) { header.addLink(buildLink("next", ... |
@Test public void shouldRegisterAndroidVariantSuccessfully() { final AndroidVariant variant = new AndroidVariant(); final ResteasyUriInfo uriInfo = new ResteasyUriInfo("http: final PushApplication pushApp = new PushApplication(); when(searchService.findByPushApplicationIDForDeveloper("push-app-id")).thenReturn(pushApp)... | @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerAndroidVariant( AndroidVariant androidVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication pushApp = getSearch().findByPushApplicationIDForDeveloper(pushApplication... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerAndroidVariant( AndroidVariant androidVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerAndroidVariant( AndroidVariant androidVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerAndroidVariant( AndroidVariant androidVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerAndroidVariant( AndroidVariant androidVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... |
@Test public void registerAndroidVariantShouldReturn404WhenPushAppDoesNotExist() { final AndroidVariant variant = new AndroidVariant(); final ResteasyUriInfo uriInfo = new ResteasyUriInfo("http: final PushApplication pushApp = new PushApplication(); when(searchService.findByPushApplicationIDForDeveloper("push-app-id"))... | @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerAndroidVariant( AndroidVariant androidVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication pushApp = getSearch().findByPushApplicationIDForDeveloper(pushApplication... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerAndroidVariant( AndroidVariant androidVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerAndroidVariant( AndroidVariant androidVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerAndroidVariant( AndroidVariant androidVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerAndroidVariant( AndroidVariant androidVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... |
@Test public void registerAndroidVariantShouldReturn400WhenVariantModelIsNotValid() { final AndroidVariant variant = new AndroidVariant(); final ResteasyUriInfo uriInfo = new ResteasyUriInfo("http: final PushApplication pushApp = new PushApplication(); when(searchService.findByPushApplicationIDForDeveloper("push-app-id... | @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerAndroidVariant( AndroidVariant androidVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication pushApp = getSearch().findByPushApplicationIDForDeveloper(pushApplication... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerAndroidVariant( AndroidVariant androidVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerAndroidVariant( AndroidVariant androidVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerAndroidVariant( AndroidVariant androidVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerAndroidVariant( AndroidVariant androidVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... |
@Test public void shouldListAllAndroidVariationsForPushAppSuccessfully() { final Variant androidVariant = new AndroidVariant(); final Variant iOSVariant = new iOSVariant(); final PushApplication pushApp = new PushApplication(); pushApp.setVariants(Lists.newArrayList(androidVariant, iOSVariant)); when(searchService.find... | @GET @Produces(MediaType.APPLICATION_JSON) public Response listAllAndroidVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID) { final PushApplication application = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID); if (application == null) { return Response.status(Response.Status.NOT_... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @GET @Produces(MediaType.APPLICATION_JSON) public Response listAllAndroidVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID) { final PushApplication application = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @GET @Produces(MediaType.APPLICATION_JSON) public Response listAllAndroidVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID) { final PushApplication application = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @GET @Produces(MediaType.APPLICATION_JSON) public Response listAllAndroidVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID) { final PushApplication application = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @GET @Produces(MediaType.APPLICATION_JSON) public Response listAllAndroidVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID) { final PushApplication application = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID... |
@Test public void shouldUpdateAndroidVariantSuccessfully() { final AndroidVariant originalVariant = new AndroidVariant(); final AndroidVariant updatedVariant = new AndroidVariant(); final PushApplication pushApp = new PushApplication(); originalVariant.setGoogleKey("Original Google Key"); updatedVariant.setGoogleKey("U... | @PUT @Path("/{androidID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateAndroidVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("androidID") String androidID, AndroidVariant updatedAndroidApplication) { final PushApplication application = getSear... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @PUT @Path("/{androidID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateAndroidVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("androidID") String androidID, AndroidVariant... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @PUT @Path("/{androidID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateAndroidVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("androidID") String androidID, AndroidVariant... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @PUT @Path("/{androidID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateAndroidVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("androidID") String androidID, AndroidVariant... | AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @PUT @Path("/{androidID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateAndroidVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("androidID") String androidID, AndroidVariant... |
@Test public void shouldRegisteriOSVariantSuccessfully() { final ResteasyUriInfo uriInfo = new ResteasyUriInfo("http: final PushApplication pushApp = new PushApplication(); final iOSApplicationUploadForm form = new iOSApplicationUploadForm(); form.setName("variant name"); form.setCertificate("certificate".getBytes()); ... | @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registeriOSVariant( iOSApplicationUploadForm form, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication pushApp = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID);... | iOSVariantEndpoint extends AbstractVariantEndpoint<iOSVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registeriOSVariant( iOSApplicationUploadForm form, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication pushApp = ge... | iOSVariantEndpoint extends AbstractVariantEndpoint<iOSVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registeriOSVariant( iOSApplicationUploadForm form, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication pushApp = ge... | iOSVariantEndpoint extends AbstractVariantEndpoint<iOSVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registeriOSVariant( iOSApplicationUploadForm form, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication pushApp = ge... | iOSVariantEndpoint extends AbstractVariantEndpoint<iOSVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registeriOSVariant( iOSApplicationUploadForm form, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication pushApp = ge... |
@Test public void shouldUpdateiOSVariantSuccessfully_withMultiPartData() { final iOSVariant original = new iOSVariant(); original.setCertificate("Certificate".getBytes()); final iOSApplicationUploadForm update = new iOSApplicationUploadForm(); final PushApplication pushApp = new PushApplication(); update.setName("varia... | @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSVariant updatediOSVariant) { final PushApplication application = getSearch().findByPushApplication... | iOSVariantEndpoint extends AbstractVariantEndpoint<iOSVariant> { @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSVariant updatediOSVariant) { fina... | iOSVariantEndpoint extends AbstractVariantEndpoint<iOSVariant> { @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSVariant updatediOSVariant) { fina... | iOSVariantEndpoint extends AbstractVariantEndpoint<iOSVariant> { @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSVariant updatediOSVariant) { fina... | iOSVariantEndpoint extends AbstractVariantEndpoint<iOSVariant> { @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSVariant updatediOSVariant) { fina... |
@Test public void testInvalidWebPush() { final Gson gson = new Gson(); final VariantType webPushType = VariantType.WEB_PUSH; assertThat(DeviceTokenValidator.isValidDeviceTokenForVariant("some-bogus:token", webPushType)).isFalse(); WebPushRegistration registration = new WebPushRegistration(); String registrationJson = B... | public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVICE_TOKEN.matcher(deviceToken).matches(); case WEB_PUSH: return isWebPushRegistration(d... | DeviceTokenValidator implements ConstraintValidator<DeviceTokenCheck, Installation> { public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVI... | DeviceTokenValidator implements ConstraintValidator<DeviceTokenCheck, Installation> { public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVI... | DeviceTokenValidator implements ConstraintValidator<DeviceTokenCheck, Installation> { public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVI... | DeviceTokenValidator implements ConstraintValidator<DeviceTokenCheck, Installation> { public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVI... |
@Test public void shouldUpdateiOSVariantSuccessfully_noMultiPartData() { final iOSVariant original = new iOSVariant(); final PushApplication pushApp = new PushApplication(); final iOSVariant update = new iOSVariant(); original.setCertificate("Certificate".getBytes()); update.setName("variant name"); update.setProductio... | @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSVariant updatediOSVariant) { final PushApplication application = getSearch().findByPushApplication... | iOSVariantEndpoint extends AbstractVariantEndpoint<iOSVariant> { @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSVariant updatediOSVariant) { fina... | iOSVariantEndpoint extends AbstractVariantEndpoint<iOSVariant> { @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSVariant updatediOSVariant) { fina... | iOSVariantEndpoint extends AbstractVariantEndpoint<iOSVariant> { @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSVariant updatediOSVariant) { fina... | iOSVariantEndpoint extends AbstractVariantEndpoint<iOSVariant> { @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSVariant updatediOSVariant) { fina... |
@Test public void shouldRegisterWebPushVariantSuccessfully() { final WebPushVariant variant = new WebPushVariant(); final ResteasyUriInfo uriInfo = new ResteasyUriInfo("http: final PushApplication pushApp = new PushApplication(); when(searchService.findByPushApplicationIDForDeveloper("push-app-id")).thenReturn(pushApp)... | @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerWebPushVariant( WebPushVariant webPushVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication pushApp = getSearch().findByPushApplicationIDForDeveloper(pushApplication... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerWebPushVariant( WebPushVariant webPushVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerWebPushVariant( WebPushVariant webPushVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerWebPushVariant( WebPushVariant webPushVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerWebPushVariant( WebPushVariant webPushVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... |
@Test public void registerWebPushVariantShouldReturn404WhenPushAppDoesNotExist() { final WebPushVariant variant = new WebPushVariant(); final ResteasyUriInfo uriInfo = new ResteasyUriInfo("http: final PushApplication pushApp = new PushApplication(); when(searchService.findByPushApplicationIDForDeveloper("push-app-id"))... | @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerWebPushVariant( WebPushVariant webPushVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication pushApp = getSearch().findByPushApplicationIDForDeveloper(pushApplication... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerWebPushVariant( WebPushVariant webPushVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerWebPushVariant( WebPushVariant webPushVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerWebPushVariant( WebPushVariant webPushVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerWebPushVariant( WebPushVariant webPushVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... |
@Test public void registerWebPushVariantShouldReturn400WhenVariantModelIsNotValid() { final WebPushVariant variant = new WebPushVariant(); final ResteasyUriInfo uriInfo = new ResteasyUriInfo("http: final PushApplication pushApp = new PushApplication(); when(searchService.findByPushApplicationIDForDeveloper("push-app-id... | @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerWebPushVariant( WebPushVariant webPushVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication pushApp = getSearch().findByPushApplicationIDForDeveloper(pushApplication... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerWebPushVariant( WebPushVariant webPushVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerWebPushVariant( WebPushVariant webPushVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerWebPushVariant( WebPushVariant webPushVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registerWebPushVariant( WebPushVariant webPushVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication ... |
@Test public void shouldListAllAndroidVariationsForPushAppSuccessfully() { final WebPushVariant webPushVariant = new WebPushVariant(); final Variant iOSVariant = new iOSVariant(); final PushApplication pushApp = new PushApplication(); pushApp.setVariants(Lists.newArrayList(webPushVariant, iOSVariant)); when(searchServi... | @GET @Produces(MediaType.APPLICATION_JSON) public Response listAllWebPushVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID) { final PushApplication application = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID); if (application == null) { return Response.status(Response.Status.NOT_... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @GET @Produces(MediaType.APPLICATION_JSON) public Response listAllWebPushVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID) { final PushApplication application = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @GET @Produces(MediaType.APPLICATION_JSON) public Response listAllWebPushVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID) { final PushApplication application = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @GET @Produces(MediaType.APPLICATION_JSON) public Response listAllWebPushVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID) { final PushApplication application = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @GET @Produces(MediaType.APPLICATION_JSON) public Response listAllWebPushVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID) { final PushApplication application = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID... |
@Test public void shouldUpdateWebPushVariantSuccessfully() { final WebPushVariant originalVariant = new WebPushVariant(); final WebPushVariant updatedVariant = new WebPushVariant(); final PushApplication pushApp = new PushApplication(); originalVariant.setPublicKey("test public Key"); updatedVariant.setPublicKey("updat... | @PUT @Path("/{webPushID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateWebPushVariant(@PathParam("pushAppID") String pushApplicationID, @PathParam("webPushID") String webPushID, WebPushVariant updatedVariant) { final PushApplication application = getSearch().findByP... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @PUT @Path("/{webPushID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateWebPushVariant(@PathParam("pushAppID") String pushApplicationID, @PathParam("webPushID") String webPushID, WebPushVariant ... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @PUT @Path("/{webPushID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateWebPushVariant(@PathParam("pushAppID") String pushApplicationID, @PathParam("webPushID") String webPushID, WebPushVariant ... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @PUT @Path("/{webPushID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateWebPushVariant(@PathParam("pushAppID") String pushApplicationID, @PathParam("webPushID") String webPushID, WebPushVariant ... | WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @PUT @Path("/{webPushID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateWebPushVariant(@PathParam("pushAppID") String pushApplicationID, @PathParam("webPushID") String webPushID, WebPushVariant ... |
@Test public void shouldRegisteriOSTokenVariantSuccessfully() { final ResteasyUriInfo uriInfo = new ResteasyUriInfo("http: final PushApplication pushApp = new PushApplication(); final iOSTokenVariant form = new iOSTokenVariant(); form.setName("variant name"); form.setPrivateKey("privateKey"); form.setTeamId("team id");... | @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registeriOSVariant( iOSTokenVariant iOSVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication pushApp = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID); if... | iOSTokenVariantEndpoint extends AbstractVariantEndpoint<iOSTokenVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registeriOSVariant( iOSTokenVariant iOSVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication pushA... | iOSTokenVariantEndpoint extends AbstractVariantEndpoint<iOSTokenVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registeriOSVariant( iOSTokenVariant iOSVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication pushA... | iOSTokenVariantEndpoint extends AbstractVariantEndpoint<iOSTokenVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registeriOSVariant( iOSTokenVariant iOSVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication pushA... | iOSTokenVariantEndpoint extends AbstractVariantEndpoint<iOSTokenVariant> { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response registeriOSVariant( iOSTokenVariant iOSVariant, @PathParam("pushAppID") String pushApplicationID, @Context UriInfo uriInfo) { PushApplication pushA... |
@Test public void shouldUpdateiOSTokenVariantSuccessfully_withMultiPartData() { final iOSTokenVariant original = new iOSTokenVariant(); final iOSTokenVariant update = new iOSTokenVariant(); final PushApplication pushApp = new PushApplication(); update.setName("variant name"); update.setPrivateKey("privateKey"); update.... | @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSTokenVariant updatediOSVariant) { final PushApplication application = getSearch().findByPushApplic... | iOSTokenVariantEndpoint extends AbstractVariantEndpoint<iOSTokenVariant> { @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSTokenVariant updatediOS... | iOSTokenVariantEndpoint extends AbstractVariantEndpoint<iOSTokenVariant> { @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSTokenVariant updatediOS... | iOSTokenVariantEndpoint extends AbstractVariantEndpoint<iOSTokenVariant> { @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSTokenVariant updatediOS... | iOSTokenVariantEndpoint extends AbstractVariantEndpoint<iOSTokenVariant> { @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSTokenVariant updatediOS... |
@Test public void shouldUpdateiOSTokenVariantSuccessfully_noMultiPartData() { final iOSTokenVariant original = new iOSTokenVariant(); final iOSTokenVariant update = new iOSTokenVariant(); final PushApplication pushApp = new PushApplication(); update.setName("variant name"); update.setPrivateKey("certificate"); update.s... | @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSTokenVariant updatediOSVariant) { final PushApplication application = getSearch().findByPushApplic... | iOSTokenVariantEndpoint extends AbstractVariantEndpoint<iOSTokenVariant> { @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSTokenVariant updatediOS... | iOSTokenVariantEndpoint extends AbstractVariantEndpoint<iOSTokenVariant> { @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSTokenVariant updatediOS... | iOSTokenVariantEndpoint extends AbstractVariantEndpoint<iOSTokenVariant> { @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSTokenVariant updatediOS... | iOSTokenVariantEndpoint extends AbstractVariantEndpoint<iOSTokenVariant> { @PATCH @Path("/{iOSID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateiOSVariant( @PathParam("pushAppID") String pushApplicationId, @PathParam("iOSID") String iOSID, iOSTokenVariant updatediOS... |
@Test public void testExistingTryGetProperty(){ System.setProperty(TEST_PROPERTY_NAME, "MyNiceValue"); assertThat(ConfigurationUtils.tryGetGlobalProperty(TEST_PROPERTY_NAME)).isEqualTo("MyNiceValue"); } | public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of global property {} due to ... | ConfigurationUtils { public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of globa... | ConfigurationUtils { public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of globa... | ConfigurationUtils { public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of globa... | ConfigurationUtils { public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of globa... |
@Test public void testValidWebPush() { final Gson gson = new Gson(); final VariantType webPushType = VariantType.WEB_PUSH; WebPushRegistration registration = new WebPushRegistration(); registration.setEndpoint("https: registration.getKeys().setAuth("authTokens"); registration.getKeys().setP256dh("devicePublicKey"); Str... | public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVICE_TOKEN.matcher(deviceToken).matches(); case WEB_PUSH: return isWebPushRegistration(d... | DeviceTokenValidator implements ConstraintValidator<DeviceTokenCheck, Installation> { public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVI... | DeviceTokenValidator implements ConstraintValidator<DeviceTokenCheck, Installation> { public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVI... | DeviceTokenValidator implements ConstraintValidator<DeviceTokenCheck, Installation> { public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVI... | DeviceTokenValidator implements ConstraintValidator<DeviceTokenCheck, Installation> { public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) { switch (type) { case IOS: case IOS_TOKEN: return IOS_DEVICE_TOKEN.matcher(deviceToken).matches(); case ANDROID: return ANDROID_DEVI... |
@Test public void testNonExistingTryGetProperty(){ assertThat(ConfigurationUtils.tryGetGlobalProperty(TEST_PROPERTY_NAME)).isNull(); } | public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of global property {} due to ... | ConfigurationUtils { public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of globa... | ConfigurationUtils { public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of globa... | ConfigurationUtils { public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of globa... | ConfigurationUtils { public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of globa... |
@Test public void testExistingTryGetIntegerProperty() { System.setProperty(TEST_PROPERTY_NAME, "123456"); assertThat(ConfigurationUtils.tryGetGlobalIntegerProperty(TEST_PROPERTY_NAME)).isEqualTo(123456); } | public static Integer tryGetGlobalIntegerProperty(String key, Integer defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { return tryGetIntegerProperty(key, defaultValue); } else { return Integer.parseInt(value); } } catch (SecurityException | NumberFormatException e)... | ConfigurationUtils { public static Integer tryGetGlobalIntegerProperty(String key, Integer defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { return tryGetIntegerProperty(key, defaultValue); } else { return Integer.parseInt(value); } } catch (SecurityException | Num... | ConfigurationUtils { public static Integer tryGetGlobalIntegerProperty(String key, Integer defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { return tryGetIntegerProperty(key, defaultValue); } else { return Integer.parseInt(value); } } catch (SecurityException | Num... | ConfigurationUtils { public static Integer tryGetGlobalIntegerProperty(String key, Integer defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { return tryGetIntegerProperty(key, defaultValue); } else { return Integer.parseInt(value); } } catch (SecurityException | Num... | ConfigurationUtils { public static Integer tryGetGlobalIntegerProperty(String key, Integer defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { return tryGetIntegerProperty(key, defaultValue); } else { return Integer.parseInt(value); } } catch (SecurityException | Num... |
@Test public void testNonExistingTryGetIntegerProperty() { assertThat(ConfigurationUtils.tryGetGlobalIntegerProperty(TEST_PROPERTY_NAME)).isNull(); } | public static Integer tryGetGlobalIntegerProperty(String key, Integer defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { return tryGetIntegerProperty(key, defaultValue); } else { return Integer.parseInt(value); } } catch (SecurityException | NumberFormatException e)... | ConfigurationUtils { public static Integer tryGetGlobalIntegerProperty(String key, Integer defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { return tryGetIntegerProperty(key, defaultValue); } else { return Integer.parseInt(value); } } catch (SecurityException | Num... | ConfigurationUtils { public static Integer tryGetGlobalIntegerProperty(String key, Integer defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { return tryGetIntegerProperty(key, defaultValue); } else { return Integer.parseInt(value); } } catch (SecurityException | Num... | ConfigurationUtils { public static Integer tryGetGlobalIntegerProperty(String key, Integer defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { return tryGetIntegerProperty(key, defaultValue); } else { return Integer.parseInt(value); } } catch (SecurityException | Num... | ConfigurationUtils { public static Integer tryGetGlobalIntegerProperty(String key, Integer defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { return tryGetIntegerProperty(key, defaultValue); } else { return Integer.parseInt(value); } } catch (SecurityException | Num... |
@Test public void testNonExistingTryGetIntegerPropertyWithDefaultValue() { assertThat(ConfigurationUtils.tryGetGlobalIntegerProperty(TEST_PROPERTY_NAME, 123)).isEqualTo(123); } | public static Integer tryGetGlobalIntegerProperty(String key, Integer defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { return tryGetIntegerProperty(key, defaultValue); } else { return Integer.parseInt(value); } } catch (SecurityException | NumberFormatException e)... | ConfigurationUtils { public static Integer tryGetGlobalIntegerProperty(String key, Integer defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { return tryGetIntegerProperty(key, defaultValue); } else { return Integer.parseInt(value); } } catch (SecurityException | Num... | ConfigurationUtils { public static Integer tryGetGlobalIntegerProperty(String key, Integer defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { return tryGetIntegerProperty(key, defaultValue); } else { return Integer.parseInt(value); } } catch (SecurityException | Num... | ConfigurationUtils { public static Integer tryGetGlobalIntegerProperty(String key, Integer defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { return tryGetIntegerProperty(key, defaultValue); } else { return Integer.parseInt(value); } } catch (SecurityException | Num... | ConfigurationUtils { public static Integer tryGetGlobalIntegerProperty(String key, Integer defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { return tryGetIntegerProperty(key, defaultValue); } else { return Integer.parseInt(value); } } catch (SecurityException | Num... |
@Test public void testEnvVarFormat() { assertThat(ConfigurationUtils.formatEnvironmentVariable("custom.aerogear.apns.push.host")) .isEqualTo("CUSTOM_AEROGEAR_APNS_PUSH_HOST"); } | public static String formatEnvironmentVariable(String key) { return key.toUpperCase().replaceAll("\\.", "_"); } | ConfigurationUtils { public static String formatEnvironmentVariable(String key) { return key.toUpperCase().replaceAll("\\.", "_"); } } | ConfigurationUtils { public static String formatEnvironmentVariable(String key) { return key.toUpperCase().replaceAll("\\.", "_"); } private ConfigurationUtils(); } | ConfigurationUtils { public static String formatEnvironmentVariable(String key) { return key.toUpperCase().replaceAll("\\.", "_"); } private ConfigurationUtils(); static String formatEnvironmentVariable(String key); static String tryGetGlobalProperty(String key, String defaultValue); static String tryGetGlobalProperty... | ConfigurationUtils { public static String formatEnvironmentVariable(String key) { return key.toUpperCase().replaceAll("\\.", "_"); } private ConfigurationUtils(); static String formatEnvironmentVariable(String key); static String tryGetGlobalProperty(String key, String defaultValue); static String tryGetGlobalProperty... |
@Test public void testEnvVarLookup() { assertThat(ConfigurationUtils.tryGetGlobalProperty("test.env.var")) .isEqualTo("Ok"); } | public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of global property {} due to ... | ConfigurationUtils { public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of globa... | ConfigurationUtils { public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of globa... | ConfigurationUtils { public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of globa... | ConfigurationUtils { public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of globa... |
@Test public void testEnvVarUppercaseLookup() { assertThat(ConfigurationUtils.tryGetGlobalProperty("TEST_ENV_VAR")) .isEqualTo("Ok"); } | public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of global property {} due to ... | ConfigurationUtils { public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of globa... | ConfigurationUtils { public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of globa... | ConfigurationUtils { public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of globa... | ConfigurationUtils { public static String tryGetGlobalProperty(String key, String defaultValue) { try { String value = System.getenv(formatEnvironmentVariable(key)); if (value == null) { value = tryGetProperty(key, defaultValue); } return value; } catch (SecurityException e) { logger.error("Could not get value of globa... |
@Test public void extractUsernameAndPasswordFromBasicHeader() { final HttpServletRequest request = Mockito.mock(HttpServletRequest.class); final String encodedUserPassword = Base64.getEncoder().encodeToString("user:password".getBytes(StandardCharsets.UTF_8)); Mockito.when(request.getHeader("Authorization")).thenReturn(... | public static String[] extractUsernameAndPasswordFromBasicHeader(final HttpServletRequest request) { String username = ""; String password = ""; final String authorizationHeader = getAuthorizationHeader(request); if (authorizationHeader != null && isBasic(authorizationHeader)) { final String base64Token = authorization... | HttpBasicHelper { public static String[] extractUsernameAndPasswordFromBasicHeader(final HttpServletRequest request) { String username = ""; String password = ""; final String authorizationHeader = getAuthorizationHeader(request); if (authorizationHeader != null && isBasic(authorizationHeader)) { final String base64Tok... | HttpBasicHelper { public static String[] extractUsernameAndPasswordFromBasicHeader(final HttpServletRequest request) { String username = ""; String password = ""; final String authorizationHeader = getAuthorizationHeader(request); if (authorizationHeader != null && isBasic(authorizationHeader)) { final String base64Tok... | HttpBasicHelper { public static String[] extractUsernameAndPasswordFromBasicHeader(final HttpServletRequest request) { String username = ""; String password = ""; final String authorizationHeader = getAuthorizationHeader(request); if (authorizationHeader != null && isBasic(authorizationHeader)) { final String base64Tok... | HttpBasicHelper { public static String[] extractUsernameAndPasswordFromBasicHeader(final HttpServletRequest request) { String username = ""; String password = ""; final String authorizationHeader = getAuthorizationHeader(request); if (authorizationHeader != null && isBasic(authorizationHeader)) { final String base64Tok... |
@Test public void tryToExtractUsernameAndPasswordFromEmptyHeader() { final HttpServletRequest request = Mockito.mock(HttpServletRequest.class); Mockito.when(request.getHeader("Authorization")).thenReturn(""); final String[] credentials = HttpBasicHelper.extractUsernameAndPasswordFromBasicHeader(request); assertThat(cre... | public static String[] extractUsernameAndPasswordFromBasicHeader(final HttpServletRequest request) { String username = ""; String password = ""; final String authorizationHeader = getAuthorizationHeader(request); if (authorizationHeader != null && isBasic(authorizationHeader)) { final String base64Token = authorization... | HttpBasicHelper { public static String[] extractUsernameAndPasswordFromBasicHeader(final HttpServletRequest request) { String username = ""; String password = ""; final String authorizationHeader = getAuthorizationHeader(request); if (authorizationHeader != null && isBasic(authorizationHeader)) { final String base64Tok... | HttpBasicHelper { public static String[] extractUsernameAndPasswordFromBasicHeader(final HttpServletRequest request) { String username = ""; String password = ""; final String authorizationHeader = getAuthorizationHeader(request); if (authorizationHeader != null && isBasic(authorizationHeader)) { final String base64Tok... | HttpBasicHelper { public static String[] extractUsernameAndPasswordFromBasicHeader(final HttpServletRequest request) { String username = ""; String password = ""; final String authorizationHeader = getAuthorizationHeader(request); if (authorizationHeader != null && isBasic(authorizationHeader)) { final String base64Tok... | HttpBasicHelper { public static String[] extractUsernameAndPasswordFromBasicHeader(final HttpServletRequest request) { String username = ""; String password = ""; final String authorizationHeader = getAuthorizationHeader(request); if (authorizationHeader != null && isBasic(authorizationHeader)) { final String base64Tok... |
@Test public void tryToExtractUsernameAndPasswordFromNullHeader() { final HttpServletRequest request = Mockito.mock(HttpServletRequest.class); Mockito.when(request.getHeader("Authorization")).thenReturn(null); final String[] credentials = HttpBasicHelper.extractUsernameAndPasswordFromBasicHeader(request); assertThat(cr... | public static String[] extractUsernameAndPasswordFromBasicHeader(final HttpServletRequest request) { String username = ""; String password = ""; final String authorizationHeader = getAuthorizationHeader(request); if (authorizationHeader != null && isBasic(authorizationHeader)) { final String base64Token = authorization... | HttpBasicHelper { public static String[] extractUsernameAndPasswordFromBasicHeader(final HttpServletRequest request) { String username = ""; String password = ""; final String authorizationHeader = getAuthorizationHeader(request); if (authorizationHeader != null && isBasic(authorizationHeader)) { final String base64Tok... | HttpBasicHelper { public static String[] extractUsernameAndPasswordFromBasicHeader(final HttpServletRequest request) { String username = ""; String password = ""; final String authorizationHeader = getAuthorizationHeader(request); if (authorizationHeader != null && isBasic(authorizationHeader)) { final String base64Tok... | HttpBasicHelper { public static String[] extractUsernameAndPasswordFromBasicHeader(final HttpServletRequest request) { String username = ""; String password = ""; final String authorizationHeader = getAuthorizationHeader(request); if (authorizationHeader != null && isBasic(authorizationHeader)) { final String base64Tok... | HttpBasicHelper { public static String[] extractUsernameAndPasswordFromBasicHeader(final HttpServletRequest request) { String username = ""; String password = ""; final String authorizationHeader = getAuthorizationHeader(request); if (authorizationHeader != null && isBasic(authorizationHeader)) { final String base64Tok... |
@Test public void testPriorityMapping() throws IOException { final ObjectMapper mapper = new ObjectMapper(); Message message = mapper.readValue(getClass().getResourceAsStream("/message-normal-priority.json"), UnifiedPushMessage.class).getMessage(); assertEquals(Priority.NORMAL, message.getPriority()); } | public Message getMessage() { return message; } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonStrin... | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonStrin... |
@Test public void testAndroidConfigurationSanitization() { try { System.setProperty("aerogear.android.batchSize", "1005"); SenderConfiguration configuration = provider.produceAndroidConfiguration(); assertEquals(10, configuration.batchesToLoad()); assertEquals(1000, configuration.batchSize()); } finally { System.clearP... | @Produces @ApplicationScoped @SenderType(VariantType.ANDROID) public SenderConfiguration produceAndroidConfiguration() { return loadConfigurationFor(VariantType.ANDROID, new SenderConfiguration(10, 1000)); } | SenderConfigurationProvider { @Produces @ApplicationScoped @SenderType(VariantType.ANDROID) public SenderConfiguration produceAndroidConfiguration() { return loadConfigurationFor(VariantType.ANDROID, new SenderConfiguration(10, 1000)); } } | SenderConfigurationProvider { @Produces @ApplicationScoped @SenderType(VariantType.ANDROID) public SenderConfiguration produceAndroidConfiguration() { return loadConfigurationFor(VariantType.ANDROID, new SenderConfiguration(10, 1000)); } } | SenderConfigurationProvider { @Produces @ApplicationScoped @SenderType(VariantType.ANDROID) public SenderConfiguration produceAndroidConfiguration() { return loadConfigurationFor(VariantType.ANDROID, new SenderConfiguration(10, 1000)); } @Produces @ApplicationScoped @SenderType(VariantType.ANDROID) SenderConfiguration... | SenderConfigurationProvider { @Produces @ApplicationScoped @SenderType(VariantType.ANDROID) public SenderConfiguration produceAndroidConfiguration() { return loadConfigurationFor(VariantType.ANDROID, new SenderConfiguration(10, 1000)); } @Produces @ApplicationScoped @SenderType(VariantType.ANDROID) SenderConfiguration... |
@Test public void testEmptyCriteria() { final Criteria criteria = new Criteria(); assertThat(TokenLoaderUtils.isEmptyCriteria(criteria)).isTrue(); } | public static boolean isEmptyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && isEmpty(criteria.getCategories()); } | TokenLoaderUtils { public static boolean isEmptyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && isEmpty(criteria.getCategories()); } } | TokenLoaderUtils { public static boolean isEmptyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && isEmpty(criteria.getCategories()); } private TokenLoaderUtils(); } | TokenLoaderUtils { public static boolean isEmptyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && isEmpty(criteria.getCategories()); } private TokenLoaderUtils(); static Set<String> extractFCMTopics(final Criteria criteria, final String variantID); stati... | TokenLoaderUtils { public static boolean isEmptyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && isEmpty(criteria.getCategories()); } private TokenLoaderUtils(); static Set<String> extractFCMTopics(final Criteria criteria, final String variantID); stati... |
@Test public void testNonEmptyCriteria() { final Criteria criteria = new Criteria(); criteria.setAliases(Arrays.asList("foo", "bar")); assertThat(TokenLoaderUtils.isEmptyCriteria(criteria)).isFalse(); } | public static boolean isEmptyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && isEmpty(criteria.getCategories()); } | TokenLoaderUtils { public static boolean isEmptyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && isEmpty(criteria.getCategories()); } } | TokenLoaderUtils { public static boolean isEmptyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && isEmpty(criteria.getCategories()); } private TokenLoaderUtils(); } | TokenLoaderUtils { public static boolean isEmptyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && isEmpty(criteria.getCategories()); } private TokenLoaderUtils(); static Set<String> extractFCMTopics(final Criteria criteria, final String variantID); stati... | TokenLoaderUtils { public static boolean isEmptyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && isEmpty(criteria.getCategories()); } private TokenLoaderUtils(); static Set<String> extractFCMTopics(final Criteria criteria, final String variantID); stati... |
@Test public void testNotCategoryOnly() { final Criteria criteria = new Criteria(); criteria.setAliases(Arrays.asList("foo", "bar")); assertThat(TokenLoaderUtils.isCategoryOnlyCriteria(criteria)).isFalse(); } | public static boolean isCategoryOnlyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && !isEmpty(criteria.getCategories()); } | TokenLoaderUtils { public static boolean isCategoryOnlyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && !isEmpty(criteria.getCategories()); } } | TokenLoaderUtils { public static boolean isCategoryOnlyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && !isEmpty(criteria.getCategories()); } private TokenLoaderUtils(); } | TokenLoaderUtils { public static boolean isCategoryOnlyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && !isEmpty(criteria.getCategories()); } private TokenLoaderUtils(); static Set<String> extractFCMTopics(final Criteria criteria, final String variantID... | TokenLoaderUtils { public static boolean isCategoryOnlyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && !isEmpty(criteria.getCategories()); } private TokenLoaderUtils(); static Set<String> extractFCMTopics(final Criteria criteria, final String variantID... |
@Test public void testCategoryOnly() { final Criteria criteria = new Criteria(); criteria.setCategories(Arrays.asList("football")); assertThat(TokenLoaderUtils.isCategoryOnlyCriteria(criteria)).isTrue(); } | public static boolean isCategoryOnlyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && !isEmpty(criteria.getCategories()); } | TokenLoaderUtils { public static boolean isCategoryOnlyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && !isEmpty(criteria.getCategories()); } } | TokenLoaderUtils { public static boolean isCategoryOnlyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && !isEmpty(criteria.getCategories()); } private TokenLoaderUtils(); } | TokenLoaderUtils { public static boolean isCategoryOnlyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && !isEmpty(criteria.getCategories()); } private TokenLoaderUtils(); static Set<String> extractFCMTopics(final Criteria criteria, final String variantID... | TokenLoaderUtils { public static boolean isCategoryOnlyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && !isEmpty(criteria.getCategories()); } private TokenLoaderUtils(); static Set<String> extractFCMTopics(final Criteria criteria, final String variantID... |
@Test public void testNotCategoryOnlyForEmpyt() { final Criteria criteria = new Criteria(); assertThat(TokenLoaderUtils.isCategoryOnlyCriteria(criteria)).isFalse(); } | public static boolean isCategoryOnlyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && !isEmpty(criteria.getCategories()); } | TokenLoaderUtils { public static boolean isCategoryOnlyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && !isEmpty(criteria.getCategories()); } } | TokenLoaderUtils { public static boolean isCategoryOnlyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && !isEmpty(criteria.getCategories()); } private TokenLoaderUtils(); } | TokenLoaderUtils { public static boolean isCategoryOnlyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && !isEmpty(criteria.getCategories()); } private TokenLoaderUtils(); static Set<String> extractFCMTopics(final Criteria criteria, final String variantID... | TokenLoaderUtils { public static boolean isCategoryOnlyCriteria(final Criteria criteria) { return isEmpty(criteria.getAliases()) && isEmpty(criteria.getDeviceTypes()) && !isEmpty(criteria.getCategories()); } private TokenLoaderUtils(); static Set<String> extractFCMTopics(final Criteria criteria, final String variantID... |
@Test public void testGcmTopicExtractionForEmptyCriteria() { final Criteria criteria = new Criteria(); assertThat(TokenLoaderUtils.extractFCMTopics(criteria, "123")).isNotEmpty(); assertThat(TokenLoaderUtils.extractFCMTopics(criteria, "123")).containsOnly( Constants.TOPIC_PREFIX+"123" ); } | public static Set<String> extractFCMTopics(final Criteria criteria, final String variantID) { final Set<String> topics = new TreeSet<>(); if (isEmptyCriteria(criteria)) { topics.add(Constants.TOPIC_PREFIX + variantID); } else if (isCategoryOnlyCriteria(criteria)) { topics.addAll(criteria.getCategories().stream() .map(c... | TokenLoaderUtils { public static Set<String> extractFCMTopics(final Criteria criteria, final String variantID) { final Set<String> topics = new TreeSet<>(); if (isEmptyCriteria(criteria)) { topics.add(Constants.TOPIC_PREFIX + variantID); } else if (isCategoryOnlyCriteria(criteria)) { topics.addAll(criteria.getCategorie... | TokenLoaderUtils { public static Set<String> extractFCMTopics(final Criteria criteria, final String variantID) { final Set<String> topics = new TreeSet<>(); if (isEmptyCriteria(criteria)) { topics.add(Constants.TOPIC_PREFIX + variantID); } else if (isCategoryOnlyCriteria(criteria)) { topics.addAll(criteria.getCategorie... | TokenLoaderUtils { public static Set<String> extractFCMTopics(final Criteria criteria, final String variantID) { final Set<String> topics = new TreeSet<>(); if (isEmptyCriteria(criteria)) { topics.add(Constants.TOPIC_PREFIX + variantID); } else if (isCategoryOnlyCriteria(criteria)) { topics.addAll(criteria.getCategorie... | TokenLoaderUtils { public static Set<String> extractFCMTopics(final Criteria criteria, final String variantID) { final Set<String> topics = new TreeSet<>(); if (isEmptyCriteria(criteria)) { topics.add(Constants.TOPIC_PREFIX + variantID); } else if (isCategoryOnlyCriteria(criteria)) { topics.addAll(criteria.getCategorie... |
@Test public void testGCMTopicForAlias() { final Criteria criteria = new Criteria(); criteria.setAliases(Arrays.asList("foo@bar.org")); assertThat(TokenLoaderUtils.isFCMTopicRequest(criteria)).isFalse(); } | public static boolean isFCMTopicRequest(final Criteria criteria) { return isEmptyCriteria(criteria) || isCategoryOnlyCriteria(criteria); } | TokenLoaderUtils { public static boolean isFCMTopicRequest(final Criteria criteria) { return isEmptyCriteria(criteria) || isCategoryOnlyCriteria(criteria); } } | TokenLoaderUtils { public static boolean isFCMTopicRequest(final Criteria criteria) { return isEmptyCriteria(criteria) || isCategoryOnlyCriteria(criteria); } private TokenLoaderUtils(); } | TokenLoaderUtils { public static boolean isFCMTopicRequest(final Criteria criteria) { return isEmptyCriteria(criteria) || isCategoryOnlyCriteria(criteria); } private TokenLoaderUtils(); static Set<String> extractFCMTopics(final Criteria criteria, final String variantID); static boolean isCategoryOnlyCriteria(final Cri... | TokenLoaderUtils { public static boolean isFCMTopicRequest(final Criteria criteria) { return isEmptyCriteria(criteria) || isCategoryOnlyCriteria(criteria); } private TokenLoaderUtils(); static Set<String> extractFCMTopics(final Criteria criteria, final String variantID); static boolean isCategoryOnlyCriteria(final Cri... |
@Test public void testGCMTopicForVariant() { final Criteria criteria = new Criteria(); criteria.setVariants(Arrays.asList("variant1", "variant2")); assertThat(TokenLoaderUtils.isFCMTopicRequest(criteria)).isTrue(); } | public static boolean isFCMTopicRequest(final Criteria criteria) { return isEmptyCriteria(criteria) || isCategoryOnlyCriteria(criteria); } | TokenLoaderUtils { public static boolean isFCMTopicRequest(final Criteria criteria) { return isEmptyCriteria(criteria) || isCategoryOnlyCriteria(criteria); } } | TokenLoaderUtils { public static boolean isFCMTopicRequest(final Criteria criteria) { return isEmptyCriteria(criteria) || isCategoryOnlyCriteria(criteria); } private TokenLoaderUtils(); } | TokenLoaderUtils { public static boolean isFCMTopicRequest(final Criteria criteria) { return isEmptyCriteria(criteria) || isCategoryOnlyCriteria(criteria); } private TokenLoaderUtils(); static Set<String> extractFCMTopics(final Criteria criteria, final String variantID); static boolean isCategoryOnlyCriteria(final Cri... | TokenLoaderUtils { public static boolean isFCMTopicRequest(final Criteria criteria) { return isEmptyCriteria(criteria) || isCategoryOnlyCriteria(criteria); } private TokenLoaderUtils(); static Set<String> extractFCMTopics(final Criteria criteria, final String variantID); static boolean isCategoryOnlyCriteria(final Cri... |
@Test public void testGCMTopicForVariantAndAlias() { final Criteria criteria = new Criteria(); criteria.setVariants(Arrays.asList("variant1", "variant2")); criteria.setAliases(Arrays.asList("foo@bar.org")); assertThat(TokenLoaderUtils.isFCMTopicRequest(criteria)).isFalse(); } | public static boolean isFCMTopicRequest(final Criteria criteria) { return isEmptyCriteria(criteria) || isCategoryOnlyCriteria(criteria); } | TokenLoaderUtils { public static boolean isFCMTopicRequest(final Criteria criteria) { return isEmptyCriteria(criteria) || isCategoryOnlyCriteria(criteria); } } | TokenLoaderUtils { public static boolean isFCMTopicRequest(final Criteria criteria) { return isEmptyCriteria(criteria) || isCategoryOnlyCriteria(criteria); } private TokenLoaderUtils(); } | TokenLoaderUtils { public static boolean isFCMTopicRequest(final Criteria criteria) { return isEmptyCriteria(criteria) || isCategoryOnlyCriteria(criteria); } private TokenLoaderUtils(); static Set<String> extractFCMTopics(final Criteria criteria, final String variantID); static boolean isCategoryOnlyCriteria(final Cri... | TokenLoaderUtils { public static boolean isFCMTopicRequest(final Criteria criteria) { return isEmptyCriteria(criteria) || isCategoryOnlyCriteria(criteria); } private TokenLoaderUtils(); static Set<String> extractFCMTopics(final Criteria criteria, final String variantID); static boolean isCategoryOnlyCriteria(final Cri... |
@Test public void testPriorityEnumHighMapping() throws IOException { final ObjectMapper mapper = new ObjectMapper(); Message message = mapper.readValue(getClass().getResourceAsStream("/message-high-priority.json"), UnifiedPushMessage.class).getMessage(); assertEquals(Priority.HIGH, message.getPriority()); } | public Message getMessage() { return message; } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonStrin... | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonStrin... |
@Test public void testNoVariants() { countDownLatch = new CountDownLatch(1); assertTrue("variants are empty", app.getVariants().isEmpty()); router.submit(app, message); assertEquals(variants(), variantTypeHolder.getVariantTypes()); } | @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> variantIDs = message.getCri... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... |
@Test public void testTwoVariantsOfSameType() throws InterruptedException { countDownLatch = new CountDownLatch(1); app.getVariants().add(new AndroidVariant()); app.getVariants().add(new AndroidVariant()); router.submit(app, message); countDownLatch.await(3, TimeUnit.SECONDS); assertEquals(variants(VariantType.ANDROID)... | @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> variantIDs = message.getCri... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... |
@Test public void testThreeVariantsOfDifferentType() throws InterruptedException { countDownLatch = new CountDownLatch(3); app.getVariants().add(new AndroidVariant()); app.getVariants().add(new iOSVariant()); router.submit(app, message); countDownLatch.await(3, TimeUnit.SECONDS); assertEquals(variants(VariantType.ANDRO... | @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> variantIDs = message.getCri... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... |
@Test public void testInvokesMetricsService(FlatPushMessageInformationDao pushMessageInformationDao) { router.submit(app, message); verify(pushMessageInformationDao).create(Mockito.any(FlatPushMessageInformation.class)); } | @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> variantIDs = message.getCri... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... |
@Test public void testVariantIDsSpecified(GenericVariantService genericVariantService) throws InterruptedException { countDownLatch = new CountDownLatch(2); iOSVariant iOSVariant = new iOSVariant(); iOSVariant.setId("id-ios-variant"); AndroidVariant androidVariant = new AndroidVariant(); androidVariant.setId("id-androi... | @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> variantIDs = message.getCri... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... | NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> varian... |
@Test public void noBadgePayload() throws IOException { final Map<String, Object> container = new LinkedHashMap<>(); final Map<String, Object> messageObject = new LinkedHashMap<>(); messageObject.put("alert", "Howdy"); messageObject.put("sound", "default"); Map<String, String> data = new HashMap<>(); data.put("someKey"... | public Message getMessage() { return message; } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonStrin... | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonStrin... |
@Test public void contentAvailable() throws IOException { final Map<String, Object> container = new LinkedHashMap<>(); final Map<String, Object> messageObject = new LinkedHashMap<>(); final Map<String, Object> apnsObject = new LinkedHashMap<>(); messageObject.put("alert", "Howdy"); messageObject.put("sound", "default")... | public Message getMessage() { return message; } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonStrin... | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonStrin... |
@Test public void noContentAvailable() throws IOException { final Map<String, Object> container = new LinkedHashMap<>(); final Map<String, Object> messageObject = new LinkedHashMap<>(); messageObject.put("alert", "Howdy"); messageObject.put("sound", "default"); Map<String, String> data = new HashMap<>(); data.put("some... | public Message getMessage() { return message; } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } } | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonStrin... | UnifiedPushMessage implements Serializable { public Message getMessage() { return message; } Criteria getCriteria(); void setCriteria(Criteria criteria); Config getConfig(); void setConfig(Config config); Message getMessage(); void setMessage(Message message); String toStrippedJsonString(); String toMinimizedJsonStrin... |
@Test public void testLogin() { loginController.login(userForm); verify(loginService).login(userForm); verifyNoMoreInteractions(loginService); } | public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } } | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } } | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } String login(UserForm userForm); ... | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } String login(UserForm userForm); ... |
@Test void testLoginKo() { when(loginRepository.login(any(UserForm.class))).thenReturn(false); assertFalse(loginService.login(userForm)); verify(loginRepository, times(1)).login(userForm); } | public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); if (login) { use... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... |
@Test void testLoginTwice() { when(loginRepository.login(userForm)).thenReturn(true); assertThrows(LoginException.class, () -> { loginService.login(userForm); loginService.login(userForm); }); } | public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); if (login) { use... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... |
@Test public void testLoginOk() { when(loginService.login(userForm)).thenReturn(true); assertEquals("OK", loginController.login(userForm)); verify(loginService).login(userForm); verifyNoMoreInteractions(loginService); } | public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } } | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } } | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } String login(UserForm userForm); ... | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } String login(UserForm userForm); ... |
@Test public void testLoginKo() { when(loginService.login(userForm)).thenReturn(false); assertEquals("KO", loginController.login(userForm)); } | public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } } | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } } | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } String login(UserForm userForm); ... | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } String login(UserForm userForm); ... |
@Test public void testLoginError() { assertEquals("ERROR", loginController.login(null)); } | public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } } | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } } | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } String login(UserForm userForm); ... | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } String login(UserForm userForm); ... |
@Test public void testLoginWithException() { when(loginService.login(userForm)) .thenThrow(IllegalArgumentException.class); assertEquals("ERROR", loginController.login(userForm)); } | public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } } | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } } | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } String login(UserForm userForm); ... | LoginController { public String login(UserForm userForm) { System.out.println("LoginController.login " + userForm); try { if (userForm == null) { return "ERROR"; } else if (loginService.login(userForm)) { return "OK"; } else { return "KO"; } } catch (Exception e) { return "ERROR"; } } String login(UserForm userForm); ... |
@Test public void testLogout() { loginController.logout(userForm); verify(loginService).logout(userForm); verifyNoMoreInteractions(loginService); } | public void logout(UserForm userForm) { System.out.println("LoginController.logout " + userForm); loginService.logout(userForm); } | LoginController { public void logout(UserForm userForm) { System.out.println("LoginController.logout " + userForm); loginService.logout(userForm); } } | LoginController { public void logout(UserForm userForm) { System.out.println("LoginController.logout " + userForm); loginService.logout(userForm); } } | LoginController { public void logout(UserForm userForm) { System.out.println("LoginController.logout " + userForm); loginService.logout(userForm); } String login(UserForm userForm); void logout(UserForm userForm); } | LoginController { public void logout(UserForm userForm) { System.out.println("LoginController.logout " + userForm); loginService.logout(userForm); } String login(UserForm userForm); void logout(UserForm userForm); public LoginService loginService; } |
@Test public void testServiceLoginOk() { when(loginRepository.login(any(UserForm.class))).thenReturn(true); assertTrue(loginService.login(userForm)); verify(loginRepository, atLeast(1)).login(userForm); verifyNoMoreInteractions(loginRepository); } | public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); if (login) { use... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... |
@Test public void testServiceLoginBad() { when(loginRepository.login(any(UserForm.class))).thenReturn(false); assertFalse(loginService.login(userForm)); verify(loginRepository, times(1)).login(userForm); verifyNoMoreInteractions(loginRepository); } | public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); if (login) { use... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... |
@Test(expected = LoginException.class) public void testServiceLoginTwice() { when(loginRepository.login(userForm)).thenReturn(true); loginService.login(userForm); loginService.login(userForm); } | public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); if (login) { use... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... |
@Test void testLoginOk() { when(loginRepository.login(any(UserForm.class))).thenReturn(true); assertTrue(loginService.login(userForm)); verify(loginRepository, atLeast(1)).login(userForm); } | public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); if (login) { use... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... | LoginService { public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); checkForm(userForm); String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } boolean login = loginRepository.login(userForm); i... |
@Test public void testSerializedPayload() throws IOException { Configuration conf = new Configuration(false); conf.setBoolean(MRJobConfig.MR_TEZ_INPUT_INITIALIZER_SERIALIZE_EVENT_PAYLOAD, true); ByteString confByteString = MRHelpers.createByteStringFromConf(conf); InputSplit split1 = new InputSplitForTest(1); InputSpli... | @Override public List<Event> initialize(TezRootInputInitializerContext rootInputContext) throws IOException { Stopwatch sw = null; if (LOG.isDebugEnabled()) { sw = new Stopwatch().start(); } MRInputUserPayloadProto userPayloadProto = MRHelpers.parseMRInputPayload(rootInputContext.getUserPayload()); if (LOG.isDebugEnabl... | MRInputSplitDistributor implements TezRootInputInitializer { @Override public List<Event> initialize(TezRootInputInitializerContext rootInputContext) throws IOException { Stopwatch sw = null; if (LOG.isDebugEnabled()) { sw = new Stopwatch().start(); } MRInputUserPayloadProto userPayloadProto = MRHelpers.parseMRInputPay... | MRInputSplitDistributor implements TezRootInputInitializer { @Override public List<Event> initialize(TezRootInputInitializerContext rootInputContext) throws IOException { Stopwatch sw = null; if (LOG.isDebugEnabled()) { sw = new Stopwatch().start(); } MRInputUserPayloadProto userPayloadProto = MRHelpers.parseMRInputPay... | MRInputSplitDistributor implements TezRootInputInitializer { @Override public List<Event> initialize(TezRootInputInitializerContext rootInputContext) throws IOException { Stopwatch sw = null; if (LOG.isDebugEnabled()) { sw = new Stopwatch().start(); } MRInputUserPayloadProto userPayloadProto = MRHelpers.parseMRInputPay... | MRInputSplitDistributor implements TezRootInputInitializer { @Override public List<Event> initialize(TezRootInputInitializerContext rootInputContext) throws IOException { Stopwatch sw = null; if (LOG.isDebugEnabled()) { sw = new Stopwatch().start(); } MRInputUserPayloadProto userPayloadProto = MRHelpers.parseMRInputPay... |
@Test public void testMRAMEnvironmentSetup() { Configuration conf = new Configuration(); conf.set(MRJobConfig.MR_AM_ADMIN_USER_ENV, "foo=bar,admin1=foo1"); conf.set(MRJobConfig.MR_AM_ENV, "foo=bar2,user=foo2"); Map<String, String> env = new HashMap<String, String>(); MRHelpers.updateEnvironmentForMRAM(conf, env); Asser... | public static void updateEnvironmentForMRAM(Configuration conf, Map<String, String> environment) { TezYARNUtils.appendToEnvFromInputString(environment, conf.get(MRJobConfig.MR_AM_ADMIN_USER_ENV), File.pathSeparator); TezYARNUtils.appendToEnvFromInputString(environment, conf.get(MRJobConfig.MR_AM_ENV), File.pathSeparato... | MRHelpers { public static void updateEnvironmentForMRAM(Configuration conf, Map<String, String> environment) { TezYARNUtils.appendToEnvFromInputString(environment, conf.get(MRJobConfig.MR_AM_ADMIN_USER_ENV), File.pathSeparator); TezYARNUtils.appendToEnvFromInputString(environment, conf.get(MRJobConfig.MR_AM_ENV), File.... | MRHelpers { public static void updateEnvironmentForMRAM(Configuration conf, Map<String, String> environment) { TezYARNUtils.appendToEnvFromInputString(environment, conf.get(MRJobConfig.MR_AM_ADMIN_USER_ENV), File.pathSeparator); TezYARNUtils.appendToEnvFromInputString(environment, conf.get(MRJobConfig.MR_AM_ENV), File.... | MRHelpers { public static void updateEnvironmentForMRAM(Configuration conf, Map<String, String> environment) { TezYARNUtils.appendToEnvFromInputString(environment, conf.get(MRJobConfig.MR_AM_ADMIN_USER_ENV), File.pathSeparator); TezYARNUtils.appendToEnvFromInputString(environment, conf.get(MRJobConfig.MR_AM_ENV), File.... | MRHelpers { public static void updateEnvironmentForMRAM(Configuration conf, Map<String, String> environment) { TezYARNUtils.appendToEnvFromInputString(environment, conf.get(MRJobConfig.MR_AM_ADMIN_USER_ENV), File.pathSeparator); TezYARNUtils.appendToEnvFromInputString(environment, conf.get(MRJobConfig.MR_AM_ENV), File.... |
@Test public void testReduceProcessor() throws Exception { final String dagName = "mrdag0"; String mapVertexName = MultiStageMRConfigUtil.getInitialMapVertexName(); String reduceVertexName = MultiStageMRConfigUtil.getFinalReduceVertexName(); JobConf jobConf = new JobConf(defaultConf); setUpJobConf(jobConf); MRHelpers.t... | public ReduceProcessor() { super(false); } | ReduceProcessor extends MRTask implements LogicalIOProcessor { public ReduceProcessor() { super(false); } } | ReduceProcessor extends MRTask implements LogicalIOProcessor { public ReduceProcessor() { super(false); } ReduceProcessor(); } | ReduceProcessor extends MRTask implements LogicalIOProcessor { public ReduceProcessor() { super(false); } ReduceProcessor(); @Override void initialize(TezProcessorContext processorContext); @Override void handleEvents(List<Event> processorEvents); void close(); @Override void run(Map<String, LogicalInput> inputs,
... | ReduceProcessor extends MRTask implements LogicalIOProcessor { public ReduceProcessor() { super(false); } ReduceProcessor(); @Override void initialize(TezProcessorContext processorContext); @Override void handleEvents(List<Event> processorEvents); void close(); @Override void run(Map<String, LogicalInput> inputs,
... |
@Test public void testMapProcessor() throws Exception { String dagName = "mrdag0"; String vertexName = MultiStageMRConfigUtil.getInitialMapVertexName(); JobConf jobConf = new JobConf(defaultConf); setUpJobConf(jobConf); MRHelpers.translateVertexConfToTez(jobConf); jobConf.setInt(MRJobConfig.APPLICATION_ATTEMPT_ID, 0); ... | public MapProcessor(){ super(true); } | MapProcessor extends MRTask implements LogicalIOProcessor { public MapProcessor(){ super(true); } } | MapProcessor extends MRTask implements LogicalIOProcessor { public MapProcessor(){ super(true); } MapProcessor(); } | MapProcessor extends MRTask implements LogicalIOProcessor { public MapProcessor(){ super(true); } MapProcessor(); @Override void initialize(TezProcessorContext processorContext); @Override void handleEvents(List<Event> processorEvents); void close(); @Override void run(Map<String, LogicalInput> inputs,
Map<String... | MapProcessor extends MRTask implements LogicalIOProcessor { public MapProcessor(){ super(true); } MapProcessor(); @Override void initialize(TezProcessorContext processorContext); @Override void handleEvents(List<Event> processorEvents); void close(); @Override void run(Map<String, LogicalInput> inputs,
Map<String... |
@Test public void testInMemAllocation() throws IOException { String localDirs = "/tmp/" + this.getClass().getName(); Configuration conf = new Configuration(); long jvmMax = Runtime.getRuntime().maxMemory(); LOG.info("jvmMax: " + jvmMax); float bufferPercent = 0.1f; conf.setFloat(TezJobConfig.TEZ_RUNTIME_SHUFFLE_INPUT_B... | @Override public synchronized FetchedInput allocate(long actualSize, long compressedSize, InputAttemptIdentifier inputAttemptIdentifier) throws IOException { if (actualSize > maxSingleShuffleLimit || this.usedMemory + actualSize > this.memoryLimit) { return new DiskFetchedInput(actualSize, compressedSize, inputAttemptI... | SimpleFetchedInputAllocator implements FetchedInputAllocator,
FetchedInputCallback { @Override public synchronized FetchedInput allocate(long actualSize, long compressedSize, InputAttemptIdentifier inputAttemptIdentifier) throws IOException { if (actualSize > maxSingleShuffleLimit || this.usedMemory + actualSize > ... | SimpleFetchedInputAllocator implements FetchedInputAllocator,
FetchedInputCallback { @Override public synchronized FetchedInput allocate(long actualSize, long compressedSize, InputAttemptIdentifier inputAttemptIdentifier) throws IOException { if (actualSize > maxSingleShuffleLimit || this.usedMemory + actualSize > ... | SimpleFetchedInputAllocator implements FetchedInputAllocator,
FetchedInputCallback { @Override public synchronized FetchedInput allocate(long actualSize, long compressedSize, InputAttemptIdentifier inputAttemptIdentifier) throws IOException { if (actualSize > maxSingleShuffleLimit || this.usedMemory + actualSize > ... | SimpleFetchedInputAllocator implements FetchedInputAllocator,
FetchedInputCallback { @Override public synchronized FetchedInput allocate(long actualSize, long compressedSize, InputAttemptIdentifier inputAttemptIdentifier) throws IOException { if (actualSize > maxSingleShuffleLimit || this.usedMemory + actualSize > ... |
@Test public void testSimple() throws IOException { TezInputContext inputContext = mock(TezInputContext.class); ShuffleManager shuffleManager = mock(ShuffleManager.class); FetchedInputAllocator inputAllocator = mock(FetchedInputAllocator.class); ShuffleInputEventHandlerImpl handler = new ShuffleInputEventHandlerImpl(in... | @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } | ShuffleInputEventHandlerImpl implements ShuffleEventHandler { @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } } | ShuffleInputEventHandlerImpl implements ShuffleEventHandler { @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } ShuffleInputEventHandlerImpl(TezInputContext inputContext,
ShuffleManager shuffleManager,
FetchedInputAllocator input... | ShuffleInputEventHandlerImpl implements ShuffleEventHandler { @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } ShuffleInputEventHandlerImpl(TezInputContext inputContext,
ShuffleManager shuffleManager,
FetchedInputAllocator input... | ShuffleInputEventHandlerImpl implements ShuffleEventHandler { @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } ShuffleInputEventHandlerImpl(TezInputContext inputContext,
ShuffleManager shuffleManager,
FetchedInputAllocator input... |
@Test public void testCurrentPartitionEmpty() throws IOException { TezInputContext inputContext = mock(TezInputContext.class); ShuffleManager shuffleManager = mock(ShuffleManager.class); FetchedInputAllocator inputAllocator = mock(FetchedInputAllocator.class); ShuffleInputEventHandlerImpl handler = new ShuffleInputEven... | @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } | ShuffleInputEventHandlerImpl implements ShuffleEventHandler { @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } } | ShuffleInputEventHandlerImpl implements ShuffleEventHandler { @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } ShuffleInputEventHandlerImpl(TezInputContext inputContext,
ShuffleManager shuffleManager,
FetchedInputAllocator input... | ShuffleInputEventHandlerImpl implements ShuffleEventHandler { @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } ShuffleInputEventHandlerImpl(TezInputContext inputContext,
ShuffleManager shuffleManager,
FetchedInputAllocator input... | ShuffleInputEventHandlerImpl implements ShuffleEventHandler { @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } ShuffleInputEventHandlerImpl(TezInputContext inputContext,
ShuffleManager shuffleManager,
FetchedInputAllocator input... |
@Test public void testOtherPartitionEmpty() throws IOException { TezInputContext inputContext = mock(TezInputContext.class); ShuffleManager shuffleManager = mock(ShuffleManager.class); FetchedInputAllocator inputAllocator = mock(FetchedInputAllocator.class); ShuffleInputEventHandlerImpl handler = new ShuffleInputEventH... | @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } | ShuffleInputEventHandlerImpl implements ShuffleEventHandler { @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } } | ShuffleInputEventHandlerImpl implements ShuffleEventHandler { @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } ShuffleInputEventHandlerImpl(TezInputContext inputContext,
ShuffleManager shuffleManager,
FetchedInputAllocator input... | ShuffleInputEventHandlerImpl implements ShuffleEventHandler { @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } ShuffleInputEventHandlerImpl(TezInputContext inputContext,
ShuffleManager shuffleManager,
FetchedInputAllocator input... | ShuffleInputEventHandlerImpl implements ShuffleEventHandler { @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } ShuffleInputEventHandlerImpl(TezInputContext inputContext,
ShuffleManager shuffleManager,
FetchedInputAllocator input... |
@Test public void testMultipleEvents1() throws IOException { TezInputContext inputContext = mock(TezInputContext.class); ShuffleManager shuffleManager = mock(ShuffleManager.class); FetchedInputAllocator inputAllocator = mock(FetchedInputAllocator.class); ShuffleInputEventHandlerImpl handler = new ShuffleInputEventHandl... | @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } | ShuffleInputEventHandlerImpl implements ShuffleEventHandler { @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } } | ShuffleInputEventHandlerImpl implements ShuffleEventHandler { @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } ShuffleInputEventHandlerImpl(TezInputContext inputContext,
ShuffleManager shuffleManager,
FetchedInputAllocator input... | ShuffleInputEventHandlerImpl implements ShuffleEventHandler { @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } ShuffleInputEventHandlerImpl(TezInputContext inputContext,
ShuffleManager shuffleManager,
FetchedInputAllocator input... | ShuffleInputEventHandlerImpl implements ShuffleEventHandler { @Override public void handleEvents(List<Event> events) throws IOException { for (Event event : events) { handleEvent(event); } } ShuffleInputEventHandlerImpl(TezInputContext inputContext,
ShuffleManager shuffleManager,
FetchedInputAllocator input... |
@Test public void testNullParams() { try { ShuffledMergedInputConfiguration.newBuilder(null, "VALUE"); fail("Expecting a null parameter list to fail"); } catch (NullPointerException npe) { assertTrue(npe.getMessage().contains("cannot be null")); } try { ShuffledMergedInputConfiguration.newBuilder("KEY", null); fail("Ex... | public static Builder newBuilder(String keyClass, String valueClass) { return new Builder(keyClass, valueClass); } | ShuffledMergedInputConfiguration { public static Builder newBuilder(String keyClass, String valueClass) { return new Builder(keyClass, valueClass); } } | ShuffledMergedInputConfiguration { public static Builder newBuilder(String keyClass, String valueClass) { return new Builder(keyClass, valueClass); } @InterfaceAudience.Private @VisibleForTesting ShuffledMergedInputConfiguration(); private ShuffledMergedInputConfiguration(Configuration conf, boolean useLegacyInput); ... | ShuffledMergedInputConfiguration { public static Builder newBuilder(String keyClass, String valueClass) { return new Builder(keyClass, valueClass); } @InterfaceAudience.Private @VisibleForTesting ShuffledMergedInputConfiguration(); private ShuffledMergedInputConfiguration(Configuration conf, boolean useLegacyInput); ... | ShuffledMergedInputConfiguration { public static Builder newBuilder(String keyClass, String valueClass) { return new Builder(keyClass, valueClass); } @InterfaceAudience.Private @VisibleForTesting ShuffledMergedInputConfiguration(); private ShuffledMergedInputConfiguration(Configuration conf, boolean useLegacyInput); ... |
@Test public void testNullParams() { try { OnFileUnorderedKVOutputConfiguration.newBuilder( null, "VALUE"); fail("Expecting a null parameter list to fail"); } catch (NullPointerException npe) { assertTrue(npe.getMessage().contains("cannot be null")); } try { OnFileUnorderedKVOutputConfiguration.newBuilder( "KEY", null)... | public static Builder newBuilder(String keyClass, String valClass) { return new Builder(keyClass, valClass); } | OnFileUnorderedKVOutputConfiguration { public static Builder newBuilder(String keyClass, String valClass) { return new Builder(keyClass, valClass); } } | OnFileUnorderedKVOutputConfiguration { public static Builder newBuilder(String keyClass, String valClass) { return new Builder(keyClass, valClass); } @InterfaceAudience.Private @VisibleForTesting OnFileUnorderedKVOutputConfiguration(); private OnFileUnorderedKVOutputConfiguration(Configuration conf); } | OnFileUnorderedKVOutputConfiguration { public static Builder newBuilder(String keyClass, String valClass) { return new Builder(keyClass, valClass); } @InterfaceAudience.Private @VisibleForTesting OnFileUnorderedKVOutputConfiguration(); private OnFileUnorderedKVOutputConfiguration(Configuration conf); byte[] toByteArr... | OnFileUnorderedKVOutputConfiguration { public static Builder newBuilder(String keyClass, String valClass) { return new Builder(keyClass, valClass); } @InterfaceAudience.Private @VisibleForTesting OnFileUnorderedKVOutputConfiguration(); private OnFileUnorderedKVOutputConfiguration(Configuration conf); byte[] toByteArr... |
@Test public void testDeserializedPayload() throws IOException { Configuration conf = new Configuration(false); conf.setBoolean(MRJobConfig.MR_TEZ_INPUT_INITIALIZER_SERIALIZE_EVENT_PAYLOAD, false); ByteString confByteString = MRHelpers.createByteStringFromConf(conf); InputSplit split1 = new InputSplitForTest(1); InputS... | @Override public List<Event> initialize(TezRootInputInitializerContext rootInputContext) throws IOException { Stopwatch sw = null; if (LOG.isDebugEnabled()) { sw = new Stopwatch().start(); } MRInputUserPayloadProto userPayloadProto = MRHelpers.parseMRInputPayload(rootInputContext.getUserPayload()); if (LOG.isDebugEnabl... | MRInputSplitDistributor implements TezRootInputInitializer { @Override public List<Event> initialize(TezRootInputInitializerContext rootInputContext) throws IOException { Stopwatch sw = null; if (LOG.isDebugEnabled()) { sw = new Stopwatch().start(); } MRInputUserPayloadProto userPayloadProto = MRHelpers.parseMRInputPay... | MRInputSplitDistributor implements TezRootInputInitializer { @Override public List<Event> initialize(TezRootInputInitializerContext rootInputContext) throws IOException { Stopwatch sw = null; if (LOG.isDebugEnabled()) { sw = new Stopwatch().start(); } MRInputUserPayloadProto userPayloadProto = MRHelpers.parseMRInputPay... | MRInputSplitDistributor implements TezRootInputInitializer { @Override public List<Event> initialize(TezRootInputInitializerContext rootInputContext) throws IOException { Stopwatch sw = null; if (LOG.isDebugEnabled()) { sw = new Stopwatch().start(); } MRInputUserPayloadProto userPayloadProto = MRHelpers.parseMRInputPay... | MRInputSplitDistributor implements TezRootInputInitializer { @Override public List<Event> initialize(TezRootInputInitializerContext rootInputContext) throws IOException { Stopwatch sw = null; if (LOG.isDebugEnabled()) { sw = new Stopwatch().start(); } MRInputUserPayloadProto userPayloadProto = MRHelpers.parseMRInputPay... |
@Test public void testNullParams() { try { UnorderedUnpartitionedKVEdgeConfigurer.newBuilder(null, "VALUE"); fail("Expecting a null parameter list to fail"); } catch (NullPointerException npe) { assertTrue(npe.getMessage().contains("cannot be null")); } try { UnorderedUnpartitionedKVEdgeConfigurer.newBuilder("KEY", nul... | public static Builder newBuilder(String keyClassName, String valueClassName) { return new Builder(keyClassName, valueClassName); } | UnorderedUnpartitionedKVEdgeConfigurer extends HadoopKeyValuesBasedBaseConf { public static Builder newBuilder(String keyClassName, String valueClassName) { return new Builder(keyClassName, valueClassName); } } | UnorderedUnpartitionedKVEdgeConfigurer extends HadoopKeyValuesBasedBaseConf { public static Builder newBuilder(String keyClassName, String valueClassName) { return new Builder(keyClassName, valueClassName); } private UnorderedUnpartitionedKVEdgeConfigurer(
OnFileUnorderedKVOutputConfiguration outputConfiguration... | UnorderedUnpartitionedKVEdgeConfigurer extends HadoopKeyValuesBasedBaseConf { public static Builder newBuilder(String keyClassName, String valueClassName) { return new Builder(keyClassName, valueClassName); } private UnorderedUnpartitionedKVEdgeConfigurer(
OnFileUnorderedKVOutputConfiguration outputConfiguration... | UnorderedUnpartitionedKVEdgeConfigurer extends HadoopKeyValuesBasedBaseConf { public static Builder newBuilder(String keyClassName, String valueClassName) { return new Builder(keyClassName, valueClassName); } private UnorderedUnpartitionedKVEdgeConfigurer(
OnFileUnorderedKVOutputConfiguration outputConfiguration... |
@Test public void testNullParams() { try { OrderedPartitionedKVEdgeConfigurer.newBuilder(null, "VALUE", "PARTITIONER", null); fail("Expecting a null parameter list to fail"); } catch (NullPointerException npe) { assertTrue(npe.getMessage().contains("cannot be null")); } try { OrderedPartitionedKVEdgeConfigurer.newBuild... | public static Builder newBuilder(String keyClassName, String valueClassName, String partitionerClassName, Configuration partitionerConf) { return new Builder(keyClassName, valueClassName, partitionerClassName, partitionerConf); } | OrderedPartitionedKVEdgeConfigurer extends HadoopKeyValuesBasedBaseConf { public static Builder newBuilder(String keyClassName, String valueClassName, String partitionerClassName, Configuration partitionerConf) { return new Builder(keyClassName, valueClassName, partitionerClassName, partitionerConf); } } | OrderedPartitionedKVEdgeConfigurer extends HadoopKeyValuesBasedBaseConf { public static Builder newBuilder(String keyClassName, String valueClassName, String partitionerClassName, Configuration partitionerConf) { return new Builder(keyClassName, valueClassName, partitionerClassName, partitionerConf); } private Ordered... | OrderedPartitionedKVEdgeConfigurer extends HadoopKeyValuesBasedBaseConf { public static Builder newBuilder(String keyClassName, String valueClassName, String partitionerClassName, Configuration partitionerConf) { return new Builder(keyClassName, valueClassName, partitionerClassName, partitionerConf); } private Ordered... | OrderedPartitionedKVEdgeConfigurer extends HadoopKeyValuesBasedBaseConf { public static Builder newBuilder(String keyClassName, String valueClassName, String partitionerClassName, Configuration partitionerConf) { return new Builder(keyClassName, valueClassName, partitionerClassName, partitionerConf); } private Ordered... |
@Test public void testNullParams() { try { OnFileSortedOutputConfiguration.newBuilder( null, "VALUE", "PARTITIONER", null); fail("Expecting a null parameter list to fail"); } catch (NullPointerException npe) { assertTrue(npe.getMessage().contains("cannot be null")); } try { OnFileSortedOutputConfiguration.newBuilder( "... | public static Builder newBuilder(String keyClass, String valueClass, String partitionerClassName, Configuration partitionerConf) { return new Builder(keyClass, valueClass, partitionerClassName, partitionerConf); } | OnFileSortedOutputConfiguration { public static Builder newBuilder(String keyClass, String valueClass, String partitionerClassName, Configuration partitionerConf) { return new Builder(keyClass, valueClass, partitionerClassName, partitionerConf); } } | OnFileSortedOutputConfiguration { public static Builder newBuilder(String keyClass, String valueClass, String partitionerClassName, Configuration partitionerConf) { return new Builder(keyClass, valueClass, partitionerClassName, partitionerConf); } @InterfaceAudience.Private @VisibleForTesting OnFileSortedOutputConfigu... | OnFileSortedOutputConfiguration { public static Builder newBuilder(String keyClass, String valueClass, String partitionerClassName, Configuration partitionerConf) { return new Builder(keyClass, valueClass, partitionerClassName, partitionerConf); } @InterfaceAudience.Private @VisibleForTesting OnFileSortedOutputConfigu... | OnFileSortedOutputConfiguration { public static Builder newBuilder(String keyClass, String valueClass, String partitionerClassName, Configuration partitionerConf) { return new Builder(keyClass, valueClass, partitionerClassName, partitionerConf); } @InterfaceAudience.Private @VisibleForTesting OnFileSortedOutputConfigu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.