List of usage examples for org.apache.commons.lang3 StringUtils EMPTY
String EMPTY
To view the source code for org.apache.commons.lang3 StringUtils EMPTY.
Click Source Link
From source file:com.qualys.jserf.SerfClientIT.java
@Test(timeout = 10000) public void testStats() throws Exception { while (!client.isConnected()) { Thread.sleep(500);//from w ww . j av a2 s . c o m } final boolean[] callbackInvoked = { false }; final CountDownLatch latch = new CountDownLatch(1); SerfResponseCallBack<StatsResponseBody> callBack = new SerfResponseCallBack<StatsResponseBody>() { @Override public void call(SerfResponse<StatsResponseBody> response) { log.debug("Received call back with sequence {}", response.getHeader().getSeq()); callbackInvoked[0] = true; assertNotNull(response.getHeader()); assertEquals(StringUtils.EMPTY, response.getHeader().getError()); assertEquals(StatsResponseBody.class, response.getBody().getClass()); assertNotNull(response.getBody()); StatsResponseBody body = response.getBody(); log.debug("body={}", body); assertNotNull(body.getAgent()); assertNotNull(body.getRuntime()); assertNotNull(body.getSerf()); assertNotNull(body.getTags()); //don't count down unless all the asserts pass latch.countDown(); } }; SerfRequest request = SerfRequests.stats(callBack); client.makeRpc(request); latch.await(); assertTrue(callbackInvoked[0]); }
From source file:io.knotx.mocks.knot.MockKnotHandler.java
private JsonObject mergeResponseValues(JsonObject result, Pair<String, Optional<Object>> value) { return new JsonObject().put(value.getLeft(), value.getRight().orElse(StringUtils.EMPTY)); }
From source file:com.vrem.wifianalyzer.wifi.ConnectionViewTest.java
private WiFiDetail withConnection(WiFiAdditional wiFiAdditional) { return new WiFiDetail("SSID", "BSSID", StringUtils.EMPTY, new WiFiSignal(2435, WiFiWidth.MHZ_20, -55), wiFiAdditional);//from w w w .java2 s.c o m }
From source file:com.msopentech.odatajclient.proxy.InvokeTestITCase.java
@Test public void getWithParam() { // 1. primitive result assertEquals(155, container.getArgumentPlusOne(154).intValue()); // 2. entity collection result final CustomerCollection customers = container.getSpecificCustomer(StringUtils.EMPTY); assertNotNull(customers);/*from w w w . j av a 2 s .co m*/ assertFalse(customers.isEmpty()); final Set<Integer> customerIds = new HashSet<Integer>(customers.size()); for (Customer customer : customers) { assertNotNull(customer); customerIds.add(customer.getCustomerId()); } assertTrue(customerIds.contains(-8)); }
From source file:com.vrem.wifianalyzer.wifi.accesspoint.AccessPointDetailTest.java
@Test public void testMakeViewShouldUseGivenView() throws Exception { // setup//from www.j a v a 2 s . co m View expected = mainActivity.getLayoutInflater().inflate(AccessPointViewType.COMPLETE.getLayout(), null, false); WiFiDetail wiFiDetail = withWiFiDetail(SSID, new WiFiAdditional(StringUtils.EMPTY, true)); // execute View actual = fixture.makeView(expected, null, wiFiDetail, false); // validate assertEquals(expected, actual); }
From source file:com.inkubator.hrm.service.impl.NotificationApproverSmsMessagesListener.java
@Override @Transactional(readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, timeout = 50, rollbackFor = Exception.class) public void onMessage(Message message) { String approverNumber = StringUtils.EMPTY; String notifMessage = StringUtils.EMPTY; try {/*from www . j av a2 s . c o m*/ TextMessage textMessage = (TextMessage) message; String json = textMessage.getText(); approverNumber = jsonConverter.getValueByKey(json, "senderNumber"); HrmUser approver = hrmUserDao.getEntityByPhoneNumber("+" + approverNumber); String content = jsonConverter.getValueByKey(json, "smsContent"); String[] arrContent = StringUtils.split(content, "#"); notifMessage = StringUtils.EMPTY; ApprovalActivity approvalActivity = StringUtils.isNumeric(arrContent[0]) ? approvalActivityDao.getEntiyByPK(Long.parseLong(arrContent[0])) : null; /** validation */ if (approver == null) { notifMessage = "Maaf, No Telepon tidak terdaftar "; } else if (arrContent.length != 3) { notifMessage = "Maaf, format tidak sesuai dengan standard : ApprovalActivityID#YES/NO/REVISI#COMMENT "; } else if (!(StringUtils.equalsIgnoreCase(arrContent[1], "YES") || StringUtils.equalsIgnoreCase(arrContent[1], "NO") || StringUtils.equalsIgnoreCase(arrContent[1], "REVISI"))) { notifMessage = "Maaf, format tidak sesuai dengan standard : ApprovalActivityID#YES/NO/REVISI#COMMENT "; } else if (!StringUtils.isNumeric(arrContent[0])) { notifMessage = "Maaf, Approval Activity ID tidak terdaftar"; } else if (approvalActivity == null) { notifMessage = "Maaf, approval activity ID tidak terdaftar"; } else if (!StringUtils.equals(approvalActivity.getApprovedBy(), approver.getUserId())) { notifMessage = "Maaf, No Telpon ini tidak berhak untuk melakukan approval"; } else if (approvalActivity.getApprovalStatus() != HRMConstant.APPROVAL_STATUS_WAITING_APPROVAL) { notifMessage = "Maaf, permintaan tidak dapat di proses karena status Approval sudah berubah"; } /** proses approval, jika memenuhi validasi */ if (StringUtils.isEmpty(notifMessage)) { if (StringUtils.equalsIgnoreCase(arrContent[1], "YES")) { /** do Approved */ switch (approvalActivity.getApprovalDefinition().getName()) { case HRMConstant.BUSINESS_TRAVEL: businessTravelService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.LOAN: loanNewApplicationService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.REIMBURSEMENT: rmbsApplicationService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.REIMBURSEMENT_DISBURSEMENT: rmbsDisbursementService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.SHIFT_SCHEDULE: tempJadwalKaryawanService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.LEAVE: leaveImplementationService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.LEAVE_CANCELLATION: leaveImplementationService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.ANNOUNCEMENT: announcementService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.EMP_CORRECTION_ATTENDANCE: wtEmpCorrectionAttendanceService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.VACANCY_ADVERTISEMENT: recruitVacancyAdvertisementService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.EMPLOYEE_CAREER_TRANSITION: empCareerHistoryService.approved(approvalActivity.getId(), null, arrContent[2]); break; default: break; } notifMessage = "Terima kasih, permintaan untuk disetujui telah di proses"; } else if (StringUtils.equalsIgnoreCase(arrContent[1], "NO")) { /** do Rejected */ switch (approvalActivity.getApprovalDefinition().getName()) { case HRMConstant.BUSINESS_TRAVEL: businessTravelService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.LOAN: loanNewApplicationService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.REIMBURSEMENT: rmbsApplicationService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.REIMBURSEMENT_DISBURSEMENT: rmbsDisbursementService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.SHIFT_SCHEDULE: tempJadwalKaryawanService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.LEAVE: leaveImplementationService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.LEAVE_CANCELLATION: leaveImplementationService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.ANNOUNCEMENT: announcementService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.EMP_CORRECTION_ATTENDANCE: wtEmpCorrectionAttendanceService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.VACANCY_ADVERTISEMENT: recruitVacancyAdvertisementService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.EMPLOYEE_CAREER_TRANSITION: empCareerHistoryService.rejected(approvalActivity.getId(), arrContent[2]); break; default: break; } notifMessage = "Terima kasih, permintaan untuk ditolak telah di proses"; } else if (StringUtils.equalsIgnoreCase(arrContent[1], "REVISI")) { /** do Asking Revised */ switch (approvalActivity.getApprovalDefinition().getName()) { case HRMConstant.LOAN: loanNewApplicationService.askingRevised(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.REIMBURSEMENT: rmbsApplicationService.askingRevised(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.REIMBURSEMENT_DISBURSEMENT: rmbsDisbursementService.askingRevised(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.ANNOUNCEMENT: announcementService.askingRevised(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.EMP_CORRECTION_ATTENDANCE: wtEmpCorrectionAttendanceService.askingRevised(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.VACANCY_ADVERTISEMENT: recruitVacancyAdvertisementService.askingRevised(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.EMPLOYEE_CAREER_TRANSITION: empCareerHistoryService.askingRevised(approvalActivity.getId(), arrContent[2]); break; default: /** Tidak semua module implement asking revised, jika belum/tidak implement maka kirim sms balik ke sender untuk notifikasi */ notifMessage = "Maaf, permintaan untuk \"REVISI\" tidak dapat diproses. Hanya bisa melakukan proses \"YES\" atau \"NO\""; break; } if (StringUtils.isEmpty(notifMessage)) { notifMessage = "Terima kasih, permintaan untuk direvisi telah di proses"; } } } } catch (Exception ex) { notifMessage = "Maaf, permintaan tidak dapat di proses, ada kegagalan di sistem. Mohon ulangi proses via aplikasi web atau hubungi Administrator"; LOGGER.error("Error", ex); } /** kirim sms balik ke sender untuk notifikasi messagenya */ final SMSSend mSSend = new SMSSend(); LOGGER.error("Info SMS " + notifMessage); mSSend.setFrom(HRMConstant.SYSTEM_ADMIN); mSSend.setDestination("+" + approverNumber); mSSend.setContent(notifMessage); //Send notificatin SMS this.jmsTemplateSMS.send(new MessageCreator() { @Override public Message createMessage(Session session) throws JMSException { return session.createTextMessage(jsonConverter.getJson(mSSend)); } }); }
From source file:models.PullRequestEvent.java
public static void addCommitEvents(User sender, PullRequest pullRequest, List<PullRequestCommit> commits, String oldValue) {/* www. jav a2 s .com*/ Date createdDate = new Date(); PullRequestEvent event = new PullRequestEvent(); event.created = createdDate; event.senderLoginId = sender.loginId; event.pullRequest = pullRequest; event.eventType = EventType.PULL_REQUEST_COMMIT_CHANGED; event.newValue = StringUtils.EMPTY; event.oldValue = oldValue; for (int i = 0; i < commits.size(); i++) { event.newValue += commits.get(i).id; if (i != commits.size() - 1) { event.newValue += PullRequest.DELIMETER; } } event.save(); }
From source file:com.aqnote.app.wifianalyzer.wifi.AccessPointsDetailTest.java
@Test public void testSetViewWithTabGone() throws Exception { // setup/*from ww w. j a va 2s . c o m*/ WiFiAdditional wiFiAdditional = new WiFiAdditional(StringUtils.EMPTY, "IPAddress", 22); WiFiDetail wiFiDetail = withWiFiDetail("SSID", wiFiAdditional); // execute fixture.setView(mainActivity.getResources(), view, wiFiDetail, false); // validate assertEquals(View.GONE, view.findViewById(R.id.tab).getVisibility()); }
From source file:com.mgmtp.perfload.perfalyzer.util.PerfAlyzerFile.java
/** * @return the file/*w ww.j a v a2 s. c o m*/ */ public File getFile() { String baseName = '[' + on("][").join(fileNameParts) + ']'; if (marker != null) { baseName += "{" + marker + '}'; } return new File(path, baseName + (extension.equals(StringUtils.EMPTY) ? StringUtils.EMPTY : '.' + extension)); }
From source file:com.googlecode.jsendnsca.builders.MessagePayloadBuilderTest.java
@Test public void shouldConstructPayloadWithoutUsingLocalHostname() { MessagePayload messagePayload = new MessagePayloadBuilder() { @Override// w w w.jav a2 s . c om MessagePayload createMessagePayload() { return new MessagePayload(false) { @Override public void useLocalHostname() { throw new UnknownHostRuntimeException(new UnknownHostException()); } }; } }.create(); assertEquals("UNKNOWN", messagePayload.getHostname()); assertEquals(Level.UNKNOWN, messagePayload.getLevel()); assertEquals("UNDEFINED", messagePayload.getServiceName()); assertEquals(StringUtils.EMPTY, messagePayload.getMessage()); }