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 testGetExtraTitleReturnsValueIfExists() { String expectedTitle = "My Title"; Intent testIntent = new Intent(); testIntent.putExtra(Gateway3DSecureActivity.EXTRA_TITLE, expectedTitle); doReturn(testIntent).when(activity).getIntent(); String title = activity.getExtraTitle(); assertEquals(expectedTitle, ... | String getExtraTitle() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_TITLE); } return null; } | Gateway3DSecureActivity extends AppCompatActivity { String getExtraTitle() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_TITLE); } return null; } } | Gateway3DSecureActivity extends AppCompatActivity { String getExtraTitle() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_TITLE); } return null; } } | Gateway3DSecureActivity extends AppCompatActivity { String getExtraTitle() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_TITLE); } return null; } } | Gateway3DSecureActivity extends AppCompatActivity { String getExtraTitle() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_TITLE); } return null; } static final String EXTRA_HTML; static final String EXTRA_TITLE; static final String EXTRA_ACS_RESULT; } |
@Test public void testHandle3DSecureResultCallsCancelIfResultNotOk() { int validRequestCode = Gateway.REQUEST_3D_SECURE; int resultCode = Activity.RESULT_CANCELED; Gateway3DSecureCallback callback = mock(Gateway3DSecureCallback.class); boolean result = Gateway.handle3DSecureResult(validRequestCode, resultCode, null, ca... | public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivity.EXTRA_AC... | Gateway { public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivit... | Gateway { public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivit... | Gateway { public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivit... | Gateway { public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivit... |
@Test public void testHandle3DSecureResultCallsCompleteIfResultOK() { int validRequestCode = Gateway.REQUEST_3D_SECURE; int resultCode = Activity.RESULT_OK; Intent data = mock(Intent.class); String acsResultJson = "{\"foo\":\"bar\"}"; Gateway3DSecureCallback callback = spy(new Gateway3DSecureCallback() { @Override publ... | public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivity.EXTRA_AC... | Gateway { public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivit... | Gateway { public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivit... | Gateway { public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivit... | Gateway { public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivit... |
@Test public void testHandleGooglePayResultReturnsFalseWithNullCallback() { assertFalse(Gateway.handleGooglePayResult(0, 0, null, null)); } | public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.getFromInt... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... |
@Test public void testHandleGooglePayResultReturnsFalseIfInvalidRequestCode() { int invalidRequestCode = 10; GatewayGooglePayCallback callback = mock(GatewayGooglePayCallback.class); assertFalse(Gateway.handleGooglePayResult(invalidRequestCode, 0, null, callback)); } | public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.getFromInt... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... |
@Test public void testHandleGooglePayResultCallsError() { int requestCode = Gateway.REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA; int resultCode = AutoResolveHelper.RESULT_ERROR; Status mockStatus = mock(Status.class); Intent mockData = mock(Intent.class); doReturn(mockStatus).when(mockData).getParcelableExtra("com.google.andr... | public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.getFromInt... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... |
@Test public void testHandleGooglePayResultCallsCancelled() { int requestCode = Gateway.REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA; int resultCode = Activity.RESULT_CANCELED; GatewayGooglePayCallback callback = mock(GatewayGooglePayCallback.class); boolean result = Gateway.handleGooglePayResult(requestCode, resultCode, null,... | public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.getFromInt... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... |
@Test public void testHandleGooglePayResultCallsPaymentDataOnSuccess() { int requestCode = Gateway.REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA; int resultCode = Activity.RESULT_OK; PaymentData pData = PaymentData.fromJson("{}"); Intent data = new Intent(); pData.putIntoIntent(data); GatewayGooglePayCallback callback = mock(Ga... | public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.getFromInt... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... | Gateway { public static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_GOOGLE_PAY_LOAD_PAYMENT_DATA) { if (resultCode == Activity.RESULT_OK) { try { PaymentData paymentData = PaymentData.... |
@Test public void testGetApiUrlThrowsExceptionIfRegionIsNull() throws Exception { String apiVersion = "44"; gateway.region = null; try { String apiUrl = gateway.getApiUrl(apiVersion); fail("Null region should have caused illegal state exception"); } catch (Exception e) { assertTrue(e instanceof IllegalStateException); ... | String getApiUrl(String apiVersion) { if (Integer.valueOf(apiVersion) < MIN_API_VERSION) { throw new IllegalArgumentException("API version must be >= " + MIN_API_VERSION); } if (region == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Region before use"); } return "https: } | Gateway { String getApiUrl(String apiVersion) { if (Integer.valueOf(apiVersion) < MIN_API_VERSION) { throw new IllegalArgumentException("API version must be >= " + MIN_API_VERSION); } if (region == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Region before use"); } return... | Gateway { String getApiUrl(String apiVersion) { if (Integer.valueOf(apiVersion) < MIN_API_VERSION) { throw new IllegalArgumentException("API version must be >= " + MIN_API_VERSION); } if (region == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Region before use"); } return... | Gateway { String getApiUrl(String apiVersion) { if (Integer.valueOf(apiVersion) < MIN_API_VERSION) { throw new IllegalArgumentException("API version must be >= " + MIN_API_VERSION); } if (region == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Region before use"); } return... | Gateway { String getApiUrl(String apiVersion) { if (Integer.valueOf(apiVersion) < MIN_API_VERSION) { throw new IllegalArgumentException("API version must be >= " + MIN_API_VERSION); } if (region == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Region before use"); } return... |
@Test public void testGetApiUrlThrowsExceptionIfApiVersionIsLessThanMin() throws Exception { String apiVersion = String.valueOf(Gateway.MIN_API_VERSION - 1); try { String apiUrl = gateway.getApiUrl(apiVersion); fail("Api version less than minimum value should have caused illegal argument exception"); } catch (Exception... | String getApiUrl(String apiVersion) { if (Integer.valueOf(apiVersion) < MIN_API_VERSION) { throw new IllegalArgumentException("API version must be >= " + MIN_API_VERSION); } if (region == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Region before use"); } return "https: } | Gateway { String getApiUrl(String apiVersion) { if (Integer.valueOf(apiVersion) < MIN_API_VERSION) { throw new IllegalArgumentException("API version must be >= " + MIN_API_VERSION); } if (region == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Region before use"); } return... | Gateway { String getApiUrl(String apiVersion) { if (Integer.valueOf(apiVersion) < MIN_API_VERSION) { throw new IllegalArgumentException("API version must be >= " + MIN_API_VERSION); } if (region == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Region before use"); } return... | Gateway { String getApiUrl(String apiVersion) { if (Integer.valueOf(apiVersion) < MIN_API_VERSION) { throw new IllegalArgumentException("API version must be >= " + MIN_API_VERSION); } if (region == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Region before use"); } return... | Gateway { String getApiUrl(String apiVersion) { if (Integer.valueOf(apiVersion) < MIN_API_VERSION) { throw new IllegalArgumentException("API version must be >= " + MIN_API_VERSION); } if (region == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Region before use"); } return... |
@Test public void testGetApiUrlWorksAsIntended() throws Exception { gateway.region = Gateway.Region.NORTH_AMERICA; String expectedUrl = "https: assertEquals(expectedUrl, gateway.getApiUrl(String.valueOf(Gateway.MIN_API_VERSION))); } | String getApiUrl(String apiVersion) { if (Integer.valueOf(apiVersion) < MIN_API_VERSION) { throw new IllegalArgumentException("API version must be >= " + MIN_API_VERSION); } if (region == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Region before use"); } return "https: } | Gateway { String getApiUrl(String apiVersion) { if (Integer.valueOf(apiVersion) < MIN_API_VERSION) { throw new IllegalArgumentException("API version must be >= " + MIN_API_VERSION); } if (region == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Region before use"); } return... | Gateway { String getApiUrl(String apiVersion) { if (Integer.valueOf(apiVersion) < MIN_API_VERSION) { throw new IllegalArgumentException("API version must be >= " + MIN_API_VERSION); } if (region == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Region before use"); } return... | Gateway { String getApiUrl(String apiVersion) { if (Integer.valueOf(apiVersion) < MIN_API_VERSION) { throw new IllegalArgumentException("API version must be >= " + MIN_API_VERSION); } if (region == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Region before use"); } return... | Gateway { String getApiUrl(String apiVersion) { if (Integer.valueOf(apiVersion) < MIN_API_VERSION) { throw new IllegalArgumentException("API version must be >= " + MIN_API_VERSION); } if (region == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Region before use"); } return... |
@Test public void testGetExtraHtmlReturnsNullIfMissing() { Intent testIntent = new Intent(); doReturn(testIntent).when(activity).getIntent(); String html = activity.getExtraHtml(); assertNull(html); } | String getExtraHtml() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_HTML); } return null; } | Gateway3DSecureActivity extends AppCompatActivity { String getExtraHtml() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_HTML); } return null; } } | Gateway3DSecureActivity extends AppCompatActivity { String getExtraHtml() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_HTML); } return null; } } | Gateway3DSecureActivity extends AppCompatActivity { String getExtraHtml() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_HTML); } return null; } } | Gateway3DSecureActivity extends AppCompatActivity { String getExtraHtml() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_HTML); } return null; } static final String EXTRA_HTML; static final String EXTRA_TITLE; static final String EXTRA_ACS_RESULT; } |
@Test public void testGetUpdateSessionUrlThrowsExceptionIfSessionIdIsNull() throws Exception { try { gateway.getUpdateSessionUrl(null, String.valueOf(Gateway.MIN_API_VERSION)); fail("Null session id should throw illegal argument exception"); } catch (Exception e) { assertTrue(e instanceof IllegalArgumentException); } } | String getUpdateSessionUrl(String sessionId, String apiVersion) { if (sessionId == null) { throw new IllegalArgumentException("Session Id may not be null"); } if (merchantId == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Merchant Id before use"); } return getApiUrl(apiVe... | Gateway { String getUpdateSessionUrl(String sessionId, String apiVersion) { if (sessionId == null) { throw new IllegalArgumentException("Session Id may not be null"); } if (merchantId == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Merchant Id before use"); } return getAp... | Gateway { String getUpdateSessionUrl(String sessionId, String apiVersion) { if (sessionId == null) { throw new IllegalArgumentException("Session Id may not be null"); } if (merchantId == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Merchant Id before use"); } return getAp... | Gateway { String getUpdateSessionUrl(String sessionId, String apiVersion) { if (sessionId == null) { throw new IllegalArgumentException("Session Id may not be null"); } if (merchantId == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Merchant Id before use"); } return getAp... | Gateway { String getUpdateSessionUrl(String sessionId, String apiVersion) { if (sessionId == null) { throw new IllegalArgumentException("Session Id may not be null"); } if (merchantId == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Merchant Id before use"); } return getAp... |
@Test public void testGetUpdateSessionUrlThrowsExceptionIfMerchantIdIsNull() throws Exception { gateway.merchantId = null; try { String url = gateway.getUpdateSessionUrl("sess1234", String.valueOf(Gateway.MIN_API_VERSION)); fail("Null merchant id should have caused illegal state exception"); } catch (Exception e) { ass... | String getUpdateSessionUrl(String sessionId, String apiVersion) { if (sessionId == null) { throw new IllegalArgumentException("Session Id may not be null"); } if (merchantId == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Merchant Id before use"); } return getApiUrl(apiVe... | Gateway { String getUpdateSessionUrl(String sessionId, String apiVersion) { if (sessionId == null) { throw new IllegalArgumentException("Session Id may not be null"); } if (merchantId == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Merchant Id before use"); } return getAp... | Gateway { String getUpdateSessionUrl(String sessionId, String apiVersion) { if (sessionId == null) { throw new IllegalArgumentException("Session Id may not be null"); } if (merchantId == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Merchant Id before use"); } return getAp... | Gateway { String getUpdateSessionUrl(String sessionId, String apiVersion) { if (sessionId == null) { throw new IllegalArgumentException("Session Id may not be null"); } if (merchantId == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Merchant Id before use"); } return getAp... | Gateway { String getUpdateSessionUrl(String sessionId, String apiVersion) { if (sessionId == null) { throw new IllegalArgumentException("Session Id may not be null"); } if (merchantId == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Merchant Id before use"); } return getAp... |
@Test public void testGetUpdateSessionUrlWorksAsIntended() throws Exception { gateway.merchantId = "somemerchant"; gateway.region = Gateway.Region.NORTH_AMERICA; String expectedUrl = "https: String actualUrl = gateway.getUpdateSessionUrl("sess1234", String.valueOf(Gateway.MIN_API_VERSION)); assertEquals(expectedUrl, ac... | String getUpdateSessionUrl(String sessionId, String apiVersion) { if (sessionId == null) { throw new IllegalArgumentException("Session Id may not be null"); } if (merchantId == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Merchant Id before use"); } return getApiUrl(apiVe... | Gateway { String getUpdateSessionUrl(String sessionId, String apiVersion) { if (sessionId == null) { throw new IllegalArgumentException("Session Id may not be null"); } if (merchantId == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Merchant Id before use"); } return getAp... | Gateway { String getUpdateSessionUrl(String sessionId, String apiVersion) { if (sessionId == null) { throw new IllegalArgumentException("Session Id may not be null"); } if (merchantId == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Merchant Id before use"); } return getAp... | Gateway { String getUpdateSessionUrl(String sessionId, String apiVersion) { if (sessionId == null) { throw new IllegalArgumentException("Session Id may not be null"); } if (merchantId == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Merchant Id before use"); } return getAp... | Gateway { String getUpdateSessionUrl(String sessionId, String apiVersion) { if (sessionId == null) { throw new IllegalArgumentException("Session Id may not be null"); } if (merchantId == null) { throw new IllegalStateException("You must initialize the the Gateway instance with a Merchant Id before use"); } return getAp... |
@Test public void testHandleCallbackMessageCallsOnErrorWithThrowableArg() throws Exception { GatewayCallback callback = mock(GatewayCallback.class); Throwable arg = new Exception("Some exception"); gateway.handleCallbackMessage(callback, arg); verify(callback).onError(arg); } | @SuppressWarnings("unchecked") boolean handleCallbackMessage(GatewayCallback callback, Object arg) { if (callback != null) { if (arg instanceof Throwable) { callback.onError((Throwable) arg); } else { callback.onSuccess((GatewayMap) arg); } } return true; } | Gateway { @SuppressWarnings("unchecked") boolean handleCallbackMessage(GatewayCallback callback, Object arg) { if (callback != null) { if (arg instanceof Throwable) { callback.onError((Throwable) arg); } else { callback.onSuccess((GatewayMap) arg); } } return true; } } | Gateway { @SuppressWarnings("unchecked") boolean handleCallbackMessage(GatewayCallback callback, Object arg) { if (callback != null) { if (arg instanceof Throwable) { callback.onError((Throwable) arg); } else { callback.onSuccess((GatewayMap) arg); } } return true; } Gateway(); } | Gateway { @SuppressWarnings("unchecked") boolean handleCallbackMessage(GatewayCallback callback, Object arg) { if (callback != null) { if (arg instanceof Throwable) { callback.onError((Throwable) arg); } else { callback.onSuccess((GatewayMap) arg); } } return true; } Gateway(); String getMerchantId(); Gateway setMercha... | Gateway { @SuppressWarnings("unchecked") boolean handleCallbackMessage(GatewayCallback callback, Object arg) { if (callback != null) { if (arg instanceof Throwable) { callback.onError((Throwable) arg); } else { callback.onSuccess((GatewayMap) arg); } } return true; } Gateway(); String getMerchantId(); Gateway setMercha... |
@Test public void testHandleCallbackMessageCallsSuccessWithNonThrowableArg() throws Exception { GatewayCallback callback = mock(GatewayCallback.class); GatewayMap arg = mock(GatewayMap.class); gateway.handleCallbackMessage(callback, arg); verify(callback).onSuccess(arg); } | @SuppressWarnings("unchecked") boolean handleCallbackMessage(GatewayCallback callback, Object arg) { if (callback != null) { if (arg instanceof Throwable) { callback.onError((Throwable) arg); } else { callback.onSuccess((GatewayMap) arg); } } return true; } | Gateway { @SuppressWarnings("unchecked") boolean handleCallbackMessage(GatewayCallback callback, Object arg) { if (callback != null) { if (arg instanceof Throwable) { callback.onError((Throwable) arg); } else { callback.onSuccess((GatewayMap) arg); } } return true; } } | Gateway { @SuppressWarnings("unchecked") boolean handleCallbackMessage(GatewayCallback callback, Object arg) { if (callback != null) { if (arg instanceof Throwable) { callback.onError((Throwable) arg); } else { callback.onSuccess((GatewayMap) arg); } } return true; } Gateway(); } | Gateway { @SuppressWarnings("unchecked") boolean handleCallbackMessage(GatewayCallback callback, Object arg) { if (callback != null) { if (arg instanceof Throwable) { callback.onError((Throwable) arg); } else { callback.onSuccess((GatewayMap) arg); } } return true; } Gateway(); String getMerchantId(); Gateway setMercha... | Gateway { @SuppressWarnings("unchecked") boolean handleCallbackMessage(GatewayCallback callback, Object arg) { if (callback != null) { if (arg instanceof Throwable) { callback.onError((Throwable) arg); } else { callback.onSuccess((GatewayMap) arg); } } return true; } Gateway(); String getMerchantId(); Gateway setMercha... |
@Test public void testIsStatusOkWorksAsIntended() { int tooLow = 199; int tooHigh = 300; int justRight = 200; assertFalse(gateway.isStatusCodeOk(tooLow)); assertFalse(gateway.isStatusCodeOk(tooHigh)); assertTrue(gateway.isStatusCodeOk(justRight)); } | boolean isStatusCodeOk(int statusCode) { return (statusCode >= 200 && statusCode < 300); } | Gateway { boolean isStatusCodeOk(int statusCode) { return (statusCode >= 200 && statusCode < 300); } } | Gateway { boolean isStatusCodeOk(int statusCode) { return (statusCode >= 200 && statusCode < 300); } Gateway(); } | Gateway { boolean isStatusCodeOk(int statusCode) { return (statusCode >= 200 && statusCode < 300); } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Region region); void updateSession(String sessionId, String apiVersion, GatewayMap payload, GatewayCallb... | Gateway { boolean isStatusCodeOk(int statusCode) { return (statusCode >= 200 && statusCode < 300); } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Region region); void updateSession(String sessionId, String apiVersion, GatewayMap payload, GatewayCallb... |
@Test public void testInputStreamToStringWorksAsExpected() { String expectedResult = "here is some string data"; InputStream testInputStream = new StringInputStream(expectedResult); try { String result = gateway.inputStreamToString(testInputStream); assertEquals(expectedResult, result); } catch (IOException e) { fail(e... | String inputStreamToString(InputStream is) throws IOException { BufferedReader rd = new BufferedReader(new InputStreamReader(is)); StringBuilder total = new StringBuilder(); String line; while ((line = rd.readLine()) != null) { total.append(line); } return total.toString(); } | Gateway { String inputStreamToString(InputStream is) throws IOException { BufferedReader rd = new BufferedReader(new InputStreamReader(is)); StringBuilder total = new StringBuilder(); String line; while ((line = rd.readLine()) != null) { total.append(line); } return total.toString(); } } | Gateway { String inputStreamToString(InputStream is) throws IOException { BufferedReader rd = new BufferedReader(new InputStreamReader(is)); StringBuilder total = new StringBuilder(); String line; while ((line = rd.readLine()) != null) { total.append(line); } return total.toString(); } Gateway(); } | Gateway { String inputStreamToString(InputStream is) throws IOException { BufferedReader rd = new BufferedReader(new InputStreamReader(is)); StringBuilder total = new StringBuilder(); String line; while ((line = rd.readLine()) != null) { total.append(line); } return total.toString(); } Gateway(); String getMerchantId()... | Gateway { String inputStreamToString(InputStream is) throws IOException { BufferedReader rd = new BufferedReader(new InputStreamReader(is)); StringBuilder total = new StringBuilder(); String line; while ((line = rd.readLine()) != null) { total.append(line); } return total.toString(); } Gateway(); String getMerchantId()... |
@Test public void testCreateAuthHeaderWorksAsExpected() { String sessionId = "somesession"; gateway.merchantId = "MERCHANT_ID"; String expectedAuthHeader = "Basic bWVyY2hhbnQuTUVSQ0hBTlRfSUQ6c29tZXNlc3Npb24="; String authHeader = gateway.createAuthHeader(sessionId); assertEquals(expectedAuthHeader, authHeader); } | String createAuthHeader(String sessionId) { String value = "merchant." + merchantId + ":" + sessionId; return "Basic " + Base64.encodeToString(value.getBytes(), Base64.NO_WRAP); } | Gateway { String createAuthHeader(String sessionId) { String value = "merchant." + merchantId + ":" + sessionId; return "Basic " + Base64.encodeToString(value.getBytes(), Base64.NO_WRAP); } } | Gateway { String createAuthHeader(String sessionId) { String value = "merchant." + merchantId + ":" + sessionId; return "Basic " + Base64.encodeToString(value.getBytes(), Base64.NO_WRAP); } Gateway(); } | Gateway { String createAuthHeader(String sessionId) { String value = "merchant." + merchantId + ":" + sessionId; return "Basic " + Base64.encodeToString(value.getBytes(), Base64.NO_WRAP); } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Region region);... | Gateway { String createAuthHeader(String sessionId) { String value = "merchant." + merchantId + ":" + sessionId; return "Basic " + Base64.encodeToString(value.getBytes(), Base64.NO_WRAP); } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Region region);... |
@Test public void testGetExtraHtmlReturnsValueIfExists() { String expectedHtml = "<html></html>"; Intent testIntent = new Intent(); testIntent.putExtra(Gateway3DSecureActivity.EXTRA_HTML, expectedHtml); doReturn(testIntent).when(activity).getIntent(); String html = activity.getExtraHtml(); assertEquals(expectedHtml, ht... | String getExtraHtml() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_HTML); } return null; } | Gateway3DSecureActivity extends AppCompatActivity { String getExtraHtml() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_HTML); } return null; } } | Gateway3DSecureActivity extends AppCompatActivity { String getExtraHtml() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_HTML); } return null; } } | Gateway3DSecureActivity extends AppCompatActivity { String getExtraHtml() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_HTML); } return null; } } | Gateway3DSecureActivity extends AppCompatActivity { String getExtraHtml() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_HTML); } return null; } static final String EXTRA_HTML; static final String EXTRA_TITLE; static final String EXTRA_ACS_RESULT; } |
@Test public void testSetWebViewHtmlEncodesBase64() { String testHtml = "<html></html>"; String expectedEncodedHtml = "PGh0bWw+PC9odG1sPg"; activity.webView = mock(WebView.class); activity.setWebViewHtml(testHtml); verify(activity.webView).loadData(expectedEncodedHtml, "text/html", "base64"); } | void setWebViewHtml(String html) { String encoded = Base64.encodeToString(html.getBytes(), Base64.NO_PADDING | Base64.NO_WRAP); webView.loadData(encoded, "text/html", "base64"); } | Gateway3DSecureActivity extends AppCompatActivity { void setWebViewHtml(String html) { String encoded = Base64.encodeToString(html.getBytes(), Base64.NO_PADDING | Base64.NO_WRAP); webView.loadData(encoded, "text/html", "base64"); } } | Gateway3DSecureActivity extends AppCompatActivity { void setWebViewHtml(String html) { String encoded = Base64.encodeToString(html.getBytes(), Base64.NO_PADDING | Base64.NO_WRAP); webView.loadData(encoded, "text/html", "base64"); } } | Gateway3DSecureActivity extends AppCompatActivity { void setWebViewHtml(String html) { String encoded = Base64.encodeToString(html.getBytes(), Base64.NO_PADDING | Base64.NO_WRAP); webView.loadData(encoded, "text/html", "base64"); } } | Gateway3DSecureActivity extends AppCompatActivity { void setWebViewHtml(String html) { String encoded = Base64.encodeToString(html.getBytes(), Base64.NO_PADDING | Base64.NO_WRAP); webView.loadData(encoded, "text/html", "base64"); } static final String EXTRA_HTML; static final String EXTRA_TITLE; static final String E... |
@Test public void testIntentToEmailWorksAsExpected() { Uri testUri = mock(Uri.class); Intent testIntent = new Intent(); activity.intentToEmail(testUri, testIntent); int flags = testIntent.getFlags(); assertNotEquals(0, flags & Intent.FLAG_ACTIVITY_NEW_TASK); assertEquals(testUri, testIntent.getData()); verify(activity)... | void intentToEmail(Uri uri) { Intent emailIntent = new Intent(Intent.ACTION_SENDTO); intentToEmail(uri, emailIntent); } | Gateway3DSecureActivity extends AppCompatActivity { void intentToEmail(Uri uri) { Intent emailIntent = new Intent(Intent.ACTION_SENDTO); intentToEmail(uri, emailIntent); } } | Gateway3DSecureActivity extends AppCompatActivity { void intentToEmail(Uri uri) { Intent emailIntent = new Intent(Intent.ACTION_SENDTO); intentToEmail(uri, emailIntent); } } | Gateway3DSecureActivity extends AppCompatActivity { void intentToEmail(Uri uri) { Intent emailIntent = new Intent(Intent.ACTION_SENDTO); intentToEmail(uri, emailIntent); } } | Gateway3DSecureActivity extends AppCompatActivity { void intentToEmail(Uri uri) { Intent emailIntent = new Intent(Intent.ACTION_SENDTO); intentToEmail(uri, emailIntent); } static final String EXTRA_HTML; static final String EXTRA_TITLE; static final String EXTRA_ACS_RESULT; } |
@Test public void testCompleteWorksAsExpected() { String testAcsResult = "test result"; Intent testIntent = new Intent(); activity.complete(testAcsResult, testIntent); assertTrue(testIntent.hasExtra(Gateway3DSecureActivity.EXTRA_ACS_RESULT)); assertEquals(testAcsResult, testIntent.getStringExtra(Gateway3DSecureActivity... | void complete(String acsResult) { Intent intent = new Intent(); complete(acsResult, intent); } | Gateway3DSecureActivity extends AppCompatActivity { void complete(String acsResult) { Intent intent = new Intent(); complete(acsResult, intent); } } | Gateway3DSecureActivity extends AppCompatActivity { void complete(String acsResult) { Intent intent = new Intent(); complete(acsResult, intent); } } | Gateway3DSecureActivity extends AppCompatActivity { void complete(String acsResult) { Intent intent = new Intent(); complete(acsResult, intent); } } | Gateway3DSecureActivity extends AppCompatActivity { void complete(String acsResult) { Intent intent = new Intent(); complete(acsResult, intent); } static final String EXTRA_HTML; static final String EXTRA_TITLE; static final String EXTRA_ACS_RESULT; } |
@Test public void testGetAcsResultFromUriWorksAsExpected() { Uri testUri = Uri.parse("gatewaysdk: String result = activity.getACSResultFromUri(testUri); assertEquals("{}", result); } | String getACSResultFromUri(Uri uri) { String result = null; Set<String> params = uri.getQueryParameterNames(); for (String param : params) { if ("acsResult".equalsIgnoreCase(param)) { result = uri.getQueryParameter(param); } } return result; } | Gateway3DSecureActivity extends AppCompatActivity { String getACSResultFromUri(Uri uri) { String result = null; Set<String> params = uri.getQueryParameterNames(); for (String param : params) { if ("acsResult".equalsIgnoreCase(param)) { result = uri.getQueryParameter(param); } } return result; } } | Gateway3DSecureActivity extends AppCompatActivity { String getACSResultFromUri(Uri uri) { String result = null; Set<String> params = uri.getQueryParameterNames(); for (String param : params) { if ("acsResult".equalsIgnoreCase(param)) { result = uri.getQueryParameter(param); } } return result; } } | Gateway3DSecureActivity extends AppCompatActivity { String getACSResultFromUri(Uri uri) { String result = null; Set<String> params = uri.getQueryParameterNames(); for (String param : params) { if ("acsResult".equalsIgnoreCase(param)) { result = uri.getQueryParameter(param); } } return result; } } | Gateway3DSecureActivity extends AppCompatActivity { String getACSResultFromUri(Uri uri) { String result = null; Set<String> params = uri.getQueryParameterNames(); for (String param : params) { if ("acsResult".equalsIgnoreCase(param)) { result = uri.getQueryParameter(param); } } return result; } static final String EX... |
@Test public void testReadingInternalCertificateWorksAsExpected() throws Exception { X509Certificate certificate = trustProvider.readCertificate(GatewaySSLContextProvider.INTERMEDIATE_CA); String expectedSerialNo = "1372807406"; assertNotNull(certificate); assertEquals(expectedSerialNo, certificate.getSerialNumber().to... | X509Certificate readCertificate(String cert) throws CertificateException { byte[] bytes = cert.getBytes(); InputStream is = new ByteArrayInputStream(bytes); return (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(is); } | GatewaySSLContextProvider { X509Certificate readCertificate(String cert) throws CertificateException { byte[] bytes = cert.getBytes(); InputStream is = new ByteArrayInputStream(bytes); return (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(is); } } | GatewaySSLContextProvider { X509Certificate readCertificate(String cert) throws CertificateException { byte[] bytes = cert.getBytes(); InputStream is = new ByteArrayInputStream(bytes); return (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(is); } GatewaySSLContextProvider(); } | GatewaySSLContextProvider { X509Certificate readCertificate(String cert) throws CertificateException { byte[] bytes = cert.getBytes(); InputStream is = new ByteArrayInputStream(bytes); return (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(is); } GatewaySSLContextProvider(); } | GatewaySSLContextProvider { X509Certificate readCertificate(String cert) throws CertificateException { byte[] bytes = cert.getBytes(); InputStream is = new ByteArrayInputStream(bytes); return (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(is); } GatewaySSLContextProvider(); } |
@Test public void cannotOverrideNestedMap() { GatewayMap map = new GatewayMap(); map.put("a", 1); try { map.put("a.b", 2); fail("IllegalArgumentException not raised"); } catch (IllegalArgumentException e) { } catch (Exception e) { fail("Exception " + e + " thrown"); } } | @Override public Object put(String keyPath, Object value) { String[] properties = keyPath.split("\\."); Map<String, Object> destinationObject = this; if (properties.length > 1) { for (int i = 0; i < (properties.length - 1); i++) { String property = properties[i]; if (property.contains("[")) { destinationObject = getDes... | GatewayMap extends LinkedHashMap<String, Object> { @Override public Object put(String keyPath, Object value) { String[] properties = keyPath.split("\\."); Map<String, Object> destinationObject = this; if (properties.length > 1) { for (int i = 0; i < (properties.length - 1); i++) { String property = properties[i]; if (p... | GatewayMap extends LinkedHashMap<String, Object> { @Override public Object put(String keyPath, Object value) { String[] properties = keyPath.split("\\."); Map<String, Object> destinationObject = this; if (properties.length > 1) { for (int i = 0; i < (properties.length - 1); i++) { String property = properties[i]; if (p... | GatewayMap extends LinkedHashMap<String, Object> { @Override public Object put(String keyPath, Object value) { String[] properties = keyPath.split("\\."); Map<String, Object> destinationObject = this; if (properties.length > 1) { for (int i = 0; i < (properties.length - 1); i++) { String property = properties[i]; if (p... | GatewayMap extends LinkedHashMap<String, Object> { @Override public Object put(String keyPath, Object value) { String[] properties = keyPath.split("\\."); Map<String, Object> destinationObject = this; if (properties.length > 1) { for (int i = 0; i < (properties.length - 1); i++) { String property = properties[i]; if (p... |
@Test(expected = TestContainerException.class) public void forkWithInvalidBootClasspath() throws BundleException, IOException, InterruptedException, NotBoundException, URISyntaxException { ServiceLoader<FrameworkFactory> loader = ServiceLoader.load(FrameworkFactory.class); FrameworkFactory frameworkFactory = loader.ite... | public RemoteFramework fork(List<String> vmArgs, Map<String, String> systemProperties, Map<String, Object> frameworkProperties, List<String> beforeFrameworkClasspath, List<String> afterFrameworkClasspath) { port = getPort(); LOG.debug("using RMI registry at port {}", port); String rmiName = "ExamRemoteFramework-" + UUI... | ForkedFrameworkFactory { public RemoteFramework fork(List<String> vmArgs, Map<String, String> systemProperties, Map<String, Object> frameworkProperties, List<String> beforeFrameworkClasspath, List<String> afterFrameworkClasspath) { port = getPort(); LOG.debug("using RMI registry at port {}", port); String rmiName = "Ex... | ForkedFrameworkFactory { public RemoteFramework fork(List<String> vmArgs, Map<String, String> systemProperties, Map<String, Object> frameworkProperties, List<String> beforeFrameworkClasspath, List<String> afterFrameworkClasspath) { port = getPort(); LOG.debug("using RMI registry at port {}", port); String rmiName = "Ex... | ForkedFrameworkFactory { public RemoteFramework fork(List<String> vmArgs, Map<String, String> systemProperties, Map<String, Object> frameworkProperties, List<String> beforeFrameworkClasspath, List<String> afterFrameworkClasspath) { port = getPort(); LOG.debug("using RMI registry at port {}", port); String rmiName = "Ex... | ForkedFrameworkFactory { public RemoteFramework fork(List<String> vmArgs, Map<String, String> systemProperties, Map<String, Object> frameworkProperties, List<String> beforeFrameworkClasspath, List<String> afterFrameworkClasspath) { port = getPort(); LOG.debug("using RMI registry at port {}", port); String rmiName = "Ex... |
@Test() public void verifyPortConfiguration() throws Exception { ForkedFrameworkFactory frameworkFactory = new ForkedFrameworkFactory(null); new SystemPropertyRunnable(org.ops4j.pax.exam.Constants.EXAM_FORKED_INVOKER_PORT, "15000") { @Override protected void doRun() { Assert.assertThat(frameworkFactory.getPort(), CoreM... | protected int getPort() { String configuredPort = System.getProperty(EXAM_FORKED_INVOKER_PORT); if (configuredPort != null) { return Integer.parseInt(configuredPort); } else { int lowerBound = Integer.parseInt(System.getProperty(EXAM_FORKED_INVOKER_PORT_RANGE_LOWERBOUND, "21000")); int upperBound = Integer.parseInt(Sys... | ForkedFrameworkFactory { protected int getPort() { String configuredPort = System.getProperty(EXAM_FORKED_INVOKER_PORT); if (configuredPort != null) { return Integer.parseInt(configuredPort); } else { int lowerBound = Integer.parseInt(System.getProperty(EXAM_FORKED_INVOKER_PORT_RANGE_LOWERBOUND, "21000")); int upperBou... | ForkedFrameworkFactory { protected int getPort() { String configuredPort = System.getProperty(EXAM_FORKED_INVOKER_PORT); if (configuredPort != null) { return Integer.parseInt(configuredPort); } else { int lowerBound = Integer.parseInt(System.getProperty(EXAM_FORKED_INVOKER_PORT_RANGE_LOWERBOUND, "21000")); int upperBou... | ForkedFrameworkFactory { protected int getPort() { String configuredPort = System.getProperty(EXAM_FORKED_INVOKER_PORT); if (configuredPort != null) { return Integer.parseInt(configuredPort); } else { int lowerBound = Integer.parseInt(System.getProperty(EXAM_FORKED_INVOKER_PORT_RANGE_LOWERBOUND, "21000")); int upperBou... | ForkedFrameworkFactory { protected int getPort() { String configuredPort = System.getProperty(EXAM_FORKED_INVOKER_PORT); if (configuredPort != null) { return Integer.parseInt(configuredPort); } else { int lowerBound = Integer.parseInt(System.getProperty(EXAM_FORKED_INVOKER_PORT_RANGE_LOWERBOUND, "21000")); int upperBou... |
@Test public void testEncoding() { WrappedUrlProvisionOption option = wrappedBundle(mavenBundle("mygroup", "myArtifactId", "1.0")); option.instructions("Export-Package=my.package.*"); option.overwriteManifest(OverwriteMode.MERGE); StringWriter wr = new StringWriter(); DependenciesDeployer.writeDependenciesFeature(wr, o... | static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) { XMLOutputFactory xof = XMLOutputFactory.newInstance(); xof.setProperty("javax.xml.stream.isRepairingNamespaces", true); XMLStreamWriter sw = null; try { sw = xof.createXMLStreamWriter(writer); sw.writeStartDocument("UTF-8", "1... | DependenciesDeployer { static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) { XMLOutputFactory xof = XMLOutputFactory.newInstance(); xof.setProperty("javax.xml.stream.isRepairingNamespaces", true); XMLStreamWriter sw = null; try { sw = xof.createXMLStreamWriter(writer); sw.writeSt... | DependenciesDeployer { static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) { XMLOutputFactory xof = XMLOutputFactory.newInstance(); xof.setProperty("javax.xml.stream.isRepairingNamespaces", true); XMLStreamWriter sw = null; try { sw = xof.createXMLStreamWriter(writer); sw.writeSt... | DependenciesDeployer { static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) { XMLOutputFactory xof = XMLOutputFactory.newInstance(); xof.setProperty("javax.xml.stream.isRepairingNamespaces", true); XMLStreamWriter sw = null; try { sw = xof.createXMLStreamWriter(writer); sw.writeSt... | DependenciesDeployer { static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) { XMLOutputFactory xof = XMLOutputFactory.newInstance(); xof.setProperty("javax.xml.stream.isRepairingNamespaces", true); XMLStreamWriter sw = null; try { sw = xof.createXMLStreamWriter(writer); sw.writeSt... |
@Test public void testDependencyFeature() { MavenArtifactProvisionOption option = mavenBundle().groupId("mygroup").artifactId("myArtifactId").version("1.0"); StringWriter wr = new StringWriter(); DependenciesDeployer.writeDependenciesFeature(wr, option); Assert.assertEquals( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\... | static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) { XMLOutputFactory xof = XMLOutputFactory.newInstance(); xof.setProperty("javax.xml.stream.isRepairingNamespaces", true); XMLStreamWriter sw = null; try { sw = xof.createXMLStreamWriter(writer); sw.writeStartDocument("UTF-8", "1... | DependenciesDeployer { static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) { XMLOutputFactory xof = XMLOutputFactory.newInstance(); xof.setProperty("javax.xml.stream.isRepairingNamespaces", true); XMLStreamWriter sw = null; try { sw = xof.createXMLStreamWriter(writer); sw.writeSt... | DependenciesDeployer { static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) { XMLOutputFactory xof = XMLOutputFactory.newInstance(); xof.setProperty("javax.xml.stream.isRepairingNamespaces", true); XMLStreamWriter sw = null; try { sw = xof.createXMLStreamWriter(writer); sw.writeSt... | DependenciesDeployer { static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) { XMLOutputFactory xof = XMLOutputFactory.newInstance(); xof.setProperty("javax.xml.stream.isRepairingNamespaces", true); XMLStreamWriter sw = null; try { sw = xof.createXMLStreamWriter(writer); sw.writeSt... | DependenciesDeployer { static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) { XMLOutputFactory xof = XMLOutputFactory.newInstance(); xof.setProperty("javax.xml.stream.isRepairingNamespaces", true); XMLStreamWriter sw = null; try { sw = xof.createXMLStreamWriter(writer); sw.writeSt... |
@Test public void testDependencyFeatureWithBundleStartLevel() { MavenArtifactProvisionOption option = mavenBundle().groupId("mygroup").artifactId("myArtifactId").version("1.0").startLevel(42); StringWriter wr = new StringWriter(); DependenciesDeployer.writeDependenciesFeature(wr, option); Assert.assertEquals( "<?xml ve... | static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) { XMLOutputFactory xof = XMLOutputFactory.newInstance(); xof.setProperty("javax.xml.stream.isRepairingNamespaces", true); XMLStreamWriter sw = null; try { sw = xof.createXMLStreamWriter(writer); sw.writeStartDocument("UTF-8", "1... | DependenciesDeployer { static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) { XMLOutputFactory xof = XMLOutputFactory.newInstance(); xof.setProperty("javax.xml.stream.isRepairingNamespaces", true); XMLStreamWriter sw = null; try { sw = xof.createXMLStreamWriter(writer); sw.writeSt... | DependenciesDeployer { static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) { XMLOutputFactory xof = XMLOutputFactory.newInstance(); xof.setProperty("javax.xml.stream.isRepairingNamespaces", true); XMLStreamWriter sw = null; try { sw = xof.createXMLStreamWriter(writer); sw.writeSt... | DependenciesDeployer { static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) { XMLOutputFactory xof = XMLOutputFactory.newInstance(); xof.setProperty("javax.xml.stream.isRepairingNamespaces", true); XMLStreamWriter sw = null; try { sw = xof.createXMLStreamWriter(writer); sw.writeSt... | DependenciesDeployer { static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) { XMLOutputFactory xof = XMLOutputFactory.newInstance(); xof.setProperty("javax.xml.stream.isRepairingNamespaces", true); XMLStreamWriter sw = null; try { sw = xof.createXMLStreamWriter(writer); sw.writeSt... |
@Test public void testVersions() { assertEquals(8, JavaVersionUtil.getMajorVersion("1.8.0_171")); assertEquals(9, JavaVersionUtil.getMajorVersion("9")); assertEquals(10, JavaVersionUtil.getMajorVersion("10")); assertEquals(11, JavaVersionUtil.getMajorVersion("11")); } | public static int getMajorVersion() { return getMajorVersion(System.getProperty("java.specification.version")); } | JavaVersionUtil { public static int getMajorVersion() { return getMajorVersion(System.getProperty("java.specification.version")); } } | JavaVersionUtil { public static int getMajorVersion() { return getMajorVersion(System.getProperty("java.specification.version")); } } | JavaVersionUtil { public static int getMajorVersion() { return getMajorVersion(System.getProperty("java.specification.version")); } static int getMajorVersion(); } | JavaVersionUtil { public static int getMajorVersion() { return getMajorVersion(System.getProperty("java.specification.version")); } static int getMajorVersion(); } |
@Test public void store() throws Exception { final int[] ints = {1, 2, 3, 4}; final Dictionary<String, Object> configuration = new Hashtable<>(); configuration.put("ints", ints); final FileOutputStream fos = new FileOutputStream("target/store.config"); ConfigurationHandler.write(fos, configuration); fos.close(); } | @Override public void store() throws IOException { final FileOutputStream fos = new FileOutputStream(file); ConfigurationHandler.write(fos, configuration); fos.close(); } | KarafConfigFile extends KarafConfigurationFile { @Override public void store() throws IOException { final FileOutputStream fos = new FileOutputStream(file); ConfigurationHandler.write(fos, configuration); fos.close(); } } | KarafConfigFile extends KarafConfigurationFile { @Override public void store() throws IOException { final FileOutputStream fos = new FileOutputStream(file); ConfigurationHandler.write(fos, configuration); fos.close(); } KarafConfigFile(File karafHome, String location); } | KarafConfigFile extends KarafConfigurationFile { @Override public void store() throws IOException { final FileOutputStream fos = new FileOutputStream(file); ConfigurationHandler.write(fos, configuration); fos.close(); } KarafConfigFile(File karafHome, String location); @Override void store(); @SuppressWarnings("uncheck... | KarafConfigFile extends KarafConfigurationFile { @Override public void store() throws IOException { final FileOutputStream fos = new FileOutputStream(file); ConfigurationHandler.write(fos, configuration); fos.close(); } KarafConfigFile(File karafHome, String location); @Override void store(); @SuppressWarnings("uncheck... |
@Test public void load() throws Exception { final int[] expected = {1, 2, 3, 4}; final KarafConfigFile karafConfigFile = new KarafConfigFile(KARAF_ETC, "etc/ints_4.config"); karafConfigFile.load(); final int[] ints = (int[]) karafConfigFile.get("ints"); assertArrayEquals(expected, ints); } | @SuppressWarnings("unchecked") @Override public void load() throws IOException { if (!file.exists()) { return; } final FileInputStream fis = new FileInputStream(file); configuration = ConfigurationHandler.read(fis); fis.close(); } | KarafConfigFile extends KarafConfigurationFile { @SuppressWarnings("unchecked") @Override public void load() throws IOException { if (!file.exists()) { return; } final FileInputStream fis = new FileInputStream(file); configuration = ConfigurationHandler.read(fis); fis.close(); } } | KarafConfigFile extends KarafConfigurationFile { @SuppressWarnings("unchecked") @Override public void load() throws IOException { if (!file.exists()) { return; } final FileInputStream fis = new FileInputStream(file); configuration = ConfigurationHandler.read(fis); fis.close(); } KarafConfigFile(File karafHome, String l... | KarafConfigFile extends KarafConfigurationFile { @SuppressWarnings("unchecked") @Override public void load() throws IOException { if (!file.exists()) { return; } final FileInputStream fis = new FileInputStream(file); configuration = ConfigurationHandler.read(fis); fis.close(); } KarafConfigFile(File karafHome, String l... | KarafConfigFile extends KarafConfigurationFile { @SuppressWarnings("unchecked") @Override public void load() throws IOException { if (!file.exists()) { return; } final FileInputStream fis = new FileInputStream(file); configuration = ConfigurationHandler.read(fis); fis.close(); } KarafConfigFile(File karafHome, String l... |
@Test public void put() throws Exception { final Double d = 2D; final KarafConfigFile karafConfigFile = new KarafConfigFile(KARAF_ETC, "etc/na.config"); karafConfigFile.put("Double", d); } | @Override public void put(final String key, final Object value) { configuration.put(key, value); } | KarafConfigFile extends KarafConfigurationFile { @Override public void put(final String key, final Object value) { configuration.put(key, value); } } | KarafConfigFile extends KarafConfigurationFile { @Override public void put(final String key, final Object value) { configuration.put(key, value); } KarafConfigFile(File karafHome, String location); } | KarafConfigFile extends KarafConfigurationFile { @Override public void put(final String key, final Object value) { configuration.put(key, value); } KarafConfigFile(File karafHome, String location); @Override void store(); @SuppressWarnings("unchecked") @Override void load(); @Override void put(final String key, final O... | KarafConfigFile extends KarafConfigurationFile { @Override public void put(final String key, final Object value) { configuration.put(key, value); } KarafConfigFile(File karafHome, String location); @Override void store(); @SuppressWarnings("unchecked") @Override void load(); @Override void put(final String key, final O... |
@Test public void get() throws Exception { final String in = "value"; final KarafConfigFile karafConfigFile = new KarafConfigFile(KARAF_ETC, "etc/na.config"); karafConfigFile.put("key", in); final Object out = karafConfigFile.get("key"); assertEquals(in, out); } | @Override public Object get(final String key) { return configuration.get(key); } | KarafConfigFile extends KarafConfigurationFile { @Override public Object get(final String key) { return configuration.get(key); } } | KarafConfigFile extends KarafConfigurationFile { @Override public Object get(final String key) { return configuration.get(key); } KarafConfigFile(File karafHome, String location); } | KarafConfigFile extends KarafConfigurationFile { @Override public Object get(final String key) { return configuration.get(key); } KarafConfigFile(File karafHome, String location); @Override void store(); @SuppressWarnings("unchecked") @Override void load(); @Override void put(final String key, final Object value); @Sup... | KarafConfigFile extends KarafConfigurationFile { @Override public Object get(final String key) { return configuration.get(key); } KarafConfigFile(File karafHome, String location); @Override void store(); @SuppressWarnings("unchecked") @Override void load(); @Override void put(final String key, final Object value); @Sup... |
@Test public void findFileInTree() { File rootDir = new File("src/main/java"); File file = FileFinder.findFile(rootDir, "FileFinder.java"); assertFilePath(file, "src/main/java/org/ops4j/pax/exam/spi/war/FileFinder.java"); } | public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } } | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } private FileFinder(); } | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } private FileFinder(); static File findFile(File rootDir, final S... | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } private FileFinder(); static File findFile(File rootDir, final S... |
@Test public void findFileInRoot() { File rootDir = new File("src/main/java/org/ops4j/pax/exam/spi/war"); File file = FileFinder.findFile(rootDir, "FileFinder.java"); assertFilePath(file, "src/main/java/org/ops4j/pax/exam/spi/war/FileFinder.java"); } | public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } } | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } private FileFinder(); } | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } private FileFinder(); static File findFile(File rootDir, final S... | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } private FileFinder(); static File findFile(File rootDir, final S... |
@Test public void findFileWithFilter() { File rootDir = new File("src/main/java/"); FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.startsWith("Zip"); } }; File file = FileFinder.findFile(rootDir, filter); assertFilePath(file, "src/main/java/org/ops4j/... | public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } } | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } private FileFinder(); } | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } private FileFinder(); static File findFile(File rootDir, final S... | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } private FileFinder(); static File findFile(File rootDir, final S... |
@Test public void findDirectory() { File rootDir = new File("src"); File file = FileFinder.findFile(rootDir, "java"); assertFilePath(file, "src/main/java"); } | public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } } | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } private FileFinder(); } | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } private FileFinder(); static File findFile(File rootDir, final S... | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } private FileFinder(); static File findFile(File rootDir, final S... |
@Test public void findSubdirectory() { File rootDir = new File("src/test"); File file = FileFinder.findFile(rootDir, "java"); assertFilePath(file, "src/test/java"); } | public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } } | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } private FileFinder(); } | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } private FileFinder(); static File findFile(File rootDir, final S... | FileFinder { public static File findFile(File rootDir, final String fileName) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.equals(fileName); } }; return findFile(rootDir, filter); } private FileFinder(); static File findFile(File rootDir, final S... |
@Test public void buildWar() throws MalformedURLException, IOException { war = localCopy(warProbe().library("target/classes")); assertThat(war.getEntry("WEB-INF/beans.xml"), is(notNullValue())); assertThat(war.getEntry("WEB-INF/lib/pax-exam-spi-" + Info.getPaxExamVersion() + ".jar"), is(notNullValue())); } | public URI buildWar() { if (option.getName() == null) { option.name(UUID.randomUUID().toString()); } processClassPath(); try { File webResourceDir = getWebResourceDir(); File probeWar = new File(tempDir, option.getName() + ".war"); ZipBuilder builder = new ZipBuilder(probeWar); for (String library : option.getLibraries... | WarBuilder { public URI buildWar() { if (option.getName() == null) { option.name(UUID.randomUUID().toString()); } processClassPath(); try { File webResourceDir = getWebResourceDir(); File probeWar = new File(tempDir, option.getName() + ".war"); ZipBuilder builder = new ZipBuilder(probeWar); for (String library : option... | WarBuilder { public URI buildWar() { if (option.getName() == null) { option.name(UUID.randomUUID().toString()); } processClassPath(); try { File webResourceDir = getWebResourceDir(); File probeWar = new File(tempDir, option.getName() + ".war"); ZipBuilder builder = new ZipBuilder(probeWar); for (String library : option... | WarBuilder { public URI buildWar() { if (option.getName() == null) { option.name(UUID.randomUUID().toString()); } processClassPath(); try { File webResourceDir = getWebResourceDir(); File probeWar = new File(tempDir, option.getName() + ".war"); ZipBuilder builder = new ZipBuilder(probeWar); for (String library : option... | WarBuilder { public URI buildWar() { if (option.getName() == null) { option.name(UUID.randomUUID().toString()); } processClassPath(); try { File webResourceDir = getWebResourceDir(); File probeWar = new File(tempDir, option.getName() + ".war"); ZipBuilder builder = new ZipBuilder(probeWar); for (String library : option... |
@Test public void buildWarWithName() throws MalformedURLException, IOException { WarBuilder warBuilder = new WarBuilder(DefaultExamSystem.createTempDir(), warProbe().library("target/classes").name("foo")); URI uri = warBuilder.buildWar(); assertThat(new File(uri).getName(), is("foo.war")); } | public URI buildWar() { if (option.getName() == null) { option.name(UUID.randomUUID().toString()); } processClassPath(); try { File webResourceDir = getWebResourceDir(); File probeWar = new File(tempDir, option.getName() + ".war"); ZipBuilder builder = new ZipBuilder(probeWar); for (String library : option.getLibraries... | WarBuilder { public URI buildWar() { if (option.getName() == null) { option.name(UUID.randomUUID().toString()); } processClassPath(); try { File webResourceDir = getWebResourceDir(); File probeWar = new File(tempDir, option.getName() + ".war"); ZipBuilder builder = new ZipBuilder(probeWar); for (String library : option... | WarBuilder { public URI buildWar() { if (option.getName() == null) { option.name(UUID.randomUUID().toString()); } processClassPath(); try { File webResourceDir = getWebResourceDir(); File probeWar = new File(tempDir, option.getName() + ".war"); ZipBuilder builder = new ZipBuilder(probeWar); for (String library : option... | WarBuilder { public URI buildWar() { if (option.getName() == null) { option.name(UUID.randomUUID().toString()); } processClassPath(); try { File webResourceDir = getWebResourceDir(); File probeWar = new File(tempDir, option.getName() + ".war"); ZipBuilder builder = new ZipBuilder(probeWar); for (String library : option... | WarBuilder { public URI buildWar() { if (option.getName() == null) { option.name(UUID.randomUUID().toString()); } processClassPath(); try { File webResourceDir = getWebResourceDir(); File probeWar = new File(tempDir, option.getName() + ".war"); ZipBuilder builder = new ZipBuilder(probeWar); for (String library : option... |
@Test public void testfilterWasUsedForProbeInvoker() throws Exception { BundleContext bundleContext = mock(BundleContext.class); RemoteBundleContextImpl remoteBundleContext = new RemoteBundleContextImpl(bundleContext); String rightFilter = "(Probe-Signature=PAXPROBE-the-right-one)"; when(bundleContext.createFilter(anyS... | @Override public Object remoteCall(final Class<?> serviceType, final String methodName, final Class<?>[] methodParams, String filter, final RelativeTimeout timeout, final Object... actualParams) throws NoSuchServiceException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { LOG.trace("Remote c... | RemoteBundleContextImpl implements RemoteBundleContext, Serializable { @Override public Object remoteCall(final Class<?> serviceType, final String methodName, final Class<?>[] methodParams, String filter, final RelativeTimeout timeout, final Object... actualParams) throws NoSuchServiceException, NoSuchMethodException, ... | RemoteBundleContextImpl implements RemoteBundleContext, Serializable { @Override public Object remoteCall(final Class<?> serviceType, final String methodName, final Class<?>[] methodParams, String filter, final RelativeTimeout timeout, final Object... actualParams) throws NoSuchServiceException, NoSuchMethodException, ... | RemoteBundleContextImpl implements RemoteBundleContext, Serializable { @Override public Object remoteCall(final Class<?> serviceType, final String methodName, final Class<?>[] methodParams, String filter, final RelativeTimeout timeout, final Object... actualParams) throws NoSuchServiceException, NoSuchMethodException, ... | RemoteBundleContextImpl implements RemoteBundleContext, Serializable { @Override public Object remoteCall(final Class<?> serviceType, final String methodName, final Class<?>[] methodParams, String filter, final RelativeTimeout timeout, final Object... actualParams) throws NoSuchServiceException, NoSuchMethodException, ... |
@Test public void loadSystemProperties() { ConfigurationManager cm = new ConfigurationManager(); assertThat(System.getProperty("exam.test.key1"), is(nullValue())); assertThat(System.getProperty("exam.test.key2"), is(nullValue())); String cp = System.getProperty("java.class.path"); cm.loadSystemProperties("exam.test.pro... | public void loadSystemProperties(String configurationKey) { String propertyRef = getProperty(configurationKey); if (propertyRef == null) { return; } if (propertyRef.startsWith("env:")) { propertyRef = propertyRef.substring(4); propertyRef = System.getenv(propertyRef); } if (!propertyRef.startsWith("/")) { propertyRef =... | ConfigurationManager { public void loadSystemProperties(String configurationKey) { String propertyRef = getProperty(configurationKey); if (propertyRef == null) { return; } if (propertyRef.startsWith("env:")) { propertyRef = propertyRef.substring(4); propertyRef = System.getenv(propertyRef); } if (!propertyRef.startsWit... | ConfigurationManager { public void loadSystemProperties(String configurationKey) { String propertyRef = getProperty(configurationKey); if (propertyRef == null) { return; } if (propertyRef.startsWith("env:")) { propertyRef = propertyRef.substring(4); propertyRef = System.getenv(propertyRef); } if (!propertyRef.startsWit... | ConfigurationManager { public void loadSystemProperties(String configurationKey) { String propertyRef = getProperty(configurationKey); if (propertyRef == null) { return; } if (propertyRef.startsWith("env:")) { propertyRef = propertyRef.substring(4); propertyRef = System.getenv(propertyRef); } if (!propertyRef.startsWit... | ConfigurationManager { public void loadSystemProperties(String configurationKey) { String propertyRef = getProperty(configurationKey); if (propertyRef == null) { return; } if (propertyRef.startsWith("env:")) { propertyRef = propertyRef.substring(4); propertyRef = System.getenv(propertyRef); } if (!propertyRef.startsWit... |
@Test public void testShowAdmin() { result = ninjaTestBrowser.makeRequest(ninjaTestServer.getBaseUrl() + "/admin"); assertTrue(!result.contains("<li class=\"active\">")); assertFalse(result.contains("FreeMarker template error")); assertFalse(result.contains("<title>404 - not found</title>")); } | public Result showAdmin(Context context) { return Results.html(); } | AdminHandler { public Result showAdmin(Context context) { return Results.html(); } } | AdminHandler { public Result showAdmin(Context context) { return Results.html(); } } | AdminHandler { public Result showAdmin(Context context) { return Results.html(); } Result showAdmin(Context context); Result showUsers(Context context); Result showSummedTransactions(Context context); Result pagedMTX(Context context, @Param("p") int page); Result deleteMTXProcess(@PathParam("time") Integer time, Conte... | AdminHandler { public Result showAdmin(Context context) { return Results.html(); } Result showAdmin(Context context); Result showUsers(Context context); Result showSummedTransactions(Context context); Result pagedMTX(Context context, @Param("p") int page); Result deleteMTXProcess(@PathParam("time") Integer time, Conte... |
@Test public void createMailbox_invalidEmail() throws Exception { final HttpResponse response = apiClient.createMailbox("foo(at)bar.com", System.currentTimeMillis(), false); RestApiTestUtils.validateStatusCode(response, 400); RestApiTestUtils.validateErrors(response, "address"); } | public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return doCreateMailbox(mailboxData, user); } | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... |
@Test public void createMailbox_unknownMailDomain() throws Exception { final HttpResponse response = apiClient.createMailbox("foo@bar.com", System.currentTimeMillis(), false); RestApiTestUtils.validateStatusCode(response, 403); } | public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return doCreateMailbox(mailboxData, user); } | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... |
@Test public void getMailbox() throws Exception { final MBox mailbox = TestDataUtils.createMailbox(user); final HttpResponse response = apiClient.getMailbox(mailbox.getFullAddress()); RestApiTestUtils.validateStatusCode(response, 200); final MailboxData mailboxData = RestApiTestUtils.getResponseBodyAs(response, Mailbox... | public Result getMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { final MailboxData mailboxData = new MailboxData(mailbox); return ApiResults.ok().render(mail... | MailboxApiController extends AbstractApiController { public Result getMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { final MailboxData mailboxData = new Mai... | MailboxApiController extends AbstractApiController { public Result getMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { final MailboxData mailboxData = new Mai... | MailboxApiController extends AbstractApiController { public Result getMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { final MailboxData mailboxData = new Mai... | MailboxApiController extends AbstractApiController { public Result getMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { final MailboxData mailboxData = new Mai... |
@Test public void getMailbox_invalidAddress() throws Exception { final HttpResponse response = apiClient.getMailbox(invalidAddress); RestApiTestUtils.validateStatusCode(response, 400); RestApiTestUtils.validateErrors(response, "mailboxAddress"); } | public Result getMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { final MailboxData mailboxData = new MailboxData(mailbox); return ApiResults.ok().render(mail... | MailboxApiController extends AbstractApiController { public Result getMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { final MailboxData mailboxData = new Mai... | MailboxApiController extends AbstractApiController { public Result getMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { final MailboxData mailboxData = new Mai... | MailboxApiController extends AbstractApiController { public Result getMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { final MailboxData mailboxData = new Mai... | MailboxApiController extends AbstractApiController { public Result getMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { final MailboxData mailboxData = new Mai... |
@Test public void getMailbox_unknownMailbox() throws Exception { final HttpResponse response = apiClient.getMailbox(unknownAddress); RestApiTestUtils.validateStatusCode(response, 404); } | public Result getMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { final MailboxData mailboxData = new MailboxData(mailbox); return ApiResults.ok().render(mail... | MailboxApiController extends AbstractApiController { public Result getMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { final MailboxData mailboxData = new Mai... | MailboxApiController extends AbstractApiController { public Result getMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { final MailboxData mailboxData = new Mai... | MailboxApiController extends AbstractApiController { public Result getMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { final MailboxData mailboxData = new Mai... | MailboxApiController extends AbstractApiController { public Result getMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { final MailboxData mailboxData = new Mai... |
@Test public void updateMailbox() throws Exception { MBox mailbox = TestDataUtils.createMailbox(user); final String mailboxAddress = "updated@xcmailr.test"; final long expirationDate = System.currentTimeMillis(); final boolean forwardEnabled = true; final HttpResponse response = apiClient.updateMailbox(mailbox.getFullA... | public Result updateMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @JSR303Validation final MailboxData mailboxData, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> doUpdateMailbox(mailbox, mailboxData)); } | MailboxApiController extends AbstractApiController { public Result updateMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @JSR303Validation final MailboxData mailboxData, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, ... | MailboxApiController extends AbstractApiController { public Result updateMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @JSR303Validation final MailboxData mailboxData, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, ... | MailboxApiController extends AbstractApiController { public Result updateMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @JSR303Validation final MailboxData mailboxData, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, ... | MailboxApiController extends AbstractApiController { public Result updateMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @JSR303Validation final MailboxData mailboxData, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, ... |
@Test public void deleteMailbox() throws Exception { final MBox mailbox = TestDataUtils.createMailbox(user); Assert.assertNotNull(MBox.getById(mailbox.getId())); final HttpResponse response = apiClient.deleteMailbox(mailbox.getFullAddress()); RestApiTestUtils.validateStatusCode(response, 204); Assert.assertNull(MBox.ge... | public Result deleteMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { mailbox.delete(); return ApiResults.noContent(); }); } | MailboxApiController extends AbstractApiController { public Result deleteMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { mailbox.delete(); return ApiResults.... | MailboxApiController extends AbstractApiController { public Result deleteMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { mailbox.delete(); return ApiResults.... | MailboxApiController extends AbstractApiController { public Result deleteMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { mailbox.delete(); return ApiResults.... | MailboxApiController extends AbstractApiController { public Result deleteMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { mailbox.delete(); return ApiResults.... |
@Test public void deleteMailbox_invalidMailboxAddress() throws Exception { final HttpResponse response = apiClient.deleteMailbox(invalidAddress); RestApiTestUtils.validateStatusCode(response, 400); RestApiTestUtils.validateErrors(response, "mailboxAddress"); } | public Result deleteMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { mailbox.delete(); return ApiResults.noContent(); }); } | MailboxApiController extends AbstractApiController { public Result deleteMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { mailbox.delete(); return ApiResults.... | MailboxApiController extends AbstractApiController { public Result deleteMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { mailbox.delete(); return ApiResults.... | MailboxApiController extends AbstractApiController { public Result deleteMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { mailbox.delete(); return ApiResults.... | MailboxApiController extends AbstractApiController { public Result deleteMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { mailbox.delete(); return ApiResults.... |
@Test public void deleteMailbox_unknownMailbox() throws Exception { final HttpResponse response = apiClient.deleteMailbox(unknownAddress); RestApiTestUtils.validateStatusCode(response, 404); } | public Result deleteMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { mailbox.delete(); return ApiResults.noContent(); }); } | MailboxApiController extends AbstractApiController { public Result deleteMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { mailbox.delete(); return ApiResults.... | MailboxApiController extends AbstractApiController { public Result deleteMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { mailbox.delete(); return ApiResults.... | MailboxApiController extends AbstractApiController { public Result deleteMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { mailbox.delete(); return ApiResults.... | MailboxApiController extends AbstractApiController { public Result deleteMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(userId, mailboxAddress, context, mailbox -> { mailbox.delete(); return ApiResults.... |
@Test public void listMails_emptyMailbox() throws Exception { final HttpResponse response = apiClient.listMails(emptyMailboxAddress); RestApiTestUtils.validateStatusCode(response, 200); final MailData[] mailDatas = RestApiTestUtils.getResponseBodyAs(response, MailData[].class); Assert.assertEquals(0, mailDatas.length);... | public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Pattern senderPattern = createPatternFromParameter("from... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... |
@Test public void testJsonUserSearch() { formParams.clear(); formParams.put("s", ""); result = ninjaTestBrowser.makeRequest(ninjaTestServer.getBaseUrl() + "/admin/usersearch?s="); assertTrue(result.equals("[]")); assertFalse(result.contains("FreeMarker template error")); assertFalse(result.contains("<title>404 - not fo... | public Result jsonUserSearch(Context context) { List<User> userList; String searchString = context.getParameter("s", ""); userList = (searchString.equals("")) ? new ArrayList<User>() : User.findUserLike(searchString); UserFormData userData; List<UserFormData> userDatalist = new ArrayList<UserFormData>(); for (User curr... | AdminHandler { public Result jsonUserSearch(Context context) { List<User> userList; String searchString = context.getParameter("s", ""); userList = (searchString.equals("")) ? new ArrayList<User>() : User.findUserLike(searchString); UserFormData userData; List<UserFormData> userDatalist = new ArrayList<UserFormData>();... | AdminHandler { public Result jsonUserSearch(Context context) { List<User> userList; String searchString = context.getParameter("s", ""); userList = (searchString.equals("")) ? new ArrayList<User>() : User.findUserLike(searchString); UserFormData userData; List<UserFormData> userDatalist = new ArrayList<UserFormData>();... | AdminHandler { public Result jsonUserSearch(Context context) { List<User> userList; String searchString = context.getParameter("s", ""); userList = (searchString.equals("")) ? new ArrayList<User>() : User.findUserLike(searchString); UserFormData userData; List<UserFormData> userDatalist = new ArrayList<UserFormData>();... | AdminHandler { public Result jsonUserSearch(Context context) { List<User> userList; String searchString = context.getParameter("s", ""); userList = (searchString.equals("")) ? new ArrayList<User>() : User.findUserLike(searchString); UserFormData userData; List<UserFormData> userDatalist = new ArrayList<UserFormData>();... |
@Test public void listMails_nonEmptyMailbox() throws Exception { final HttpResponse response = apiClient.listMails(mailboxAddress); RestApiTestUtils.validateStatusCode(response, 200); final MailData[] mailDatas = RestApiTestUtils.getResponseBodyAs(response, MailData[].class); Assert.assertEquals(2, mailDatas.length); } | public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Pattern senderPattern = createPatternFromParameter("from... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... |
@Test public void listMails_withLastMatchOnly() throws Exception { HttpResponse response = apiClient.listMails(mailboxAddress, true); RestApiTestUtils.validateStatusCode(response, 200); MailData[] mailDatas = RestApiTestUtils.getResponseBodyAs(response, MailData[].class); Assert.assertEquals(1, mailDatas.length); Asser... | public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Pattern senderPattern = createPatternFromParameter("from... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... |
@Test public void listMails_withSubjectFilter() throws Exception { HttpResponse response = apiClient.listMails(mailboxAddress, "attachments"); RestApiTestUtils.validateStatusCode(response, 200); MailData[] mailDatas = RestApiTestUtils.getResponseBodyAs(response, MailData[].class); Assert.assertEquals(1, mailDatas.lengt... | public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Pattern senderPattern = createPatternFromParameter("from... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... |
@Test public void listMails_someoneElsesMailbox() throws Exception { final HttpResponse response = apiClient.listMails(otherUsersMailboxAddress); RestApiTestUtils.validateStatusCode(response, 403); RestApiTestUtils.validateErrors(response, "mailboxAddress"); } | public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Pattern senderPattern = createPatternFromParameter("from... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... |
@Test public void listMails_invalidSubjectPattern() throws Exception { final HttpResponse response = apiClient.listMails(mailboxAddress, "[xyz"); RestApiTestUtils.validateStatusCode(response, 400); RestApiTestUtils.validateErrors(response, "subject"); } | public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Pattern senderPattern = createPatternFromParameter("from... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... |
@Test public void listMails_invalidId() throws Exception { final HttpResponse response = apiClient.listMails(invalidAddress); RestApiTestUtils.validateStatusCode(response, 400); RestApiTestUtils.validateErrors(response, "mailboxAddress"); } | public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Pattern senderPattern = createPatternFromParameter("from... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... |
@Test public void listMails_unknownMailbox() throws Exception { final HttpResponse response = apiClient.listMails(unknownAddress); RestApiTestUtils.validateStatusCode(response, 404); } | public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Pattern senderPattern = createPatternFromParameter("from... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... | MailApiController extends AbstractApiController { public Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress, @Attribute("userId") @DbId final Long userId, final Context context) throws Exception { final boolean lastMatch = context.getParameterAs("lastMatch", boolean.class, false); final Patter... |
@Test public void getMail() throws Exception { final HttpResponse response = apiClient.getMail(mailId); RestApiTestUtils.validateStatusCode(response, 200); } | public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().render(mailData); } catch (final Exception e) { lo... | MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().... | MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().... | MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().... | MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().... |
@Test public void getMail_someoneElsesMail() throws Exception { final HttpResponse response = apiClient.getMail(otherUsersMailId); RestApiTestUtils.validateStatusCode(response, 403); RestApiTestUtils.validateErrors(response, "mailId"); } | public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().render(mailData); } catch (final Exception e) { lo... | MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().... | MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().... | MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().... | MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().... |
@Test public void getMail_invalidId() throws Exception { final HttpResponse response = apiClient.getMail(invalidId); RestApiTestUtils.validateStatusCode(response, 400); RestApiTestUtils.validateErrors(response, "mailId"); } | public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().render(mailData); } catch (final Exception e) { lo... | MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().... | MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().... | MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().... | MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().... |
@Test public void testShowEmailStatistics() throws Exception { result = ninjaTestBrowser.makeRequest(ninjaTestServer.getBaseUrl() + "/admin/emailStatistics"); assertTrue(result.contains("Todays (last 24 hours) sender domains")); assertTrue(result.contains("Last 7 days sender domains")); assertFalse(result.contains("Fre... | public Result showEmailStatistics(Context context, @Param("dayPage") int dayPage, @Param("weekPage") int weekPage, @Param("sortDailyList") String sortDailyList, @Param("sortWeeklyList") String sortWeeklyList) { Result html = Results.html(); List<Long> dailyDroppedMails = new LinkedList<>(); List<Long> dailyForwardedMai... | AdminHandler { public Result showEmailStatistics(Context context, @Param("dayPage") int dayPage, @Param("weekPage") int weekPage, @Param("sortDailyList") String sortDailyList, @Param("sortWeeklyList") String sortWeeklyList) { Result html = Results.html(); List<Long> dailyDroppedMails = new LinkedList<>(); List<Long> da... | AdminHandler { public Result showEmailStatistics(Context context, @Param("dayPage") int dayPage, @Param("weekPage") int weekPage, @Param("sortDailyList") String sortDailyList, @Param("sortWeeklyList") String sortWeeklyList) { Result html = Results.html(); List<Long> dailyDroppedMails = new LinkedList<>(); List<Long> da... | AdminHandler { public Result showEmailStatistics(Context context, @Param("dayPage") int dayPage, @Param("weekPage") int weekPage, @Param("sortDailyList") String sortDailyList, @Param("sortWeeklyList") String sortWeeklyList) { Result html = Results.html(); List<Long> dailyDroppedMails = new LinkedList<>(); List<Long> da... | AdminHandler { public Result showEmailStatistics(Context context, @Param("dayPage") int dayPage, @Param("weekPage") int weekPage, @Param("sortDailyList") String sortDailyList, @Param("sortWeeklyList") String sortWeeklyList) { Result html = Results.html(); List<Long> dailyDroppedMails = new LinkedList<>(); List<Long> da... |
@Test public void getMail_unknownMail() throws Exception { final HttpResponse response = apiClient.getMail(unknownId); RestApiTestUtils.validateStatusCode(response, 404); } | public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().render(mailData); } catch (final Exception e) { lo... | MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().... | MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().... | MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().... | MailApiController extends AbstractApiController { public Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { try { final MailData mailData = new MailData(mail); return ApiResults.ok().... |
@Test public void getMailAttachment() throws Exception { HttpResponse response = apiClient.getMailAttachment(mailId, "test.pdf"); RestApiTestUtils.validateStatusCode(response, 200); RestApiTestUtils.validateResponseContent(response, "application/pdf", 89399); response = apiClient.getMailAttachment(mailId, "test.png"); ... | public Result getMailAttachment(@PathParam("mailId") @DbId final Long mailId, @PathParam("attachmentName") @NotBlank final String attachmentName, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { return serveMailAttachment(context, mail, attac... | MailApiController extends AbstractApiController { public Result getMailAttachment(@PathParam("mailId") @DbId final Long mailId, @PathParam("attachmentName") @NotBlank final String attachmentName, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail ->... | MailApiController extends AbstractApiController { public Result getMailAttachment(@PathParam("mailId") @DbId final Long mailId, @PathParam("attachmentName") @NotBlank final String attachmentName, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail ->... | MailApiController extends AbstractApiController { public Result getMailAttachment(@PathParam("mailId") @DbId final Long mailId, @PathParam("attachmentName") @NotBlank final String attachmentName, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail ->... | MailApiController extends AbstractApiController { public Result getMailAttachment(@PathParam("mailId") @DbId final Long mailId, @PathParam("attachmentName") @NotBlank final String attachmentName, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail ->... |
@Test public void getMailAttachment_unknownName() throws Exception { final HttpResponse response = apiClient.getMailAttachment(mailId, "unknownAttachmentName"); RestApiTestUtils.validateStatusCode(response, 404); } | public Result getMailAttachment(@PathParam("mailId") @DbId final Long mailId, @PathParam("attachmentName") @NotBlank final String attachmentName, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { return serveMailAttachment(context, mail, attac... | MailApiController extends AbstractApiController { public Result getMailAttachment(@PathParam("mailId") @DbId final Long mailId, @PathParam("attachmentName") @NotBlank final String attachmentName, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail ->... | MailApiController extends AbstractApiController { public Result getMailAttachment(@PathParam("mailId") @DbId final Long mailId, @PathParam("attachmentName") @NotBlank final String attachmentName, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail ->... | MailApiController extends AbstractApiController { public Result getMailAttachment(@PathParam("mailId") @DbId final Long mailId, @PathParam("attachmentName") @NotBlank final String attachmentName, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail ->... | MailApiController extends AbstractApiController { public Result getMailAttachment(@PathParam("mailId") @DbId final Long mailId, @PathParam("attachmentName") @NotBlank final String attachmentName, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail ->... |
@Test public void deleteMail() throws Exception { final Mail mail = TestDataUtils.createMailWithAttachments(mailbox); Assert.assertNotNull(Ebean.find(Mail.class, mail.getId())); final HttpResponse response = apiClient.deleteMail(String.valueOf(mail.getId())); RestApiTestUtils.validateStatusCode(response, 204); Assert.a... | public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } | MailApiController extends AbstractApiController { public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } } | MailApiController extends AbstractApiController { public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } } | MailApiController extends AbstractApiController { public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } Result listMails(@P... | MailApiController extends AbstractApiController { public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } Result listMails(@P... |
@Test public void deleteMail_someoneElsesMail() throws Exception { final HttpResponse response = apiClient.deleteMail(otherUsersMailId); RestApiTestUtils.validateStatusCode(response, 403); RestApiTestUtils.validateErrors(response, "mailId"); } | public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } | MailApiController extends AbstractApiController { public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } } | MailApiController extends AbstractApiController { public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } } | MailApiController extends AbstractApiController { public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } Result listMails(@P... | MailApiController extends AbstractApiController { public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } Result listMails(@P... |
@Test public void deleteMail_invalidMailId() throws Exception { final HttpResponse response = apiClient.deleteMail(invalidId); RestApiTestUtils.validateStatusCode(response, 400); RestApiTestUtils.validateErrors(response, "mailId"); } | public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } | MailApiController extends AbstractApiController { public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } } | MailApiController extends AbstractApiController { public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } } | MailApiController extends AbstractApiController { public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } Result listMails(@P... | MailApiController extends AbstractApiController { public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } Result listMails(@P... |
@Test public void deleteMail_unknownMailId() throws Exception { final HttpResponse response = apiClient.deleteMail(unknownId); RestApiTestUtils.validateStatusCode(response, 404); } | public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } | MailApiController extends AbstractApiController { public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } } | MailApiController extends AbstractApiController { public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } } | MailApiController extends AbstractApiController { public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } Result listMails(@P... | MailApiController extends AbstractApiController { public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); } Result listMails(@P... |
@Test public void boxToUserTest() { User user2 = new User("fname", "sName", "eMail@localhost.com", "pw", "en"); user2.save(); assertTrue(mailbox.belongsTo(user.getId())); assertFalse(mailbox.belongsTo(user2.getId())); assertTrue(MBox.boxToUser(mailbox.getId(), user.getId())); assertFalse(MBox.boxToUser(mailbox.getId(),... | public static boolean boxToUser(long bId, long uId) { MBox mb = Ebean.find(MBox.class, bId); return (mb != null && (mb.getUsr() != null) && (mb.getUsr().getId() == uId)); } | MBox extends AbstractEntity implements Serializable { public static boolean boxToUser(long bId, long uId) { MBox mb = Ebean.find(MBox.class, bId); return (mb != null && (mb.getUsr() != null) && (mb.getUsr().getId() == uId)); } } | MBox extends AbstractEntity implements Serializable { public static boolean boxToUser(long bId, long uId) { MBox mb = Ebean.find(MBox.class, bId); return (mb != null && (mb.getUsr() != null) && (mb.getUsr().getId() == uId)); } MBox(); MBox(String local, String domain, long ts, boolean expired, User usr); } | MBox extends AbstractEntity implements Serializable { public static boolean boxToUser(long bId, long uId) { MBox mb = Ebean.find(MBox.class, bId); return (mb != null && (mb.getUsr() != null) && (mb.getUsr().getId() == uId)); } MBox(); MBox(String local, String domain, long ts, boolean expired, User usr); String getAdd... | MBox extends AbstractEntity implements Serializable { public static boolean boxToUser(long bId, long uId) { MBox mb = Ebean.find(MBox.class, bId); return (mb != null && (mb.getUsr() != null) && (mb.getUsr().getId() == uId)); } MBox(); MBox(String local, String domain, long ts, boolean expired, User usr); String getAdd... |
@Test public void testHasCorrectFormat() { boolean correctFormat = HelperUtils.hasCorrectFormat("2013-12-12 12:12"); assertTrue(correctFormat); correctFormat = HelperUtils.hasCorrectFormat("2013-2-12 12:12"); assertTrue(correctFormat); correctFormat = HelperUtils.hasCorrectFormat("2013-12-2 12:12"); assertTrue(correctF... | public static boolean hasCorrectFormat(String input) { input = input.trim(); return PATTERN_DATEFORMAT.matcher(input).matches(); } | HelperUtils { public static boolean hasCorrectFormat(String input) { input = input.trim(); return PATTERN_DATEFORMAT.matcher(input).matches(); } } | HelperUtils { public static boolean hasCorrectFormat(String input) { input = input.trim(); return PATTERN_DATEFORMAT.matcher(input).matches(); } private HelperUtils(); } | HelperUtils { public static boolean hasCorrectFormat(String input) { input = input.trim(); return PATTERN_DATEFORMAT.matcher(input).matches(); } private HelperUtils(); static Long parseTimeString(String input); static String parseStringTs(long ts_Active); static String addZero(int no); static boolean hasCorrectFormat(... | HelperUtils { public static boolean hasCorrectFormat(String input) { input = input.trim(); return PATTERN_DATEFORMAT.matcher(input).matches(); } private HelperUtils(); static Long parseTimeString(String input); static String parseStringTs(long ts_Active); static String addZero(int no); static boolean hasCorrectFormat(... |
@Test public void testParseTimeString() { long ts = HelperUtils.parseTimeString("2013-12-12 12:12"); DateTime dt = new DateTime(2013, 12, 12, 12, 12); assertEquals(dt.getMillis(), ts); ts = HelperUtils.parseTimeString(" 2013-12-12 12:12 "); assertEquals(dt.getMillis(), ts); ts = HelperUtils.parseTimeString("12:12:12 12... | public static Long parseTimeString(String input) { if (input.equals("0") || input.equals("unlimited")) { return 0L; } if (!hasCorrectFormat(input)) { return -1L; } input = input.trim(); DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm"); return formatter.parseDateTime(input).getMillis(); } | HelperUtils { public static Long parseTimeString(String input) { if (input.equals("0") || input.equals("unlimited")) { return 0L; } if (!hasCorrectFormat(input)) { return -1L; } input = input.trim(); DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm"); return formatter.parseDateTime(input).getMi... | HelperUtils { public static Long parseTimeString(String input) { if (input.equals("0") || input.equals("unlimited")) { return 0L; } if (!hasCorrectFormat(input)) { return -1L; } input = input.trim(); DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm"); return formatter.parseDateTime(input).getMi... | HelperUtils { public static Long parseTimeString(String input) { if (input.equals("0") || input.equals("unlimited")) { return 0L; } if (!hasCorrectFormat(input)) { return -1L; } input = input.trim(); DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm"); return formatter.parseDateTime(input).getMi... | HelperUtils { public static Long parseTimeString(String input) { if (input.equals("0") || input.equals("unlimited")) { return 0L; } if (!hasCorrectFormat(input)) { return -1L; } input = input.trim(); DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm"); return formatter.parseDateTime(input).getMi... |
@Test public void testBulkNewDate() { MBox mailbox1 = new MBox("mail1", "xcmailr.test", 0L, false, user); mailbox1.save(); MBox mailbox2 = new MBox("mail2", "xcmailr.test", 0L, false, user); mailbox2.save(); MBox mailbox3 = new MBox("mail3", "xcmailr.test", 0L, false, user); mailbox3.save(); mailbox1.disable(); mailbox... | @FilterWith(JsonSecureFilter.class) public Result bulkNewDate(Object parameter, Context context) { if (!(parameter instanceof Map<?, ?>)) { return Results.badRequest(); } @SuppressWarnings("unchecked") Map<String, Object> input = (Map<String, Object>) parameter; Result result = Results.json(); User user = context.getAt... | BoxHandler { @FilterWith(JsonSecureFilter.class) public Result bulkNewDate(Object parameter, Context context) { if (!(parameter instanceof Map<?, ?>)) { return Results.badRequest(); } @SuppressWarnings("unchecked") Map<String, Object> input = (Map<String, Object>) parameter; Result result = Results.json(); User user = ... | BoxHandler { @FilterWith(JsonSecureFilter.class) public Result bulkNewDate(Object parameter, Context context) { if (!(parameter instanceof Map<?, ?>)) { return Results.badRequest(); } @SuppressWarnings("unchecked") Map<String, Object> input = (Map<String, Object>) parameter; Result result = Results.json(); User user = ... | BoxHandler { @FilterWith(JsonSecureFilter.class) public Result bulkNewDate(Object parameter, Context context) { if (!(parameter instanceof Map<?, ?>)) { return Results.badRequest(); } @SuppressWarnings("unchecked") Map<String, Object> input = (Map<String, Object>) parameter; Result result = Results.json(); User user = ... | BoxHandler { @FilterWith(JsonSecureFilter.class) public Result bulkNewDate(Object parameter, Context context) { if (!(parameter instanceof Map<?, ?>)) { return Results.badRequest(); } @SuppressWarnings("unchecked") Map<String, Object> input = (Map<String, Object>) parameter; Result result = Results.json(); User user = ... |
@Test public void testSplitMailAddress() { assertNull(HelperUtils.splitMailAddress(null)); assertNull(HelperUtils.splitMailAddress("")); assertNull(HelperUtils.splitMailAddress(" ")); String[] parts = HelperUtils.splitMailAddress("foo"); assertNotNull(parts); assertEquals(1, parts.length); parts = HelperUtils.splitMail... | public static String[] splitMailAddress(String mailAddress) { mailAddress = StringUtils.defaultString(mailAddress).trim(); if (mailAddress.length() > 0) { return mailAddress.split("@"); } return null; } | HelperUtils { public static String[] splitMailAddress(String mailAddress) { mailAddress = StringUtils.defaultString(mailAddress).trim(); if (mailAddress.length() > 0) { return mailAddress.split("@"); } return null; } } | HelperUtils { public static String[] splitMailAddress(String mailAddress) { mailAddress = StringUtils.defaultString(mailAddress).trim(); if (mailAddress.length() > 0) { return mailAddress.split("@"); } return null; } private HelperUtils(); } | HelperUtils { public static String[] splitMailAddress(String mailAddress) { mailAddress = StringUtils.defaultString(mailAddress).trim(); if (mailAddress.length() > 0) { return mailAddress.split("@"); } return null; } private HelperUtils(); static Long parseTimeString(String input); static String parseStringTs(long ts_... | HelperUtils { public static String[] splitMailAddress(String mailAddress) { mailAddress = StringUtils.defaultString(mailAddress).trim(); if (mailAddress.length() > 0) { return mailAddress.split("@"); } return null; } private HelperUtils(); static Long parseTimeString(String input); static String parseStringTs(long ts_... |
@Test public void testCheckEmailAddressValidness() { assertFalse(HelperUtils.checkEmailAddressValidness(null, null)); assertFalse(HelperUtils.checkEmailAddressValidness(null, ArrayUtils.EMPTY_STRING_ARRAY)); assertFalse(HelperUtils.checkEmailAddressValidness(ArrayUtils.EMPTY_STRING_ARRAY, ArrayUtils.EMPTY_STRING_ARRAY)... | public static boolean checkEmailAddressValidness(String[] mailAddressParts, String[] domainList) { if (mailAddressParts == null || domainList == null || mailAddressParts.length != 2) { return false; } boolean foundDomain = false; for (String domain : domainList) { if (domain.equalsIgnoreCase(mailAddressParts[1])) { fou... | HelperUtils { public static boolean checkEmailAddressValidness(String[] mailAddressParts, String[] domainList) { if (mailAddressParts == null || domainList == null || mailAddressParts.length != 2) { return false; } boolean foundDomain = false; for (String domain : domainList) { if (domain.equalsIgnoreCase(mailAddressPa... | HelperUtils { public static boolean checkEmailAddressValidness(String[] mailAddressParts, String[] domainList) { if (mailAddressParts == null || domainList == null || mailAddressParts.length != 2) { return false; } boolean foundDomain = false; for (String domain : domainList) { if (domain.equalsIgnoreCase(mailAddressPa... | HelperUtils { public static boolean checkEmailAddressValidness(String[] mailAddressParts, String[] domainList) { if (mailAddressParts == null || domainList == null || mailAddressParts.length != 2) { return false; } boolean foundDomain = false; for (String domain : domainList) { if (domain.equalsIgnoreCase(mailAddressPa... | HelperUtils { public static boolean checkEmailAddressValidness(String[] mailAddressParts, String[] domainList) { if (mailAddressParts == null || domainList == null || mailAddressParts.length != 2) { return false; } boolean foundDomain = false; for (String domain : domainList) { if (domain.equalsIgnoreCase(mailAddressPa... |
@Test(expected = SizeLimitExceededException.class) public void testReadRawContent_LimitExceeded() throws Exception { final InputStream is = new ByteArrayInputStream(RandomUtils.nextBytes(30)); HelperUtils.readLimitedAmount(is, 25); } | public static byte[] readLimitedAmount(InputStream data, int maxSize) throws IOException { final ByteArrayOutputStream bos = new ByteArrayOutputStream(data.available()); final long count = IOUtils.copy(data, bos, 4096); if (count > maxSize) { throw new SizeLimitExceededException("Data stream exceeds size limit of " + m... | HelperUtils { public static byte[] readLimitedAmount(InputStream data, int maxSize) throws IOException { final ByteArrayOutputStream bos = new ByteArrayOutputStream(data.available()); final long count = IOUtils.copy(data, bos, 4096); if (count > maxSize) { throw new SizeLimitExceededException("Data stream exceeds size ... | HelperUtils { public static byte[] readLimitedAmount(InputStream data, int maxSize) throws IOException { final ByteArrayOutputStream bos = new ByteArrayOutputStream(data.available()); final long count = IOUtils.copy(data, bos, 4096); if (count > maxSize) { throw new SizeLimitExceededException("Data stream exceeds size ... | HelperUtils { public static byte[] readLimitedAmount(InputStream data, int maxSize) throws IOException { final ByteArrayOutputStream bos = new ByteArrayOutputStream(data.available()); final long count = IOUtils.copy(data, bos, 4096); if (count > maxSize) { throw new SizeLimitExceededException("Data stream exceeds size ... | HelperUtils { public static byte[] readLimitedAmount(InputStream data, int maxSize) throws IOException { final ByteArrayOutputStream bos = new ByteArrayOutputStream(data.available()); final long count = IOUtils.copy(data, bos, 4096); if (count > maxSize) { throw new SizeLimitExceededException("Data stream exceeds size ... |
@Test public void testQueryAllMailboxes() throws Exception { user.setApiToken("validToken"); user.save(); result = ninjaTestBrowser.makeRequest(ninjaTestServer.getBaseUrl() + "/create/temporaryMail/" + user.getApiToken() + "/queryallmails@xcmailr.test/11"); assertTrue(result.contains("<div id=\"createdMail\">")); user ... | @FilterWith(SecureFilter.class) public Result queryAllMailboxes(Context context, @Param("offset") final Integer offset, @Param("limit") final Integer limit, @Param("sort") String sort, @Param("order") String order, @Param("search") String search) throws Exception { final String formatParameter = context.getParameter("f... | BoxHandler { @FilterWith(SecureFilter.class) public Result queryAllMailboxes(Context context, @Param("offset") final Integer offset, @Param("limit") final Integer limit, @Param("sort") String sort, @Param("order") String order, @Param("search") String search) throws Exception { final String formatParameter = context.ge... | BoxHandler { @FilterWith(SecureFilter.class) public Result queryAllMailboxes(Context context, @Param("offset") final Integer offset, @Param("limit") final Integer limit, @Param("sort") String sort, @Param("order") String order, @Param("search") String search) throws Exception { final String formatParameter = context.ge... | BoxHandler { @FilterWith(SecureFilter.class) public Result queryAllMailboxes(Context context, @Param("offset") final Integer offset, @Param("limit") final Integer limit, @Param("sort") String sort, @Param("order") String order, @Param("search") String search) throws Exception { final String formatParameter = context.ge... | BoxHandler { @FilterWith(SecureFilter.class) public Result queryAllMailboxes(Context context, @Param("offset") final Integer offset, @Param("limit") final Integer limit, @Param("sort") String sort, @Param("order") String order, @Param("search") String search) throws Exception { final String formatParameter = context.ge... |
@Test public void testQueryMailbox() throws Exception { user.setApiToken("validToken"); user.save(); ninjaTestBrowser.makeRequest(ninjaTestServer.getBaseUrl() + "/create/temporaryMail/" + user.getApiToken() + "/mailboxquery@xcmailr.test/10"); user = User.getById(user.getId()); List<MBox> mailBoxes = user.getBoxes(); as... | public Result queryMailbox(@PathParam("token") String apiToken, @PathParam("mailAddress") String mailAddress, Context context) throws Exception { if (apiToken == null || mailAddress == null) return ninja.getBadRequestResult(context, null); log.trace("passed null check"); User user = User.findUserByToken(apiToken); if (... | BoxHandler { public Result queryMailbox(@PathParam("token") String apiToken, @PathParam("mailAddress") String mailAddress, Context context) throws Exception { if (apiToken == null || mailAddress == null) return ninja.getBadRequestResult(context, null); log.trace("passed null check"); User user = User.findUserByToken(ap... | BoxHandler { public Result queryMailbox(@PathParam("token") String apiToken, @PathParam("mailAddress") String mailAddress, Context context) throws Exception { if (apiToken == null || mailAddress == null) return ninja.getBadRequestResult(context, null); log.trace("passed null check"); User user = User.findUserByToken(ap... | BoxHandler { public Result queryMailbox(@PathParam("token") String apiToken, @PathParam("mailAddress") String mailAddress, Context context) throws Exception { if (apiToken == null || mailAddress == null) return ninja.getBadRequestResult(context, null); log.trace("passed null check"); User user = User.findUserByToken(ap... | BoxHandler { public Result queryMailbox(@PathParam("token") String apiToken, @PathParam("mailAddress") String mailAddress, Context context) throws Exception { if (apiToken == null || mailAddress == null) return ninja.getBadRequestResult(context, null); log.trace("passed null check"); User user = User.findUserByToken(ap... |
@Test public void listMailboxes_emptyList() throws Exception { final HttpResponse response = apiClient.listMailboxes(); RestApiTestUtils.validateStatusCode(response, 200); final MailboxData[] mailboxData = RestApiTestUtils.getResponseBodyAs(response, MailboxData[].class); Assert.assertEquals(0, mailboxData.length); } | public Result listMailboxes(@Attribute("userId") @DbId final Long userId, final Context context) { final List<MBox> mailboxes = MBox.allUser(userId); final List<MailboxData> mailboxDatas = mailboxes.stream().map(mb -> new MailboxData(mb)) .collect(Collectors.toList()); return ApiResults.ok().render(mailboxDatas); } | MailboxApiController extends AbstractApiController { public Result listMailboxes(@Attribute("userId") @DbId final Long userId, final Context context) { final List<MBox> mailboxes = MBox.allUser(userId); final List<MailboxData> mailboxDatas = mailboxes.stream().map(mb -> new MailboxData(mb)) .collect(Collectors.toList()... | MailboxApiController extends AbstractApiController { public Result listMailboxes(@Attribute("userId") @DbId final Long userId, final Context context) { final List<MBox> mailboxes = MBox.allUser(userId); final List<MailboxData> mailboxDatas = mailboxes.stream().map(mb -> new MailboxData(mb)) .collect(Collectors.toList()... | MailboxApiController extends AbstractApiController { public Result listMailboxes(@Attribute("userId") @DbId final Long userId, final Context context) { final List<MBox> mailboxes = MBox.allUser(userId); final List<MailboxData> mailboxDatas = mailboxes.stream().map(mb -> new MailboxData(mb)) .collect(Collectors.toList()... | MailboxApiController extends AbstractApiController { public Result listMailboxes(@Attribute("userId") @DbId final Long userId, final Context context) { final List<MBox> mailboxes = MBox.allUser(userId); final List<MailboxData> mailboxDatas = mailboxes.stream().map(mb -> new MailboxData(mb)) .collect(Collectors.toList()... |
@Test public void createMailbox() throws Exception { final String mailboxAddress = "foo@xcmailr.test"; final long expirationDate = System.currentTimeMillis(); final boolean forwardEnabled = true; final HttpResponse response = apiClient.createMailbox(mailboxAddress, expirationDate, forwardEnabled); RestApiTestUtils.vali... | public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return doCreateMailbox(mailboxData, user); } | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... |
@Test public void createMailbox_emailAlreadyTakenBySameUser() throws Exception { MBox mailbox = TestDataUtils.createMailbox(user); final String mailboxAddress = mailbox.getFullAddress(); final long expirationDate = System.currentTimeMillis(); final boolean forwardEnabled = true; final HttpResponse response = apiClient.... | public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return doCreateMailbox(mailboxData, user); } | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... |
@Test public void createMailbox_emailAlreadyTakenByOtherUser() throws Exception { final User otherUser = TestDataUtils.createUser(); final MBox otherUsersMailbox = TestDataUtils.createMailbox(otherUser); final String mailboxAddress = otherUsersMailbox.getFullAddress(); final long expirationDate = System.currentTimeMill... | public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return doCreateMailbox(mailboxData, user); } | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... | MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return do... |
@Test void canGetIndex() { Assertions.assertThat(this.controller.getIndex()).isEqualTo("index"); } | @GetMapping( value = { "/", "/applications/**", "/clusters/**", "/commands/**", "/jobs/**", "/output/**" } ) public String getIndex() { return "index"; } | UIController { @GetMapping( value = { "/", "/applications/**", "/clusters/**", "/commands/**", "/jobs/**", "/output/**" } ) public String getIndex() { return "index"; } } | UIController { @GetMapping( value = { "/", "/applications/**", "/clusters/**", "/commands/**", "/jobs/**", "/output/**" } ) public String getIndex() { return "index"; } } | UIController { @GetMapping( value = { "/", "/applications/**", "/clusters/**", "/commands/**", "/jobs/**", "/output/**" } ) public String getIndex() { return "index"; } @GetMapping( value = { "/", "/applications/**", "/clusters/**", "/commands/**", "/jobs/**", "/output/**" } ) String getIndex(); @GetMapping(value = "/... | UIController { @GetMapping( value = { "/", "/applications/**", "/clusters/**", "/commands/**", "/jobs/**", "/output/**" } ) public String getIndex() { return "index"; } @GetMapping( value = { "/", "/applications/**", "/clusters/**", "/commands/**", "/jobs/**", "/output/**" } ) String getIndex(); @GetMapping(value = "/... |
@Test void canConvertToModel() { final EntityModel<Cluster> model = this.assembler.toModel(this.cluster); Assertions.assertThat(model.getLinks()).hasSize(2); Assertions.assertThat(model.getLink("self")).isPresent(); Assertions.assertThat(model.getLink("commands")).isPresent(); } | @Override @Nonnull public EntityModel<Cluster> toModel(final Cluster cluster) { final String id = cluster.getId().orElseThrow(IllegalArgumentException::new); final EntityModel<Cluster> clusterModel = new EntityModel<>(cluster); try { clusterModel.add( WebMvcLinkBuilder.linkTo( WebMvcLinkBuilder .methodOn(ClusterRestCon... | ClusterModelAssembler implements RepresentationModelAssembler<Cluster, EntityModel<Cluster>> { @Override @Nonnull public EntityModel<Cluster> toModel(final Cluster cluster) { final String id = cluster.getId().orElseThrow(IllegalArgumentException::new); final EntityModel<Cluster> clusterModel = new EntityModel<>(cluster... | ClusterModelAssembler implements RepresentationModelAssembler<Cluster, EntityModel<Cluster>> { @Override @Nonnull public EntityModel<Cluster> toModel(final Cluster cluster) { final String id = cluster.getId().orElseThrow(IllegalArgumentException::new); final EntityModel<Cluster> clusterModel = new EntityModel<>(cluster... | ClusterModelAssembler implements RepresentationModelAssembler<Cluster, EntityModel<Cluster>> { @Override @Nonnull public EntityModel<Cluster> toModel(final Cluster cluster) { final String id = cluster.getId().orElseThrow(IllegalArgumentException::new); final EntityModel<Cluster> clusterModel = new EntityModel<>(cluster... | ClusterModelAssembler implements RepresentationModelAssembler<Cluster, EntityModel<Cluster>> { @Override @Nonnull public EntityModel<Cluster> toModel(final Cluster cluster) { final String id = cluster.getId().orElseThrow(IllegalArgumentException::new); final EntityModel<Cluster> clusterModel = new EntityModel<>(cluster... |
@Test void canConvertToResource() { final JsonNode node = JsonNodeFactory.instance.objectNode().set("description", JsonNodeFactory.instance.textNode("blah")); final EntityModel<JsonNode> model = this.assembler.toModel(node); Assertions.assertThat(model.getLinks()).hasSize(5); Assertions.assertThat(model.getContent()).i... | @Override @SuppressFBWarnings("NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS") @Nonnull public EntityModel<JsonNode> toModel(final JsonNode metadata) { final EntityModel<JsonNode> rootResource = new EntityModel<>(metadata); try { rootResource.add( WebMvcLinkBuilder.linkTo( WebMvcLinkBuilder .methodOn(RootRestController.cla... | RootModelAssembler implements RepresentationModelAssembler<JsonNode, EntityModel<JsonNode>> { @Override @SuppressFBWarnings("NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS") @Nonnull public EntityModel<JsonNode> toModel(final JsonNode metadata) { final EntityModel<JsonNode> rootResource = new EntityModel<>(metadata); try { ... | RootModelAssembler implements RepresentationModelAssembler<JsonNode, EntityModel<JsonNode>> { @Override @SuppressFBWarnings("NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS") @Nonnull public EntityModel<JsonNode> toModel(final JsonNode metadata) { final EntityModel<JsonNode> rootResource = new EntityModel<>(metadata); try { ... | RootModelAssembler implements RepresentationModelAssembler<JsonNode, EntityModel<JsonNode>> { @Override @SuppressFBWarnings("NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS") @Nonnull public EntityModel<JsonNode> toModel(final JsonNode metadata) { final EntityModel<JsonNode> rootResource = new EntityModel<>(metadata); try { ... | RootModelAssembler implements RepresentationModelAssembler<JsonNode, EntityModel<JsonNode>> { @Override @SuppressFBWarnings("NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS") @Nonnull public EntityModel<JsonNode> toModel(final JsonNode metadata) { final EntityModel<JsonNode> rootResource = new EntityModel<>(metadata); try { ... |
@Test void canConvertToResource() { final EntityModel<JobSearchResult> model = this.assembler.toModel(this.jobSearchResult); Assertions.assertThat(model.getLinks()).hasSize(1); Assertions.assertThat(model.getLink("self")).isNotNull(); } | @Override @Nonnull public EntityModel<JobSearchResult> toModel(final JobSearchResult job) { final EntityModel<JobSearchResult> jobSearchResultModel = new EntityModel<>(job); try { jobSearchResultModel.add( WebMvcLinkBuilder.linkTo( WebMvcLinkBuilder .methodOn(JobRestController.class) .getJob(job.getId()) ).withSelfRel(... | JobSearchResultModelAssembler implements RepresentationModelAssembler<JobSearchResult, EntityModel<JobSearchResult>> { @Override @Nonnull public EntityModel<JobSearchResult> toModel(final JobSearchResult job) { final EntityModel<JobSearchResult> jobSearchResultModel = new EntityModel<>(job); try { jobSearchResultModel.... | JobSearchResultModelAssembler implements RepresentationModelAssembler<JobSearchResult, EntityModel<JobSearchResult>> { @Override @Nonnull public EntityModel<JobSearchResult> toModel(final JobSearchResult job) { final EntityModel<JobSearchResult> jobSearchResultModel = new EntityModel<>(job); try { jobSearchResultModel.... | JobSearchResultModelAssembler implements RepresentationModelAssembler<JobSearchResult, EntityModel<JobSearchResult>> { @Override @Nonnull public EntityModel<JobSearchResult> toModel(final JobSearchResult job) { final EntityModel<JobSearchResult> jobSearchResultModel = new EntityModel<>(job); try { jobSearchResultModel.... | JobSearchResultModelAssembler implements RepresentationModelAssembler<JobSearchResult, EntityModel<JobSearchResult>> { @Override @Nonnull public EntityModel<JobSearchResult> toModel(final JobSearchResult job) { final EntityModel<JobSearchResult> jobSearchResultModel = new EntityModel<>(job); try { jobSearchResultModel.... |
@Test void canConvertToResource() { final EntityModel<Command> model = this.assembler.toModel(this.command); Assertions.assertThat(model.getLinks()).hasSize(3); Assertions.assertThat(model.getLink("self")).isPresent(); Assertions.assertThat(model.getLink("applications")).isPresent(); Assertions.assertThat(model.getLink... | @Override @Nonnull public EntityModel<Command> toModel(final Command command) { final String id = command.getId().orElseThrow(IllegalArgumentException::new); final EntityModel<Command> commandModel = new EntityModel<>(command); try { commandModel.add( WebMvcLinkBuilder.linkTo( WebMvcLinkBuilder .methodOn(CommandRestCon... | CommandModelAssembler implements RepresentationModelAssembler<Command, EntityModel<Command>> { @Override @Nonnull public EntityModel<Command> toModel(final Command command) { final String id = command.getId().orElseThrow(IllegalArgumentException::new); final EntityModel<Command> commandModel = new EntityModel<>(command... | CommandModelAssembler implements RepresentationModelAssembler<Command, EntityModel<Command>> { @Override @Nonnull public EntityModel<Command> toModel(final Command command) { final String id = command.getId().orElseThrow(IllegalArgumentException::new); final EntityModel<Command> commandModel = new EntityModel<>(command... | CommandModelAssembler implements RepresentationModelAssembler<Command, EntityModel<Command>> { @Override @Nonnull public EntityModel<Command> toModel(final Command command) { final String id = command.getId().orElseThrow(IllegalArgumentException::new); final EntityModel<Command> commandModel = new EntityModel<>(command... | CommandModelAssembler implements RepresentationModelAssembler<Command, EntityModel<Command>> { @Override @Nonnull public EntityModel<Command> toModel(final Command command) { final String id = command.getId().orElseThrow(IllegalArgumentException::new); final EntityModel<Command> commandModel = new EntityModel<>(command... |
@Test void wontForwardJobOutputRequestIfOnCorrectHost() throws GenieException, GenieCheckedException { this.jobsProperties.getForwarding().setEnabled(true); final String jobId = UUID.randomUUID().toString(); final HttpServletRequest request = Mockito.mock(HttpServletRequest.class); final HttpServletResponse response = ... | @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final HttpServletResponse... | JobRestController { @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final... | JobRestController { @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final... | JobRestController { @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final... | JobRestController { @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final... |
@Test void wontThrow404ForJobOutputRequestIfAgentNotFound() throws GenieException, GenieCheckedException { this.jobsProperties.getForwarding().setEnabled(true); final String jobId = UUID.randomUUID().toString(); final HttpServletRequest request = Mockito.mock(HttpServletRequest.class); final HttpServletResponse respons... | @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final HttpServletResponse... | JobRestController { @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final... | JobRestController { @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final... | JobRestController { @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final... | JobRestController { @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final... |
@Test void wontForwardJobOutputRequestIfForwardingRequestWasForwarded() throws GenieException, GenieCheckedException { this.jobsProperties.getForwarding().setEnabled(true); final String jobId = UUID.randomUUID().toString(); final HttpServletRequest request = Mockito.mock(HttpServletRequest.class); final HttpServletResp... | @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final HttpServletResponse... | JobRestController { @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final... | JobRestController { @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final... | JobRestController { @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final... | JobRestController { @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final... |
@Test void canHandleForwardJobOutputRequestWithSuccess() throws IOException, GenieException, GenieCheckedException { this.jobsProperties.getForwarding().setEnabled(true); final String jobId = UUID.randomUUID().toString(); final HttpServletRequest request = Mockito.mock(HttpServletRequest.class); final HttpServletRespon... | @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final HttpServletResponse... | JobRestController { @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final... | JobRestController { @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final... | JobRestController { @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final... | JobRestController { @GetMapping( value = { "/{id}/output", "/{id}/output/", "/{id}/output/**" } ) public void getJobOutput( @PathVariable("id") final String id, @RequestHeader(name = JobConstants.GENIE_FORWARDED_FROM_HEADER, required = false) @Nullable final String forwardedFrom, final HttpServletRequest request, final... |
@Test void whenJobSubmissionIsDisabledItThrowsCorrectError() { final String errorMessage = UUID.randomUUID().toString(); Mockito.when( this.environment.getProperty( JobConstants.JOB_SUBMISSION_ENABLED_PROPERTY_KEY, Boolean.class, true ) ).thenReturn(false); Mockito.when( this.environment.getProperty( JobConstants.JOB_S... | @PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.ACCEPTED) public ResponseEntity<Void> submitJob( @Valid @RequestBody final JobRequest jobRequest, @RequestHeader(value = FORWARDED_FOR_HEADER, required = false) @Nullable final String clientHost, @RequestHeader(value = HttpHeaders.USER... | JobRestController { @PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.ACCEPTED) public ResponseEntity<Void> submitJob( @Valid @RequestBody final JobRequest jobRequest, @RequestHeader(value = FORWARDED_FOR_HEADER, required = false) @Nullable final String clientHost, @RequestHeader(valu... | JobRestController { @PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.ACCEPTED) public ResponseEntity<Void> submitJob( @Valid @RequestBody final JobRequest jobRequest, @RequestHeader(value = FORWARDED_FOR_HEADER, required = false) @Nullable final String clientHost, @RequestHeader(valu... | JobRestController { @PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.ACCEPTED) public ResponseEntity<Void> submitJob( @Valid @RequestBody final JobRequest jobRequest, @RequestHeader(value = FORWARDED_FOR_HEADER, required = false) @Nullable final String clientHost, @RequestHeader(valu... | JobRestController { @PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.ACCEPTED) public ResponseEntity<Void> submitJob( @Valid @RequestBody final JobRequest jobRequest, @RequestHeader(value = FORWARDED_FOR_HEADER, required = false) @Nullable final String clientHost, @RequestHeader(valu... |
@Test void canHandleGenieExceptions() { final List<GenieException> exceptions = Arrays.asList( new GenieBadRequestException("bad"), new GenieNotFoundException("Not Found"), new GeniePreconditionException("Precondition"), new GenieServerException("server"), new GenieServerUnavailableException("Server Unavailable"), new ... | @ExceptionHandler(GenieException.class) public ResponseEntity<GenieException> handleGenieException(final GenieException e) { this.countExceptionAndLog(e); HttpStatus status = HttpStatus.resolve(e.getErrorCode()); if (status == null) { status = HttpStatus.INTERNAL_SERVER_ERROR; } return new ResponseEntity<>(e, status); ... | GenieExceptionMapper { @ExceptionHandler(GenieException.class) public ResponseEntity<GenieException> handleGenieException(final GenieException e) { this.countExceptionAndLog(e); HttpStatus status = HttpStatus.resolve(e.getErrorCode()); if (status == null) { status = HttpStatus.INTERNAL_SERVER_ERROR; } return new Respon... | GenieExceptionMapper { @ExceptionHandler(GenieException.class) public ResponseEntity<GenieException> handleGenieException(final GenieException e) { this.countExceptionAndLog(e); HttpStatus status = HttpStatus.resolve(e.getErrorCode()); if (status == null) { status = HttpStatus.INTERNAL_SERVER_ERROR; } return new Respon... | GenieExceptionMapper { @ExceptionHandler(GenieException.class) public ResponseEntity<GenieException> handleGenieException(final GenieException e) { this.countExceptionAndLog(e); HttpStatus status = HttpStatus.resolve(e.getErrorCode()); if (status == null) { status = HttpStatus.INTERNAL_SERVER_ERROR; } return new Respon... | GenieExceptionMapper { @ExceptionHandler(GenieException.class) public ResponseEntity<GenieException> handleGenieException(final GenieException e) { this.countExceptionAndLog(e); HttpStatus status = HttpStatus.resolve(e.getErrorCode()); if (status == null) { status = HttpStatus.INTERNAL_SERVER_ERROR; } return new Respon... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.