List of usage examples for java.util List equals
boolean equals(Object o);
From source file:com.hybris.instore.widgets.listtracker.ListTrackerControllerTest.java
@Test public void testSetList() { final List<Integer> testList = initTestList(); controller.setList(testList);/* w ww . ja va 2 s . c o m*/ final List<Integer> tempList = controller.getValue(ListTrackerController.MODEL_LIST, List.class); Assert.assertTrue(testList.equals(tempList)); }
From source file:fi.jumi.test.AppRunner.java
public RunId findRun(String... startAndEndEvents) { List<String> expectedEvents = Arrays.asList(startAndEndEvents); for (RunId runId : ui.getRunIds()) { List<String> actualEvents = ui.getTestStartAndEndEvents(runId); if (actualEvents.equals(expectedEvents)) { return runId; }/*from w ww . j a va 2 s . c o m*/ } return null; }
From source file:org.apache.hadoop.hbase.master.balancer.FavoredNodesPlan.java
@Override public boolean equals(Object o) { if (this == o) { return true; }/*from w ww. j a v a2s . c o m*/ if (o == null) { return false; } if (getClass() != o.getClass()) { return false; } // To compare the map from objec o is identical to current assignment map. Map<HRegionInfo, List<ServerName>> comparedMap = ((FavoredNodesPlan) o).getAssignmentMap(); // compare the size if (comparedMap.size() != this.favoredNodesMap.size()) return false; // compare each element in the assignment map for (Map.Entry<HRegionInfo, List<ServerName>> entry : comparedMap.entrySet()) { List<ServerName> serverList = this.favoredNodesMap.get(entry.getKey()); if (serverList == null && entry.getValue() != null) { return false; } else if (serverList != null && !serverList.equals(entry.getValue())) { return false; } } return true; }
From source file:org.apache.hadoop.hive.ql.parse.SamplePruner.java
@SuppressWarnings("nls") public Path[] prune(Partition part) throws SemanticException { int num = this.tableSample.getNumerator(); int den = this.tableSample.getDenominator(); int bucketCount = part.getBucketCount(); List<String> tabBucketCols = part.getBucketCols(); ArrayList<String> sampleCols = this.tableSample.getCols(); String fullScanMsg = ""; // check if input pruning is possible if (sampleCols == null || sampleCols.size() == 0 || tabBucketCols.equals(sampleCols)) { LOG.trace("numerator = " + num); LOG.trace("denominator = " + den); LOG.trace("bucket count = " + bucketCount); if (bucketCount == den) { Path[] ret = new Path[1]; ret[0] = part.getBucketPath(num - 1); return (ret); } else if (bucketCount > den && bucketCount % den == 0) { int numPathsInSample = bucketCount / den; Path[] ret = new Path[numPathsInSample]; for (int i = 0; i < numPathsInSample; i++) { ret[i] = part.getBucketPath(i * den + num - 1); }// w w w. j ava 2 s .c o m return ret; } else if (bucketCount < den && den % bucketCount == 0) { Path[] ret = new Path[1]; ret[0] = part.getBucketPath((num - 1) % bucketCount); return ret; } else { // need to do full scan fullScanMsg = "Tablesample denominator " + den + " is not multiple/divisor of bucket count " + bucketCount + " of table " + this.tabAlias; } } else { // need to do full scan fullScanMsg = "Tablesample not on clustered columns"; } LOG.warn(fullScanMsg + ", using full table scan"); Path[] ret = part.getPath(); return ret; }
From source file:de.uni_koeln.spinfo.maalr.services.editor.TestEditorService.java
@Test public void testModifyOrder() throws Exception { insertSampleEntries();/*from w ww .j a v a 2 s. c om*/ QueryResult result = index.queryExact("Haus", true, true); List<LemmaVersion> old = result.getEntries(); for (int i = 0; i < old.size(); i++) { logger.info("Old Order: " + i + " is " + old.get(i)); } List<LemmaVersion> modified = new ArrayList<LemmaVersion>(); Assert.assertTrue(old.size() > 1); modified.addAll(old); do { Collections.shuffle(modified); } while (modified.equals(old)); for (int i = 0; i < modified.size(); i++) { logger.info("New Order: " + i + " is " + modified.get(i)); } List<LexEntry> updated = backend.updateOrder(true, modified); for (int i = 0; i < updated.size(); i++) { Assert.assertEquals(modified.get(i), updated.get(i).getCurrent()); logger.info("Upd Order: " + i + " is " + updated.get(i).getCurrent()); } }
From source file:org.onosproject.yang.compiler.utils.io.impl.YangFileScannerTest.java
/** * This test case checks for a .java file inside the specified dir. * * @throws IOException when fails to do IO operations *///w w w.jav a 2s. c o m @Test public void checkJavaFileInsideDirTest() throws IOException { String dir = baseDir + separator + "scanner2"; File path = createDirectory(dir); createFile(path, "testScanner.java"); List<String> dirContents = getJavaFiles(path.toString()); List<String> expectedContents = new LinkedList<>(); expectedContents.add(path.getCanonicalPath() + separator + "testScanner.java"); assertThat(true, is(dirContents.equals(expectedContents))); deleteDirectory(path); }
From source file:com.twitter.hraven.TestJsonSerde.java
private void assertFlowDetails(List<Flow> flow1, List<Flow> flow2) { assertNotNull(flow1);/*from w w w.ja v a 2s . c om*/ assertNotNull(flow2); assertEquals(flow1.size(), flow2.size()); assertTrue(flow1.equals(flow2)); for (int i = 0; i < flow1.size(); i++) { assertFlowEquals(flow1.get(i), flow2.get(i)); } }
From source file:com.unister.semweb.drums.file.EnlargeFileTest.java
/** The test data fit into the begin file size and no enlargement takes place. */ @Test//from w ww .j a v a2 s. co m public void noEnlargment() throws Exception { DRUMSParameterSet<TestStorable> globalParameters = new DRUMSParameterSet<TestStorable>(new TestStorable()); globalParameters.INITIAL_FILE_SIZE = HeaderIndexFile.HEADER_SIZE; List<TestStorable> testdata = generateTestdata(10); List<Long> filePositions = writeData(testdata, globalParameters); List<TestStorable> readData = readFile(filePositions, globalParameters); Assert.assertTrue(testdata.equals(readData)); }
From source file:org.apache.eagle.alert.engine.publisher.impl.AlertPublisherImpl.java
@SuppressWarnings("unchecked") @Override/*from w w w.j a v a 2 s. com*/ public synchronized void onPublishChange(List<Publishment> added, List<Publishment> removed, List<Publishment> afterModified, List<Publishment> beforeModified) { if (added == null) { added = new ArrayList<>(); } if (removed == null) { removed = new ArrayList<>(); } if (afterModified == null) { afterModified = new ArrayList<>(); } if (beforeModified == null) { beforeModified = new ArrayList<>(); } if (afterModified.size() != beforeModified.size()) { LOG.warn("beforeModified size != afterModified size"); return; } // copy and swap to avoid concurrency issue Map<String, List<String>> newPolicyPublishPluginMapping = new HashMap<>(policyPublishPluginMapping); Map<String, AlertPublishPlugin> newPublishMap = new HashMap<>(publishPluginMapping); // added for (Publishment publishment : added) { LOG.debug("OnPublishmentChange : add publishment : {} ", publishment); AlertPublishPlugin plugin = AlertPublishPluginsFactory.createNotificationPlugin(publishment, config, conf); if (plugin != null) { newPublishMap.put(publishment.getName(), plugin); addPublishmentPolicies(newPolicyPublishPluginMapping, publishment.getPolicyIds(), publishment.getName()); } else { LOG.error("OnPublishChange alertPublisher {} failed due to invalid format", publishment); } } //removed List<AlertPublishPlugin> toBeClosed = new ArrayList<>(); for (Publishment publishment : removed) { String pubName = publishment.getName(); removePublihsPolicies(newPolicyPublishPluginMapping, publishment.getPolicyIds(), pubName); toBeClosed.add(newPublishMap.get(pubName)); newPublishMap.remove(publishment.getName()); } // updated for (int i = 0; i < afterModified.size(); i++) { String pubName = afterModified.get(i).getName(); List<String> newPolicies = afterModified.get(i).getPolicyIds(); List<String> oldPolicies = beforeModified.get(i).getPolicyIds(); if (!newPolicies.equals(oldPolicies)) { List<String> deletedPolicies = ListUtils.subtract(oldPolicies, newPolicies); removePublihsPolicies(newPolicyPublishPluginMapping, deletedPolicies, pubName); List<String> addedPolicies = ListUtils.subtract(newPolicies, oldPolicies); addPublishmentPolicies(newPolicyPublishPluginMapping, addedPolicies, pubName); } Publishment newPub = afterModified.get(i); newPublishMap.get(pubName).update(newPub.getDedupIntervalMin(), newPub.getProperties()); } // now do the swap publishPluginMapping = newPublishMap; policyPublishPluginMapping = newPolicyPublishPluginMapping; // safely close : it depend on plugin to check if want to wait all data to be flushed. closePlugins(toBeClosed); }
From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.generic.GenericDRInputController.java
@Override protected void addToDRAnalysis() { List<DoseResponsePair> selectedConditions = getSelectedConditions(); if (selectedConditions != null && !selectedConditions.equals(conditionsList)) { for (DoseResponsePair selectedCondition : selectedConditions) { //only add to list if list does not contain this condition already if (!conditionsList.contains(selectedCondition)) { conditionsList.add(selectedCondition); }/*from w ww . ja v a 2 s . c o m*/ } // make a new analysis group // override variable if one existed already doseResponseController.setdRAnalysisGroup(new GenericDoseResponseAnalysisGroup(conditionsList)); doseResponseController.setFirstFitting(true); // populate bottom table with the analysis group slopesTable.setModel(createTableModel(doseResponseController.getdRAnalysisGroup())); slopesTable.getTableHeader().setDefaultRenderer(new TableHeaderRenderer(SwingConstants.LEFT)); } }