List of usage examples for java.util Map equals
boolean equals(Object o);
From source file:com.ebuddy.cassandra.structure.DecomposerTest.java
@Test(groups = "unit") public void decomposeNestedStructureWithLongerPath() throws Exception { Map<Path, Object> structures = new HashMap<Path, Object>(); Map<String, Object> nestedMap = new HashMap<String, Object>(); nestedMap.put("y", "test"); nestedMap.put("@##//", "special@#"); structures.put(DefaultPath.fromEncodedPathString("a/b/c"), nestedMap); // map keys are URL-encoded, values are not Map<Path, Object> expected = new HashMap<Path, Object>(); expected.put(DefaultPath.fromEncodedPathString("a/b/c/y"), "test"); expected.put(DefaultPath.fromEncodedPathString("a/b/c/%40%23%23%2F%2F"), "special@#"); Map<Path, Object> result = decomposer.decompose(structures); assertTrue(result.equals(expected)); }
From source file:org.xdi.oxauth.service.RedirectionUriService.java
private boolean compareParams(String uri1, String uri2) { if (StringUtils.isBlank(uri1) || StringUtils.isBlank(uri2)) { return false; }//from w ww.j av a 2 s. co m Map<String, String> params1 = getParams(uri1); Map<String, String> params2 = getParams(uri2); return params1.equals(params2); }
From source file:tectonicus.BlockVariantTests.java
@Test public void createSingleStateMap() { BlockVariant bv = new BlockVariant("normal", null); Map<String, String> states = bv.getStates(); Map<Object, Object> testStates = new HashMap<>(); testStates.put("normal", ""); assertTrue(states.equals(testStates)); }
From source file:org.flite.cach3.test.ReadThroughMultiCacheTest.java
@Test public void testMemcached() { final MemcachedClientIF cache = ((Cach3State) context.getBean("cach3-state")).getMemcachedClient(); final List<String> keys = new ArrayList<String>(); final Map<String, String> answerMap = new HashMap<String, String>(); final Long now = System.currentTimeMillis(); final String alphabet = "abcdefghijklmnopqrstuvwxyz"; for (int ix = 0; ix < 5; ix++) { final String key = alphabet.charAt(ix) + now.toString(); final String value = alphabet.toUpperCase().charAt(ix) + "00000"; cache.set(key, 30, value);/*w w w .j ava 2s . c om*/ keys.add(key); answerMap.put(key, value); } final Map<String, Object> memcachedSez = cache.getBulk(keys); assertTrue(memcachedSez.equals(answerMap)); }
From source file:org.phenotips.mendelianSearch.internal.DefaultPatientViewFactory.java
private String getPatientGeneStatus(Patient patient, String geneSymbol) { PatientData<Map<String, String>> allGenes = patient.getData("genes"); if (allGenes != null && allGenes.isIndexed()) { for (Map<String, String> gene : allGenes) { String geneName = gene.get("gene"); if (StringUtils.isBlank(geneName) || !gene.equals(geneSymbol)) { continue; }/*from ww w .ja v a 2s .c om*/ return gene.get("status"); } } return ""; }
From source file:de.innovationgate.utils.DirComparer.java
/** * Compares to files/folders for equality * @param file1//from w w w .ja va 2 s . c o m * @param file2 * @return True if contained files and their contents are equal. False if not * @throws NoSuchAlgorithmException * @throws IOException */ public boolean areEqual(FileObject file1, FileObject file2) throws NoSuchAlgorithmException, IOException { Map<String, String> map1 = readFileHashes(file1); Map<String, String> map2 = readFileHashes(file2); return map1.equals(map2); }
From source file:org.apache.fluo.recipes.core.export.it.ExportTestBase.java
public void assertEquals(Map<String, Set<String>> expected, Map<String, Set<String>> actual, FluoClient fc) { if (!expected.equals(actual)) { System.out.println("*** diff ***"); diff(expected, actual);/*from w w w . j a v a 2 s . c o m*/ System.out.println("*** fluo dump ***"); dump(fc); System.out.println("*** map dump ***"); Assert.fail(); } }
From source file:com.github.jrrdev.mantisbtsync.core.jobs.issues.tasklets.IssuesLastRunExtractorTasklet.java
/** * {@inheritDoc}// w ww .jav a 2 s.c o m * @see org.springframework.batch.core.step.tasklet.Tasklet#execute(org.springframework.batch.core.StepContribution, org.springframework.batch.core.scope.context.ChunkContext) */ @Override public RepeatStatus execute(final StepContribution contribution, final ChunkContext chunkContext) throws Exception { final StepContext stepContext = chunkContext.getStepContext(); final String jobName = stepContext.getJobName(); final JobParameters jobParams = stepContext.getStepExecution().getJobParameters(); final Map<String, JobParameter> currParams = new HashMap<String, JobParameter>(jobParams.getParameters()); currParams.remove("run.id"); Date lastJobRun = null; final List<JobInstance> jobInstances = jobExplorer.getJobInstances(jobName, 0, 1000); for (final JobInstance jobInstance : jobInstances) { final List<JobExecution> jobExecutions = jobExplorer.getJobExecutions(jobInstance); for (final JobExecution jobExecution : jobExecutions) { final JobParameters oldJobParams = jobExecution.getJobParameters(); final Map<String, JobParameter> oldParams = new HashMap<String, JobParameter>( oldJobParams.getParameters()); oldParams.remove("run.id"); if (ExitStatus.COMPLETED.equals(jobExecution.getExitStatus()) && oldParams.equals(currParams)) { if (lastJobRun == null || lastJobRun.before(jobExecution.getStartTime())) { lastJobRun = jobExecution.getStartTime(); } } } } if (lastJobRun != null) { stepContext.getStepExecution().getExecutionContext().put("mantis.update.last_job_run", lastJobRun); } stepContext.getStepExecution().getExecutionContext().put("mantis.update.current_job_run", Calendar.getInstance()); return RepeatStatus.FINISHED; }
From source file:eu.sonata.nfv.nec.convert.BasicConverterTest.java
@Test public void convertYamlToJson() { String convertedJsonString = conversionService.convertToJson(yamlString); Map<String, Object> mapOriginal = conversionService.convertToMap(yamlString); Map<String, Object> mapConverted = conversionService.convertToMap(convertedJsonString); assertTrue("The maps should be equal. ", mapOriginal.equals(mapConverted)); }
From source file:eu.sonata.nfv.nec.convert.BasicConverterTest.java
@Test public void convertJsonToJson() { String convertedJsonString = conversionService.convertToJson(jsonString); Map<String, Object> mapOriginal = conversionService.convertToMap(jsonString); Map<String, Object> mapConverted = conversionService.convertToMap(convertedJsonString); assertTrue("The maps should be equal. ", mapOriginal.equals(mapConverted)); }