private Map<String, String> getJiraIssues() throws IOException { String queryUrl = jiraApiUrl.concat("/search/?jql=").concat(URLEncoder.encode(jiraJql, CharEncoding.UTF_8).replace("+", "%20")); System.out.println("Jira query url: ".concat(queryUrl)); HttpClient client = HttpClientBuilder.create().build(); HttpGet request = new HttpGet(queryUrl); // add request headers for (Map.Entry<String, String> entry : jiraHeaders.entrySet()) { request.addHeader(entry.getKey(), entry.getValue()); } request.addHeader("Content-Type", "application/json"); HttpResponse response = client.execute(request); String searchResp = IOUtils.toString(response.getEntity().getContent()); System.out.println("Jira call response code: " + response.getStatusLine().getStatusCode()); Map<String, String> issueDescriptionMap = new HashedMap<>(); List<Map<String, Object>> issues = JsonPath.read(searchResp, "$.issues[*]"); for (Map<String, Object> issue : issues) { String issueId = (String) issue.get("key"); String description = JsonPath.read(issue.get("fields"), "$.description"); issueDescriptionMap.put(issueId, description); } System.out.println("Issues found: ".concat(issueDescriptionMap.keySet().toString())); return issueDescriptionMap; }
private static String getIssuesLinks(ToolArgs toolArgs, String shortTestName) { if (!testsIssuesMap.containsKey(shortTestName)) { Map<String, String> issuesMap = new HashedMap<>(); for (Map.Entry<String, String> issueDescription : toolArgs.issueDescriptionMap.entrySet()) { if (issueDescription.getValue().contains(shortTestName)) { issuesMap.put(issueDescription.getKey(), toolArgs.jiraUrl.concat("/browse/").concat(issueDescription.getKey())); } } String issuesLinks = ""; for (Map.Entry<String, String> entry : issuesMap.entrySet()) { issuesLinks = issuesLinks.concat("<a href=\"").concat(entry.getValue()).concat("\">").concat(entry.getKey()).concat("</a>, "); } if (!issuesLinks.isEmpty()) { issuesLinks = issuesLinks.substring(0, issuesLinks.lastIndexOf(", ")); } testsIssuesMap.put(shortTestName, issuesLinks); } return testsIssuesMap.get(shortTestName); }
@org.junit.Test(timeout = 1000) public void testIterableMap_add2659() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testIterableMap_add2659"); try { org.apache.commons.collections4.MapUtils.iterableMap(null); org.apache.commons.collections4.MapUtils.iterableMap(null); } catch (final IllegalArgumentException e) { } final HashMap<java.lang.String, java.lang.String> map = new HashMap<java.lang.String, java.lang.String>(); map.put("foo", "foov"); map.put("bar", "barv"); map.put("baz", "bazv"); final IterableMap<java.lang.String, java.lang.String> iMap = org.apache.commons.collections4.MapUtils.iterableMap(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7836,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7837,iMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7838,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7839,iMap); final HashedMap<java.lang.String, java.lang.String> hMap = new HashedMap<java.lang.String, java.lang.String>(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7840,hMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7842,null,7841,org.apache.commons.collections4.MapUtils.iterableMap(hMap)); fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
@org.junit.Test(timeout = 1000) public void testIterableMap_add2660() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testIterableMap_add2660"); try { org.apache.commons.collections4.MapUtils.iterableMap(null); } catch (final IllegalArgumentException e) { } final HashMap<java.lang.String, java.lang.String> map = new HashMap<java.lang.String, java.lang.String>(); map.put("foo", "foov"); map.put("foo", "foov"); map.put("bar", "barv"); map.put("baz", "bazv"); final IterableMap<java.lang.String, java.lang.String> iMap = org.apache.commons.collections4.MapUtils.iterableMap(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7836,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7837,iMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7838,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7839,iMap); final HashedMap<java.lang.String, java.lang.String> hMap = new HashedMap<java.lang.String, java.lang.String>(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7840,hMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7842,null,7841,org.apache.commons.collections4.MapUtils.iterableMap(hMap)); fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
@org.junit.Test(timeout = 1000) public void testIterableMap_add2661() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testIterableMap_add2661"); try { org.apache.commons.collections4.MapUtils.iterableMap(null); } catch (final IllegalArgumentException e) { } final HashMap<java.lang.String, java.lang.String> map = new HashMap<java.lang.String, java.lang.String>(); map.put("foo", "foov"); map.put("bar", "barv"); map.put("bar", "barv"); map.put("baz", "bazv"); final IterableMap<java.lang.String, java.lang.String> iMap = org.apache.commons.collections4.MapUtils.iterableMap(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7836,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7837,iMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7838,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7839,iMap); final HashedMap<java.lang.String, java.lang.String> hMap = new HashedMap<java.lang.String, java.lang.String>(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7840,hMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7842,null,7841,org.apache.commons.collections4.MapUtils.iterableMap(hMap)); fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
@org.junit.Test(timeout = 1000) public void testIterableMap_add2662() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testIterableMap_add2662"); try { org.apache.commons.collections4.MapUtils.iterableMap(null); } catch (final IllegalArgumentException e) { } final HashMap<java.lang.String, java.lang.String> map = new HashMap<java.lang.String, java.lang.String>(); map.put("foo", "foov"); map.put("bar", "barv"); map.put("baz", "bazv"); map.put("baz", "bazv"); final IterableMap<java.lang.String, java.lang.String> iMap = org.apache.commons.collections4.MapUtils.iterableMap(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7836,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7837,iMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7838,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7839,iMap); final HashedMap<java.lang.String, java.lang.String> hMap = new HashedMap<java.lang.String, java.lang.String>(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7840,hMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7842,null,7841,org.apache.commons.collections4.MapUtils.iterableMap(hMap)); fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public void testIterableMap() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testIterableMap"); try { org.apache.commons.collections4.MapUtils.iterableMap(null); } catch (final IllegalArgumentException e) { } final HashMap<java.lang.String, java.lang.String> map = new HashMap<java.lang.String, java.lang.String>(); map.put("foo", "foov"); map.put("bar", "barv"); map.put("baz", "bazv"); final IterableMap<java.lang.String, java.lang.String> iMap = org.apache.commons.collections4.MapUtils.iterableMap(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7836,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7837,iMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7838,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7839,iMap); final HashedMap<java.lang.String, java.lang.String> hMap = new HashedMap<java.lang.String, java.lang.String>(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7840,hMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7842,null,7841,org.apache.commons.collections4.MapUtils.iterableMap(hMap)); fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public void testIterableMap_literalMutation2765() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testIterableMap_literalMutation2765"); try { org.apache.commons.collections4.MapUtils.iterableMap(null); } catch (final IllegalArgumentException e) { } final HashMap<java.lang.String, java.lang.String> map = new HashMap<java.lang.String, java.lang.String>(); map.put("foo", "foo"); map.put("bar", "barv"); map.put("baz", "bazv"); final IterableMap<java.lang.String, java.lang.String> iMap = org.apache.commons.collections4.MapUtils.iterableMap(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7836,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7837,iMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7838,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7839,iMap); final HashedMap<java.lang.String, java.lang.String> hMap = new HashedMap<java.lang.String, java.lang.String>(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7840,hMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7842,null,7841,org.apache.commons.collections4.MapUtils.iterableMap(hMap)); fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public void testIterableMap_literalMutation2766() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testIterableMap_literalMutation2766"); try { org.apache.commons.collections4.MapUtils.iterableMap(null); } catch (final IllegalArgumentException e) { } final HashMap<java.lang.String, java.lang.String> map = new HashMap<java.lang.String, java.lang.String>(); map.put("foo", "foov"); map.put("foo", "barv"); map.put("baz", "bazv"); final IterableMap<java.lang.String, java.lang.String> iMap = org.apache.commons.collections4.MapUtils.iterableMap(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7836,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7837,iMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7838,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7839,iMap); final HashedMap<java.lang.String, java.lang.String> hMap = new HashedMap<java.lang.String, java.lang.String>(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7840,hMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7842,null,7841,org.apache.commons.collections4.MapUtils.iterableMap(hMap)); fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public void testIterableMap_literalMutation2767() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testIterableMap_literalMutation2767"); try { org.apache.commons.collections4.MapUtils.iterableMap(null); } catch (final IllegalArgumentException e) { } final HashMap<java.lang.String, java.lang.String> map = new HashMap<java.lang.String, java.lang.String>(); map.put("foo", "foov"); map.put("bar", "foo"); map.put("baz", "bazv"); final IterableMap<java.lang.String, java.lang.String> iMap = org.apache.commons.collections4.MapUtils.iterableMap(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7836,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7837,iMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7838,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7839,iMap); final HashedMap<java.lang.String, java.lang.String> hMap = new HashedMap<java.lang.String, java.lang.String>(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7840,hMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7842,null,7841,org.apache.commons.collections4.MapUtils.iterableMap(hMap)); fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public void testIterableMap_literalMutation2768() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testIterableMap_literalMutation2768"); try { org.apache.commons.collections4.MapUtils.iterableMap(null); } catch (final IllegalArgumentException e) { } final HashMap<java.lang.String, java.lang.String> map = new HashMap<java.lang.String, java.lang.String>(); map.put("foo", "foov"); map.put("bar", "barv"); map.put("foo", "bazv"); final IterableMap<java.lang.String, java.lang.String> iMap = org.apache.commons.collections4.MapUtils.iterableMap(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7836,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7837,iMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7838,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7839,iMap); final HashedMap<java.lang.String, java.lang.String> hMap = new HashedMap<java.lang.String, java.lang.String>(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7840,hMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7842,null,7841,org.apache.commons.collections4.MapUtils.iterableMap(hMap)); fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public void testIterableMap_literalMutation2769() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testIterableMap_literalMutation2769"); try { org.apache.commons.collections4.MapUtils.iterableMap(null); } catch (final IllegalArgumentException e) { } final HashMap<java.lang.String, java.lang.String> map = new HashMap<java.lang.String, java.lang.String>(); map.put("foo", "foov"); map.put("bar", "barv"); map.put("baz", "foo"); final IterableMap<java.lang.String, java.lang.String> iMap = org.apache.commons.collections4.MapUtils.iterableMap(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7836,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7837,iMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7838,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7839,iMap); final HashedMap<java.lang.String, java.lang.String> hMap = new HashedMap<java.lang.String, java.lang.String>(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7840,hMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7842,null,7841,org.apache.commons.collections4.MapUtils.iterableMap(hMap)); fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
@org.junit.Test(timeout = 1000) public void testIterableMap_remove2104() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testIterableMap_remove2104"); try { org.apache.commons.collections4.MapUtils.iterableMap(null); } catch (final IllegalArgumentException e) { } final HashMap<java.lang.String, java.lang.String> map = new HashMap<java.lang.String, java.lang.String>(); map.put("bar", "barv"); map.put("baz", "bazv"); final IterableMap<java.lang.String, java.lang.String> iMap = org.apache.commons.collections4.MapUtils.iterableMap(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7836,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7837,iMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7838,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7839,iMap); final HashedMap<java.lang.String, java.lang.String> hMap = new HashedMap<java.lang.String, java.lang.String>(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7840,hMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7842,null,7841,org.apache.commons.collections4.MapUtils.iterableMap(hMap)); fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
@org.junit.Test(timeout = 1000) public void testIterableMap_remove2105() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testIterableMap_remove2105"); try { org.apache.commons.collections4.MapUtils.iterableMap(null); } catch (final IllegalArgumentException e) { } final HashMap<java.lang.String, java.lang.String> map = new HashMap<java.lang.String, java.lang.String>(); map.put("bar", "barv"); map.put("baz", "bazv"); final IterableMap<java.lang.String, java.lang.String> iMap = org.apache.commons.collections4.MapUtils.iterableMap(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7836,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7837,iMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7838,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7839,iMap); final HashedMap<java.lang.String, java.lang.String> hMap = new HashedMap<java.lang.String, java.lang.String>(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7840,hMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7842,null,7841,org.apache.commons.collections4.MapUtils.iterableMap(hMap)); fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
@org.junit.Test(timeout = 1000) public void testIterableMap_remove2106() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testIterableMap_remove2106"); try { org.apache.commons.collections4.MapUtils.iterableMap(null); } catch (final IllegalArgumentException e) { } final HashMap<java.lang.String, java.lang.String> map = new HashMap<java.lang.String, java.lang.String>(); map.put("bar", "barv"); map.put("baz", "bazv"); final IterableMap<java.lang.String, java.lang.String> iMap = org.apache.commons.collections4.MapUtils.iterableMap(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7836,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7837,iMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7838,map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7839,iMap); final HashedMap<java.lang.String, java.lang.String> hMap = new HashedMap<java.lang.String, java.lang.String>(map); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7840,hMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7842,null,7841,org.apache.commons.collections4.MapUtils.iterableMap(hMap)); fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
private String findFromWindowsRegistry() { // Map of possible Lotus Notes locations in the Windows registry final Map<String, String> registryKeys = new HashedMap<String, String>(); registryKeys.put("HKEY_LOCAL_MACHINE\\Software\\Lotus\\Notes", "Path"); //$NON-NLS-1$//$NON-NLS-2$ registryKeys.put("HKEY_CURRENT_USER\\Software\\Lotus\\Notes\\Installer", "PROGDIR"); //$NON-NLS-1$ //$NON-NLS-2$ registryKeys.put("HKEY_CURRENT_USER\\Software\\IBM\\Notes\\Installer", "PROGDIR"); //$NON-NLS-1$ //$NON-NLS-2$ final WindowsRegistry windowsRegistry = new WindowsRegistry(new DefaultRegistryQueryProcessFactory()); final Iterator<String> locations = registryKeys.keySet().iterator(); String lotusNotesHome = null; while (lotusNotesHome == null && locations.hasNext()) { final String location = locations.next(); log.warn(TechMessage.get().MSG_CHECKING_REGISTRY_KEY_(location, registryKeys.get(location))); lotusNotesHome = windowsRegistry.readRegistry(location, registryKeys.get(location)); } return lotusNotesHome; }
private Map<String, Object> createClaims(final String username, final String email, long exp ) { return new HashedMap<String, Object>() {{ put("jti","c7df0339-3847-450b-a925-628ef237953a"); put("sub","b6d62259-217b-4e96-8f49-e00c366e4fed"); put("scope","size = 5"); put("client_id", "dummy1"); put("azp","dummy2"); put("grant_type" ,"password"); put("user_id","b6d62259-217b-4e96-8f49-e00c366e4fed"); put("origin","usergrid"); put("user_name", username ); put("email", email); put("rev_sig","dfe5d0d3"); put("exp", exp); put("iat", System.currentTimeMillis()); put("iss", "https://jwt.example.com/token"); put("zid","uaa"); put("aud"," size = 6"); }}; }
@Test public void convertListTest(){ listConverter.setListClass(Attachment.class); Class type = List.class; List value = new ArrayList(); LinkedTreeMap ltm = new LinkedTreeMap(); ltm.put("id","id0001"); ltm.put("url","http://test.com"); ltm.put("filename","filename.txt"); ltm.put("size","10"); ltm.put("type","image/jpeg"); Map<String,Thumbnail> thumbnails = new HashedMap<>(); Thumbnail tmb = new Thumbnail(); tmb.setName("Thumbnail"); tmb.setUrl("http:example.com"); tmb.setWidth(Float.valueOf(10)); tmb.setHeight(Float.valueOf(10)); thumbnails.put("small", tmb); ltm.put("thumbnails",thumbnails); value.add(0, ltm); List<Attachment> list = (List<Attachment>) listConverter.convert(type, value); assertNotNull(list); assertNotNull(list.get(0).getId()); assertNotNull(list.get(0).getFilename()); assertNotNull(list.get(0).getSize()); assertNotNull(list.get(0).getType()); assertNotNull(list.get(0).getUrl()); assertNotNull(list.get(0).getThumbnails()); }
public Map<String, Object> stateToMap() { Map<String, Object> result = new HashedMap<>(); result.put("btcTxHashesAlreadyProcessed", this.formatedAlreadyProcessedHashes()); result.put("rskTxsWaitingForSignatures", this.toStringList(rskTxsWaitingForSignatures.keySet())); result.put("btcBlockchainBestChainHeight", this.btcBlockchainBestChainHeight); return result; }
private WordTemplate<?> newTemplate() { try { PersistentTemplate templateData = new PersistentTemplate(); templateData.setDocumentName("test3"); templateData.setLanguage("de"); templateData.setContent(getContent("empty.docx")); templateData.setCreatedAt(new Date()); templateData.setEditedAt(new Date()); templateData.setEditor(new User("user", "user")); Map<String, String> properties = new HashMap<>(); properties.put("key", "value"); templateData.setProperties(properties); MappingDetail value = new MappingDetail(); value.setModelKey("modelKey"); Map<String, MappingDetail> contentMaping = new HashedMap<String, MappingDetail>(); contentMaping.put("conentKey", value); templateData.setContentMapping(contentMaping); WordTemplate<?> template = new WordTemplate<Object>(templateData, contextFactory); return template; } catch (IOException e) { throw new RuntimeException(e); } }
@TearDown(Level.Iteration) public void tearDown() { map = new HashMap<>(size); iterableMap = new HashedMap<>(size); mutableMap = UnifiedMap.newMap(size); for (int i = 0; i < size; i++) { map.put(i, i); mutableMap.put(i, i); iterableMap.put(i, i); } }
/** * Construct a new Instance of the commandline parser * @param args arguments user inputed */ public ClI(String[] args) { this.args = args; recievedArgutments = new HashedMap<>(); requiredArgs = new HashSet<>(); this.options = getOptions(); requiredArgs.add("src"); requiredArgs.add("mutF"); requiredArgs.add("testSte"); requiredArgs.add("goldOut"); }
public void testAlreadyReadableMap() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testAlreadyReadableMap"); final HashedMap<java.lang.String, java.lang.Integer> hashedMap = new HashedMap<java.lang.String, java.lang.Integer>(); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),8191,hashedMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),8193,null,8192,org.apache.commons.collections4.SplitMapUtils.readableMap(hashedMap)); fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public void testAlreadyWritableMap() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testAlreadyWritableMap"); final HashedMap<java.lang.String, java.lang.String> hashedMap = new HashedMap<java.lang.String, java.lang.String>(); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),8194,hashedMap); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),8196,null,8195,org.apache.commons.collections4.SplitMapUtils.writableMap(hashedMap)); fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public SizeLimitedLRUCache(int maxSizeUnits) { m_cache = new HashedMap<K, CacheEntry<K,V>>(); m_maxSizeUnits = maxSizeUnits; }
public void testNoteAccess_openManyNotes() { runWithSession(new IDominoCallable<Object>() { @Override public Object call(Session session) throws Exception { System.out.println("Starting note open test"); NotesDatabase dbData = getFakeNamesDb(); NotesCollection colAllDocs = dbData.openCollectionByName("People"); colAllDocs.update(); LinkedHashSet<Integer> allIds = colAllDocs.getAllIds(Navigate.NEXT_NONCATEGORY); System.out.println("Opening "+allIds.size()+" notes"); Map<Long,String> docDataByHandle = new HashedMap<Long, String>(); List<NotesNote> allNotes = new ArrayList<NotesNote>(); int idx=0; for (Integer currNoteId : allIds) { NotesNote currNote = dbData.openNoteById(currNoteId.intValue(), EnumSet.noneOf(OpenNote.class)); allNotes.add(currNote); String oldData = docDataByHandle.get(currNote.getHandle64()); if (oldData!=null) { System.out.println("old data for handle "+currNote.getHandle64()+": "+oldData); } String newData = currNote.getItemValueString("lastname") + ", "+currNote.getItemValueString("firstname")+" - noteid "+currNote.getNoteId(); docDataByHandle.put(currNote.getHandle64(), newData); System.out.println(Integer.toString(idx)+" - setting new data to "+newData); idx++; } System.out.println("Done opening "+allIds.size()+" notes"); return null; } }); }
/** * Matches the @searchedText in each test failure and return a list with the Jenkins links to the failed tests reports * * @param jUnitReportXml the JUnit xml report as a String * @param buildNumber build number * @param nodeUrl node URL * @param toolArgs: toolArgs.searchInJUnitReports true if we search a regular expression in failure messages * toolArgs.groupTestsFailures true if it groups failures based on stacktrace and failure message * toolArgs.searchedText the regular expression to match with the failure message * @return a list with the Jenkins links to the failed tests reports * @throws ParserConfigurationException * @throws IOException * @throws SAXException */ static FailuresMatchResult matchJUnitReportFailures(String jUnitReportXml, String buildNumber, String nodeUrl, ToolArgs toolArgs) throws ParserConfigurationException, IOException, SAXException { List<String> matchedFailedTests = new ArrayList<>(); Map<String, Integer> testsCount = new HashedMap<>(); ArrayListValuedHashMap<String, TestFailure> testsFailures = new ArrayListValuedHashMap<>(); ArrayListValuedHashMap<String, TestStatus> testsStatus = new ArrayListValuedHashMap<>(); // if the JUnit report is empty we cannot parse it if (jUnitReportXml.isEmpty()) { return new FailuresMatchResult(matchedFailedTests, testsFailures, testsStatus); } DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); jUnitReportXml = encodeNewLineCharInFailureElements(jUnitReportXml); Document doc = dBuilder.parse(new ByteArrayInputStream(jUnitReportXml.getBytes())); doc.getDocumentElement().normalize(); NodeList testCasesList = doc.getElementsByTagName("testcase"); for (int testCaseIndex = 0; testCaseIndex < testCasesList.getLength(); testCaseIndex++) { Node testCaseNode = testCasesList.item(testCaseIndex); if (testCaseNode.getNodeType() == Node.ELEMENT_NODE) { Element testCaseElement = (Element) testCaseNode; String shortTestName = testCaseElement.getAttribute("name"); String testName = testCaseElement.getAttribute("classname").concat(".").concat(shortTestName); String[] classNameTokens = testCaseElement.getAttribute("classname").split("\\."); // the package name from url needs to remain with ".", the class name is delimited using "/" String packageName = ""; for (int i = 0; i < classNameTokens.length - 1; i++) { packageName += classNameTokens[i].concat("."); } packageName = packageName.length() > 0 ? new StringBuilder(packageName).deleteCharAt(packageName.length() - 1).toString() : packageName; packageName = classNameTokens.length < 2 ? "(root)" : packageName; String className = classNameTokens[classNameTokens.length - 1]; String testUrl = packageName.concat("/").concat(className).concat("/").concat(shortTestName.replaceAll("[.: \\\\()\\[\\]/,-]", "_")); Integer testCount = testsCount.get(testUrl); testCount = testCount == null ? 0 : testCount; testsCount.put(testUrl, ++testCount); testUrl = testCount < 2 ? testUrl : testUrl.concat("_").concat(String.valueOf(testCount)); NodeList failureNodes = testCaseElement.getElementsByTagName("failure"); FailuresMatchResult failuresMatchResult = matchTestCaseFailures(failureNodes, testUrl, testName, shortTestName, buildNumber, nodeUrl, toolArgs); matchedFailedTests.addAll(failuresMatchResult.matchedFailedTests); testsFailures.putAll(failuresMatchResult.testsFailures); NodeList errorNodes = testCaseElement.getElementsByTagName("error"); FailuresMatchResult errorsMatchResult = matchTestCaseFailures(errorNodes, testUrl, testName, shortTestName, buildNumber, nodeUrl, toolArgs); matchedFailedTests.addAll(errorsMatchResult.matchedFailedTests); NodeList skippedNodes = testCaseElement.getElementsByTagName("skipped"); FailuresMatchResult skippedMatchResult = matchTestCaseFailures(skippedNodes, testUrl, testName, shortTestName, buildNumber, nodeUrl, toolArgs); matchedFailedTests.addAll(skippedMatchResult.matchedFailedTests); testsFailures.putAll(skippedMatchResult.testsFailures); if (toolArgs.computeStabilityList) { String stabilityTestName = testCaseElement.getAttribute("classname").concat("&").concat(shortTestName); Boolean failedStatus = failureNodes.getLength() != 0 || errorNodes.getLength() != 0; TestStatus testStatus = new TestStatus(Integer.parseInt(buildNumber), failedStatus); testsStatus.put(stabilityTestName, testStatus); } } } return new FailuresMatchResult(matchedFailedTests, testsFailures, testsStatus); }
public BrickConfiguration(String name, BrickType type, String version, Set<PortDefinition> portDefinitions) { this(name, type, version, portDefinitions, new HashSet<>(), new HashedMap<>()); }
@Test @SuppressWarnings({"rawtypes", "unchecked"}) public void testURLDecode() { String c = String.format("%s\n%s\n%s", "fields:", " - query1", " - '[extra][value2]'" ); Yaml yaml = new Yaml(); Map config = (Map) yaml.load(c); Assert.assertNotNull(config); URLDecode URLDecodefilter = new URLDecode(config); // Yes Map event = new HashMap(); event.put( "query1", "wd%3dq%2520gishp%2520su%26rsv_spt%3d1%26rsv_iqid%3d0xa37c438600003f19%26issp%3d1%26f%3d8%26rsv_bp%3d0%26rsv_idx%3d2%26ie%3dutf-8%26tn%3dbaiduhome_pg%26rsv_enter%3d1%26rsv_sug3%3d15%26rsv_sug1%3d6%26rsv_sug2%3d0%26rsv_sug7%3d100%26inputT%3d8493%26rsv_sug4%3d11379" ); event.put("extra", new HashedMap() {{ this.put("value2", "wd%3dq%2520gishp%2520su%26rsv_spt%3d1%26rsv_iqid%3d0xa37c438600003f19%26issp%3d1%26f%3d8%26rsv_bp%3d0%26rsv_idx%3d2%26ie%3dutf-8%26tn%3dbaiduhome_pg%26rsv_enter%3d1%26rsv_sug3%3d15%26rsv_sug1%3d6%26rsv_sug2%3d0%26rsv_sug7%3d100%26inputT%3d8493%26rsv_sug4%3d11379" ); }}); event = URLDecodefilter.process(event); Assert.assertEquals( event.get("query1"), "wd=q%20gishp%20su&rsv_spt=1&rsv_iqid=0xa37c438600003f19&issp=1&f=8&rsv_bp=0&rsv_idx=2&ie=utf-8&tn=baiduhome_pg&rsv_enter=1&rsv_sug3=15&rsv_sug1=6&rsv_sug2=0&rsv_sug7=100&inputT=8493&rsv_sug4=11379"); Assert.assertEquals( ((Map) event.get("extra")).get("value2"), "wd=q%20gishp%20su&rsv_spt=1&rsv_iqid=0xa37c438600003f19&issp=1&f=8&rsv_bp=0&rsv_idx=2&ie=utf-8&tn=baiduhome_pg&rsv_enter=1&rsv_sug3=15&rsv_sug1=6&rsv_sug2=0&rsv_sug7=100&inputT=8493&rsv_sug4=11379"); Assert.assertNull(event.get("tags")); // Exception event = new HashMap(); event.put( "query1", "wd%3dq%2520gishp%2520su%26rsv_spt%3d1%26rsv_iqid%3d0xa37c438600003f19%26issp%3d1%26f%3d8%26rsv_bp%3d0%26rsv_idx%3d2%26ie%3dutf-8%26tn%3dbaiduhome_pg%26rsv_enter%3d1%26rsv_sug3%3d15%26rsv_sug1%3d6%26rsv_sug2%3d0%26rsv_sug7%3d100%26inputT%3d8493%26rsv_sug4%3d11379"); event.put( "extra", new HashedMap() {{ this.put("value2", "wd=q gishp%%0su&rsv_spt=1&rsv_iqid=0xa37c438600003f19&issp=1&f=8&rsv_bp=0&rsv_idx=2&ie=utf-8&tn=baiduhome_pg&rsv_enter=1&rsv_sug3=15&rsv_sug1=6&rsv_sug2=0&rsv_sug7=100&inputT=8493&rsv_sug4=11379"); }}); event = URLDecodefilter.process(event); Assert.assertEquals(((ArrayList) event.get("tags")).get(0), "URLDecodefail"); // Exception, NO tag c = "fields: [\"query1\",\"query2\"]\ntag_on_failure: null"; yaml = new Yaml(); config = (Map) yaml.load(c); Assert.assertNotNull(config); URLDecodefilter = new URLDecode(config); event = new HashMap(); event.put( "query2", "wd=q gishp%%0su&rsv_spt=1&rsv_iqid=0xa37c438600003f19&issp=1&f=8&rsv_bp=0&rsv_idx=2&ie=utf-8&tn=baiduhome_pg&rsv_enter=1&rsv_sug3=15&rsv_sug1=6&rsv_sug2=0&rsv_sug7=100&inputT=8493&rsv_sug4=11379"); event = URLDecodefilter.process(event); Assert.assertNull(event.get("tags")); }
private List<GrassrootEmail> generateEmailsForAlert(LiveWireAlert alert, List<String> emailAddresses) { String subject, template; Map<String, Object> emailVars = new HashedMap<>(); emailVars.put("contactName", alert.getContactNameNullSafe()); logger.debug("contactName, and from alert: {}", alert.getContactNameNullSafe(), alert.getContactUser().getName()); emailVars.put("contactNumber", PhoneNumberUtil.formattedNumber( alert.getContactUser().getPhoneNumber())); emailVars.put("headline", alert.getHeadline()); emailVars.put("description", alert.getDescription()); logger.debug("formatted number: {}", emailVars.get("contactNumber")); // todo : check both for location if (LiveWireAlertType.INSTANT.equals(alert.getType())) { Group group = alert.getGroup(); subject = "email.livewire.instant.subject"; template = "livewire_instant"; populateGroupVars(group, emailVars); } else { Meeting meeting = alert.getMeeting(); subject = "email.livewire.meeting.subject"; template = "livewire_meeting"; emailVars.put("mtgLocation", meeting.getEventLocation()); emailVars.put("dateTime", mtgFormat.format(meeting.getEventDateTimeAtSAST())); emailVars.put("mtgSubject", meeting.getName()); populateGroupVars(meeting.getAncestorGroup(), emailVars); } GrassrootEmail.EmailBuilder builder = new GrassrootEmail.EmailBuilder() .from("Grassroot LiveWire") .subject(messageSource.getMessage(subject, new String[] {alert.getHeadline()})); if (alert.getMediaFiles() != null && !alert.getMediaFiles().isEmpty()) { // for the moment, we basically are just sending one as attachment (to change when gallery etc working) logger.debug("trying to fetch the image ...."); File attachment = storageBroker.fetchFileFromRecord(alert.getMediaFiles().iterator().next()); logger.debug("fetched the image, adding it to email ..."); builder.attachment("image.jpg", attachment); } final Context ctx = new Context(Locale.ENGLISH); return emailAddresses.stream() .map(a -> finishAlert(ctx, builder, emailVars, template, a)) .collect(Collectors.toList()); }