List of usage examples for java.lang Long MIN_VALUE
long MIN_VALUE
To view the source code for java.lang Long MIN_VALUE.
Click Source Link
From source file:com.google.uzaygezen.core.BitVectorTest.java
private void checkCopyFromLongArray(Function<Integer, BitVector> factory) { BitVector v = factory.apply(128);/*from w ww . j a v a2 s.co m*/ long[] longArray = new long[2]; for (long i = Long.MIN_VALUE; --i >= Long.MAX_VALUE - 80;) { longArray[0] = i; for (long j = Long.MIN_VALUE; ++j <= Long.MIN_VALUE + 80;) { longArray[1] = j; v.copyFrom(longArray); Assert.assertArrayEquals(longArray, v.toLongArray()); } } }
From source file:net.firejack.platform.core.store.process.TaskStore.java
@Override @Transactional// www.j av a2 s . co m public TaskModel rollback(Long taskId, Long assigneeId, Long explanationId, String noteText, String taskDescription, Long activityId) throws NoPreviousActivityException, TaskNotActiveException, UserNotInActorSetException { Date currentDateTime = new Date(); Long currentUserId = ContextManager.getUserInfoProvider().getId(); UserModel currentUser = userStore.findById(currentUserId); TaskModel taskModel = findById(taskId); if (!taskModel.getActive()) { throw new TaskNotActiveException(); } if (!actorStore.isUserInActorSet(currentUserId, taskModel.getActivity().getActor().getId())) { throw new UserNotInActorSetException("Current user (ID: " + currentUserId + ") is not in the actor list for the taskModel (ID: " + taskId + ")."); } CaseModel processCase = taskModel.getCase(); int previousActivityOrderPosition = taskModel.getActivity().getSortPosition() - 1; ActivityModel previousActivity = null; List<ActivityModel> activities = processCase.getProcess().getActivities(); for (ActivityModel activity : activities) { /*if (activity.getSortPosition() > previousActivityOrderPosition) { break; } if (!activity.getActivityType().equals(ActivityType.SYSTEM)) { previousActivity = activity; }*/ if (activity.getId().equals(activityId) && activity.getSortPosition() < taskModel.getActivity().getSortPosition()) { previousActivity = activity; } } if (previousActivity == null) { throw new NoPreviousActivityException(); } UserModel assignee = null; if (assigneeId != null) { if (!actorStore.isUserInActorSet(assigneeId, previousActivity.getActor().getId())) { throw new UserNotInActorSetException("Selected next assignee (ID: " + assigneeId + ") is not in the actor list for the activity (ID: " + previousActivity.getId() + ")."); } assignee = userStore.findById(assigneeId); } else { List<TaskModel> taskModels = previousActivity.getTaskModels(); Long maxClosingDate = Long.MIN_VALUE; for (TaskModel t : taskModels) { if (t.getCase().getId().equals(processCase.getId())) { if (t.getCloseDate() != null && t.getCloseDate().getTime() > maxClosingDate) { assignee = t.getAssignee(); maxClosingDate = t.getCloseDate().getTime(); } } } } taskModel.setActive(false); taskModel.setCloseDate(currentDateTime); taskModel.setUpdateDate(currentDateTime); saveOrUpdate(taskModel); TaskModel previousTaskModel = new TaskModel(); if (StringUtils.isBlank(taskDescription)) { previousTaskModel.setDescription(processCase.getDescription()); } else { previousTaskModel.setDescription(taskDescription); } previousTaskModel.setActive(true); previousTaskModel.setActivity(previousActivity); previousTaskModel.setCase(processCase); previousTaskModel.setUpdateDate(currentDateTime); previousTaskModel.setAssignee(assignee); saveOrUpdate(previousTaskModel); processCase.setAssignee(assignee); processCase.setStatus(previousActivity.getStatus()); caseStore.saveOrUpdate(processCase); CaseActionModel caseAction = new CaseActionModel(); caseAction.setCase(processCase); caseAction.setTaskModel(previousTaskModel); caseAction.setUser(currentUser); caseAction.setPerformedOn(currentDateTime); caseAction.setType(CaseActionType.PREVIOUS_ACTIVITY); if (explanationId != null) { caseAction.setCaseExplanation(caseExplanationStore.findById(explanationId)); } if (!StringUtils.isEmpty(noteText)) { CaseNoteModel caseNote = new CaseNoteModel(); caseNote.setProcessCase(processCase); caseNote.setTaskModel(previousTaskModel); caseNote.setText(noteText); caseNote.setUser(currentUser); caseNoteStore.saveOrUpdate(caseNote); caseAction.setCaseNote(caseNote); } caseActionStore.saveOrUpdate(caseAction); return previousTaskModel; }
From source file:com.aol.framework.helper.report.CustomizedReporter.java
synchronized private void generateModuleTestMethodSummary(String testName, String modulename, List<ISuite> suites, String fileName, ArrayList<ITestNGMethod> testngMethods, String nodeIp) throws IOException { final PrintWriter pw = TestHelper.createFileWriter(TestHelper.customReportDir + fileName); startHtmlPage(pw);// ww w . j a va 2 s .c o m String htmlFile = testName + "-customized-report.html"; String modulewiseTestFileName = testName + "-" + modulename + "-customized-report.html"; pw.println("<button class=\"sexybutton sexysimple sexylarge sexyblack\" onClick=\"location.href='" + htmlFile + "'\"><span class=\"prev\">Back to Modulewise Execution Summary</span></button>"); pw.println("<br/><br/><br/><fieldset><legend><b>Details</b></legend><br/>" + "<table class=\"details\" cellspacing=0 cellpadding=0><tr><td><b>Test Name: </b></td><td>" + testName + "</td></tr>"); pw.println("<tr><td><b>Module Name: </b></td><td>" + modulename + "</td></tr>"); pw.println("<tr><td><b>Node IP: </b></td><td>" + nodeIp + "</td></tr></table></fieldset><br/><br/>"); pw.println("<table id=\"myTable\" width=\"100%\" cellspacing=0 cellpadding=0 class=\"tablesorter\">"); pw.println("<thead><tr><th style=\"text-align:left\">Method Name</th>" + "<th>Total Time (ms)</th>" + "<th>Status</th>" + "<th style=\"text-align:center\">Stack Trace | Test Parameters</th></tr></thead>"); for (ISuite suite : suites) { Map<String, ISuiteResult> tests = suite.getResults(); for (ISuiteResult re : tests.values()) { ITestContext overview = re.getTestContext(); if ((overview.getName()).equalsIgnoreCase(testName)) { Iterator<ITestNGMethod> it = testngMethods.iterator(); while (it.hasNext()) { ITestNGMethod method = it.next(); String[] allGroups = method.getGroups(); String methodName = ""; //String className = ""; for (String grp : allGroups) { if (grp.equalsIgnoreCase(modulename)) { methodName = method.getMethodName(); //className = method.getTestClass().getName(); ArrayList<Set<ITestResult>> statusResult = new ArrayList<Set<ITestResult>>(); Set<ITestResult> failedTestAutomationStatus = overview .getFailedButWithinSuccessPercentageTests().getResults(method); if (!(failedTestAutomationStatus.isEmpty())) { statusResult.add(setTestStatus(failedTestAutomationStatus, ITestResult.SUCCESS_PERCENTAGE_FAILURE)); } //TODO -- these 2 sets are somehow missing from the report, not sure they are attached // with @test method or @BeforeMethod, so could be commented out if they are always empty Set<ITestResult> confFailedTestStatus = overview.getFailedConfigurations() .getResults(method); if (!(confFailedTestStatus.isEmpty())) { statusResult.add(setTestStatus(confFailedTestStatus, ITestResult.SUCCESS_PERCENTAGE_FAILURE)); } Set<ITestResult> confSkippedTestStatus = overview.getSkippedConfigurations() .getResults(method); if (!(confSkippedTestStatus.isEmpty())) { statusResult.add(setTestStatus(confSkippedTestStatus, ITestResult.SKIP)); } // *************************************************************************************************** Set<ITestResult> skippedTestStatus = overview.getSkippedTests().getResults(method); if (!(skippedTestStatus.isEmpty())) { statusResult.add(setTestStatus(skippedTestStatus, ITestResult.SKIP)); } Set<ITestResult> passedTestStatus = overview.getPassedTests().getResults(method); if (!(passedTestStatus.isEmpty())) { statusResult.add(setTestStatus(passedTestStatus, ITestResult.SUCCESS)); } Set<ITestResult> failedTestStatus = overview.getFailedTests().getResults(method); if (!(failedTestStatus.isEmpty())) { statusResult.add(setTestStatus(failedTestStatus, ITestResult.FAILURE)); } if (methodName == null || methodName.trim() == "") { methodName = " Empty ?"; } // ________________________________________________________ String test_tag = ""; pw.print("<tr><td style=\"text-align:left\" colspan=\"3\"><b>" + methodName.toUpperCase() + "</b>"); pw.println("" + "</td>" + "<td bgcolor=\"white\" style=\"border: 0px;\"></td>" + "</tr>"); Iterator<Set<ITestResult>> statusIterator = statusResult.iterator(); while (statusIterator.hasNext()) { Set<ITestResult> status = statusIterator.next(); StringBuilder stackTrace; StringBuilder failedConf; Iterator<ITestResult> it2 = status.iterator(); List<String> msgs = new ArrayList<String>(); String executionStatus = ""; long time_start = Long.MAX_VALUE; long time_end = Long.MIN_VALUE; Throwable exception = null; String screenshotFileLink = ""; String currentTestUrl = ""; String jsError = ""; ITestResult result = null; while (it2.hasNext()) { // pw.println("<tr><td style=\"text-align:left\"><b>" // + methodName.toUpperCase() + "</b></td>"); stackTrace = new StringBuilder(); failedConf = new StringBuilder(); result = it2.next(); time_start = result.getStartMillis(); time_end = result.getEndMillis(); Object[] params = result.getParameters(); // // if(test_tag.equals("")){ // test_tag = getTestTag(params); // if(status.size()==1){ // pw.println( " ["+test_tag+"]" // +"</td>" // + "<td bgcolor=\"white\" style=\"border: 0px;\"></td>" // + "</tr>"); // }else { // pw.println( "" // +"</td>" // + "<td bgcolor=\"white\" style=\"border: 0px;\"></td>" // + "</tr>"); // } // } // String test_para = getTestPara(params,status.size()>1?0:1); String test_para = getTestPara(params, 0); int execStatus = result.getStatus(); if (execStatus == ITestResult.SUCCESS) { executionStatus = "PASS"; } else if (execStatus == ITestResult.FAILURE) { executionStatus = "FAIL"; } else if (execStatus == ITestResult.SKIP) { executionStatus = "SKIP"; } else if (execStatus == ITestResult.SUCCESS_PERCENTAGE_FAILURE) { executionStatus = "WARN"; } // if (execStatus == ITestResult.SKIP) // { // status = overview.getFailedConfigurations().getAllResults(); // it2 = status.iterator(); // failedConf.append("<br/>"); // while (it2.hasNext()) // { // result = it2.next(); // failedConf.append("<b>Failed Configuration - " // + result.getMethod().getMethodName() + "</b>"); // failedConf.append("<br/>"); // } // // status = overview.getSkippedConfigurations().getAllResults(); // it2 = status.iterator(); // failedConf.append("<br/>"); // while (it2.hasNext()) // { // result = it2.next(); // failedConf.append("<b>Skipped Configuration - " // + result.getMethod().getMethodName() + "</b>"); // failedConf.append("<br/>"); // } // exception = result.getThrowable(); // } else { exception = result.getThrowable(); if (exception == null) { if (execStatus == ITestResult.SKIP) { status = overview.getFailedConfigurations().getAllResults(); it2 = status.iterator(); failedConf.append("<br/>"); while (it2.hasNext()) { result = it2.next(); failedConf.append("<b>Failed Configuration - " + result.getMethod().getMethodName() + "</b>"); failedConf.append("<br/>"); } status = overview.getSkippedConfigurations().getAllResults(); it2 = status.iterator(); failedConf.append("<br/>"); while (it2.hasNext()) { result = it2.next(); failedConf.append("<b>Skipped Configuration - " + result.getMethod().getMethodName() + "</b>"); failedConf.append("<br/>"); } exception = result.getThrowable(); } } } msgs = Reporter.getOutput(result); /* * If enable logs is false, then only * take the screenshot. */ if (//(TestHelper.getTestConfig("ENABLE_LOGS_IN_CUSTOM_REPORT").equalsIgnoreCase("false")) && (msgs != null)) { for (String line : msgs) { if (line.contains(TestHelper.jsErrorMarkerInOutputFile)) { jsError = line.substring(line .indexOf(TestHelper.jsErrorMarkerInOutputFile) + (TestHelper.jsErrorMarkerInOutputFile.length()), line.length()).trim(); } if (line.contains(TestHelper.testUrlMarkerInOutputFile)) { currentTestUrl = line.substring(line .indexOf(TestHelper.testUrlMarkerInOutputFile) + (TestHelper.testUrlMarkerInOutputFile.length()), line.length()); } if (line.contains(TestHelper.testScreenshotMarkerInOutputFile)) { screenshotFileLink = line.substring(line .indexOf(TestHelper.testScreenshotMarkerInOutputFile) + (TestHelper.testScreenshotMarkerInOutputFile .length()), line.length()); break; } } } /* * If enable logs is true, take the * whole log along with screenshot. */ if ((TestHelper.getTestConfig("ENABLE_LOGS_IN_CUSTOM_REPORT") .equalsIgnoreCase("true")) && (msgs != null)) { // if(currentTestUrl!=null && currentTestUrl.trim().length()!=0){ // stackTrace // .append("<br/><a target=\"_blank\" href=\"" // + currentTestUrl // + "\"><u><b>URL</b></u> - " // + currentTestUrl // + "</a>"); // } for (String line : msgs) { stackTrace.append("<br/>" + line); } } else if (screenshotFileLink != null && screenshotFileLink.trim().length() != 0) { stackTrace.append( "<br/><div id=\"screenshot-div\" style=\"cursor:pointer;color:blue;\"><u><b>Enlarge Screenshot</b></u> - " + currentTestUrl + "</div><br/>" // +(jsError.equals("")?jsError:"<b>JS Error:</b>"+jsError+"<br/>") + "<a target=\"_blank\" href=\"" + screenshotFileLink + "\"><b>View Screenshot in New Window/Tab</b></a><br/><br/><img id=\"screenshot\" src='" + screenshotFileLink + "' height='300' width='300' border=\"1\" style=\"position: relative; left: 0px;\"/>" + (jsError.equals("") ? jsError : "<br/><br/><b>JS Error:</b><br/>" + jsError + "<br/>")); } if (msgs != null) { msgs.clear(); } Random randomGenerator = new Random(); int randomInt = randomGenerator.nextInt(100000); String stackTraceFile = testName + "-" + modulename + "-" + methodName + "-" + randomInt + "-" + "custom-report.html"; stackTrace.append("<br/>" + failedConf.toString()); generateStackTraceReport(modulewiseTestFileName, stackTraceFile, stackTrace, exception, method, nodeIp, result); String link = "<button class=\"sexybutton sexysimple sexyblack\" onClick=\"location.href='" + stackTraceFile + "'\"><span class=\"info\">" + "View StackTrace/Screenshots" + "</span></button>"; if (executionStatus.equalsIgnoreCase("pass")) { executionStatus = "<td bgcolor=\"" + passColor + "\"><font color=\"white\"><b>" + executionStatus + "</b></font></td>"; } else if (executionStatus.equalsIgnoreCase("fail")) { executionStatus = "<td bgcolor=\"" + failColor + "\"><font color=\"white\"><b>" + executionStatus + "</b></font></td>"; } else if (executionStatus.equalsIgnoreCase("warn")) { executionStatus = "<td bgcolor=\"" + warnColor + "\"><font color=\"white\"><b>" + executionStatus + "</b></font></td>"; } else if (executionStatus.equalsIgnoreCase("skip")) { executionStatus = "<td bgcolor=\"" + skipColor + "\"><font color=\"white\"><b>" + executionStatus + "</b></font></td>"; } else { executionStatus = "<td>" + executionStatus + "</td>"; } pw.println(//"<tr><td style=\"text-align:left\">" + "[Class Name] " + className "<tr><td style=\"text-align:left\">" + "[Test Params] " + test_para + "</td><td>" + (time_end - time_start) + "</td>" + executionStatus + "<td bgcolor=\"white\" style=\"text-align:center;border: 0px;\">" + link + "</td></tr>"); pw.flush(); } } } } } } } } pw.println("</table>"); endHtmlPage(pw); pw.flush(); pw.close(); }
From source file:com.google.sample.castcompanionlibrary.cast.BaseCastManager.java
/** * Clears the persisted connection information. Bitwise OR combination of the following options * should be passed as the argument:/* w w w . j av a 2 s . c om*/ * <ul> * <li>CLEAR_SESSION</li> * <li>CLEAR_ROUTE</li> * <li>CLEAR_WIFI</li> * <li>CLEAR_MEDIA_END</li> * <li>CLEAR_ALL</li> * </ul> * Clients can form an or */ public final void clearPersistedConnectionInfo(int what) { LOGD(TAG, "clearPersistedConnectionInfo(): Clearing persisted data for " + what); if (what == CLEAR_ALL || (what & CLEAR_SESSION) > 0) { Utils.saveStringToPreference(mContext, PREFS_KEY_SESSION_ID, null); } if (what == CLEAR_ALL || (what & CLEAR_ROUTE) > 0) { Utils.saveStringToPreference(mContext, PREFS_KEY_ROUTE_ID, null); } if (what == CLEAR_ALL || (what & CLEAR_WIFI) > 0) { Utils.saveStringToPreference(mContext, PREFS_KEY_SSID, null); } if (what == CLEAR_ALL || (what & CLEAR_MEDIA_END) > 0) { Utils.saveLongToPreference(mContext, PREFS_KEY_MEDIA_END, Long.MIN_VALUE); } }
From source file:net.firejack.platform.core.store.process.TaskStore.java
/** * @param taskId - ID of the task to be performed * @param assigneeId - ID of the user to be assigned to the previous task * @param explanationId - ID of the explanation * @param noteText - text of the note/*from ww w . jav a2s . c o m*/ * @param taskDescription - description of the task * @param checkCurrentActorSet check if current user is in actor set * @return previous task * @throws NoPreviousActivityException * @throws TaskNotActiveException * @throws UserNotInActorSetException * @see ITaskStore#rollback(Long, Long, Long, String, String, boolean) */ @Override @Transactional public TaskModel rollback(Long taskId, Long assigneeId, Long explanationId, String noteText, String taskDescription, boolean checkCurrentActorSet) throws NoPreviousActivityException, TaskNotActiveException, UserNotInActorSetException { Date currentDateTime = new Date(); Long currentUserId = ContextManager.getUserInfoProvider().getId(); UserModel currentUser = userStore.findById(currentUserId); TaskModel taskModel = findById(taskId); if (!taskModel.getActive()) { throw new TaskNotActiveException(); } if (checkCurrentActorSet) { if (!actorStore.isUserInActorSet(currentUserId, taskModel.getActivity().getActor().getId())) { throw new UserNotInActorSetException("Current user (ID: " + currentUserId + ") is not in the actor list for the taskModel (ID: " + taskId + ")."); } } CaseModel processCase = taskModel.getCase(); int previousActivityOrderPosition = taskModel.getActivity().getSortPosition() - 1; ActivityModel previousActivity = null; List<ActivityModel> activities = processCase.getProcess().getActivities(); for (ActivityModel activity : activities) { if (activity.getSortPosition() > previousActivityOrderPosition) { break; } if (!activity.getActivityType().equals(ActivityType.SYSTEM)) { previousActivity = activity; } } if (previousActivity == null) { throw new NoPreviousActivityException(); } UserModel assignee = null; if (assigneeId != null) { if (!actorStore.isUserInActorSet(assigneeId, previousActivity.getActor().getId())) { throw new UserNotInActorSetException("Selected next assignee (ID: " + assigneeId + ") is not in the actor list for the activity (ID: " + previousActivity.getId() + ")."); } assignee = userStore.findById(assigneeId); } else { List<TaskModel> taskModels = previousActivity.getTaskModels(); Long maxClosingDate = Long.MIN_VALUE; for (TaskModel t : taskModels) { if (t.getCase().getId().equals(processCase.getId())) { if (t.getCloseDate() != null && t.getCloseDate().getTime() > maxClosingDate) { assignee = t.getAssignee(); maxClosingDate = t.getCloseDate().getTime(); } } } } taskModel.setActive(false); taskModel.setCloseDate(currentDateTime); taskModel.setUpdateDate(currentDateTime); saveOrUpdate(taskModel); TaskModel previousTaskModel = new TaskModel(); if (taskDescription != null) { previousTaskModel.setDescription(taskDescription); } else { previousTaskModel.setDescription(processCase.getDescription()); } previousTaskModel.setActive(true); previousTaskModel.setActivity(previousActivity); previousTaskModel.setCase(processCase); previousTaskModel.setUpdateDate(currentDateTime); previousTaskModel.setAssignee(assignee); saveOrUpdate(previousTaskModel); processCase.setAssignee(assignee); processCase.setStatus(previousActivity.getStatus()); caseStore.saveOrUpdate(processCase); CaseActionModel caseAction = new CaseActionModel(); caseAction.setCase(processCase); caseAction.setTaskModel(previousTaskModel); caseAction.setUser(currentUser); caseAction.setPerformedOn(currentDateTime); caseAction.setType(CaseActionType.PREVIOUS_ACTIVITY); if (explanationId != null) { caseAction.setCaseExplanation(caseExplanationStore.findById(explanationId)); } if (!StringUtils.isEmpty(noteText)) { CaseNoteModel caseNote = new CaseNoteModel(); caseNote.setProcessCase(processCase); caseNote.setTaskModel(previousTaskModel); caseNote.setText(noteText); caseNote.setUser(currentUser); caseNoteStore.saveOrUpdate(caseNote); caseAction.setCaseNote(caseNote); } caseActionStore.saveOrUpdate(caseAction); return previousTaskModel; }
From source file:gov.va.isaac.util.OTFUtility.java
public static ConceptAttributeVersionBI<?> getLatestAttributes( @SuppressWarnings("rawtypes") Collection<? extends ConceptAttributeVersionBI> collection) { ConceptAttributeVersionBI<?> newest = null; long newestTime = Long.MIN_VALUE; for (ConceptAttributeVersionBI<?> x : collection) { if (x.getTime() > newestTime) { newest = x;// w w w . j a va2s . com newestTime = x.getTime(); } } return newest; }
From source file:com.couchbase.client.java.SubDocumentTest.java
@Test public void testCounterWithLongMinValueDeltaSucceedsOnNewCounter() { long expected = Long.MIN_VALUE + 1L; final String path = "newCounter"; DocumentFragment<Mutation> result = ctx.bucket().mutateIn(key).counter(path, expected).execute(); assertThat(result.content(path), instanceOf(Long.class)); assertEquals(expected, result.content(path, Long.class).longValue()); assertEquals(expected, result.content(0, Long.class).longValue()); assertEquals(expected, ctx.bucket().get(key).content().getLong(path).longValue()); }
From source file:gov.va.isaac.util.OTFUtility.java
public static DescriptionVersionBI<?> getLatestDescVersion( @SuppressWarnings("rawtypes") Collection<? extends DescriptionVersionBI> collection) { DescriptionVersionBI<?> newest = null; long newestTime = Long.MIN_VALUE; for (DescriptionVersionBI<?> x : collection) { if (x.getTime() > newestTime) { newest = x;/*from w w w.j av a 2s . c o m*/ newestTime = x.getTime(); } } return newest; }
From source file:net.pms.util.Rational.java
/** * * Converts this {@link Rational} to a {@code long}. This conversion is * analogous to the <i>narrowing primitive conversion</i> from * {@code double} to {@code long} as defined in section 5.1.3 of <cite>The * Java™ Language Specification</cite>: any fractional part of this * {@link Rational} will be discarded, and if the resulting " * {@link BigInteger}" is too big to fit in a {@code long}, only the * low-order 64 bits are returned.// w w w. j a v a2 s . c o m * <p> * Note that this conversion can lose information about the overall * magnitude and precision of this {@link Rational} value as well as return * a result with the opposite sign. * * @return This {@link Rational} converted to a {@code long}. */ @Override public long longValue() { if (isNaN()) { return 0; } if (isInfinite()) { return numerator.signum() > 0 ? Long.MAX_VALUE : Long.MIN_VALUE; } return new BigDecimal(reducedNumerator).divide(new BigDecimal(reducedDenominator), RoundingMode.DOWN) .longValue(); }