List of usage examples for java.util LinkedHashMap get
public V get(Object key)
From source file:com.glaf.shiro.MyShiroFilterFactoryBean.java
@Override public Map<String, String> getFilterChainDefinitionMap() { logger.debug("load system security properties..."); logger.debug("filterChain size:" + filterChainDefinitionMap.size()); LinkedHashMap<String, String> props = SecurityConfig.getProperties(); Iterator<String> it = props.keySet().iterator(); while (it.hasNext()) { String key = it.next();//from w w w .j av a2s. c o m String value = props.get(key); if (StringUtils.startsWith("**", key) || StringUtils.startsWith("/**", key)) { continue; } filterChainDefinitionMap.put(key, value); logger.debug("add security filter chain:" + key + "=" + value); } /** * ?? */ filterChainDefinitionMap.put("/rs/**", "authc"); filterChainDefinitionMap.put("/mx/**", "authc"); logger.debug(filterChainDefinitionMap); return filterChainDefinitionMap; }
From source file:org.raxa.module.raxacore.web.v1_0.controller.RaxaAlertControllerTest.java
/** * @see RaxaAlertController#updateRaxaAlert(String, SimpleObject, HttpServletRequest, HttpServletResponse) * @verifies a new patient list is created *//*from w w w. ja va 2 s. c om*/ @Test public void updateRaxaAlert_shouldUpdateARaxaAlert() throws Exception { int before = service.getAllRaxaAlerts(true).size(); String json = "{ \"name\":\"Test RaxaAlert\",\"description\":\"Test Alert\"}"; SimpleObject post = new ObjectMapper().readValue(json, SimpleObject.class); controller.updateRaxaAlert(getUuid(), post, request, response); Assert.assertEquals(before, service.getAllRaxaAlerts(true).size()); String results = controller.getAllRaxaAlerts(request, response); //SimpleObject updatedRaxaAlert = SimpleObject.parseJson(results.substring(12, result.length() - 2)); LinkedHashMap updatedRaxaAlert = (LinkedHashMap) ((ArrayList) SimpleObject.parseJson(results) .get("results")).get(0); Assert.assertEquals(getUuid(), updatedRaxaAlert.get("uuid")); Assert.assertEquals("Test RaxaAlert", updatedRaxaAlert.get("name")); }
From source file:com.ultramegasoft.flavordex2.coffee.CoffeeEntryFormHelper.java
@Override public void setExtras(@NonNull LinkedHashMap<String, ExtraFieldHolder> extras) { super.setExtras(extras); initSpinner(mSpnBrewMethod, extras.get(Tables.Extras.Coffee.BREW_METHOD)); initEditText(mTxtRoaster, extras.get(Tables.Extras.Coffee.ROASTER)); initEditText(mTxtRoastDate, extras.get(Tables.Extras.Coffee.ROAST_DATE)); initEditText(mTxtGrind, extras.get(Tables.Extras.Coffee.GRIND)); initEditText(mTxtDose, extras.get(Tables.Extras.Coffee.STATS_DOSE)); initEditText(mTxtEspMass, extras.get(Tables.Extras.Coffee.STATS_MASS)); initEditText(mTxtWaterMass, extras.get(Tables.Extras.Coffee.STATS_MASS)); initEditText(mTxtTemp, extras.get(Tables.Extras.Coffee.STATS_TEMP)); initExtractionTime(mTxtExtTimeM, mTxtExtTimeS, extras.get(Tables.Extras.Coffee.STATS_EXTIME)); initEditText(mTxtTDS, extras.get(Tables.Extras.Coffee.STATS_TDS)); initEditText(mTxtYield, extras.get(Tables.Extras.Coffee.STATS_YIELD)); }
From source file:org.openmrs.module.webservices.rest.web.RestUtilTest.java
/** * @see RestUtil#wrapErrorResponse(Exception,String) * @verifies sets the reason passed into wrapErrorResponse as the message if it is nonempty *//* w w w. j a va2 s. c o m*/ @Test public void wrapErrorResponse_shouldSetReasonAsMessageIfNotEmpty() throws Exception { SimpleObject returnObject = RestUtil.wrapErrorResponse(new Exception("exceptionmessage"), "reason"); LinkedHashMap errorResponseMap = (LinkedHashMap) returnObject.get("error"); Assert.assertEquals("reason", errorResponseMap.get("message")); }
From source file:org.openmrs.module.webservices.rest.web.RestUtilTest.java
/** * @see RestUtil#wrapErrorResponse(Exception,String) * @verifies set stack trace code and detail empty if not available *//*from www. j av a 2s . c o m*/ @Test public void wrapErrorResponse_shouldSetStackTraceCodeAndDetailEmptyIfNotAvailable() throws Exception { Exception mockException = Mockito.mock(Exception.class); Mockito.when(mockException.getMessage()).thenReturn("exceptionmessage"); Mockito.when(mockException.getStackTrace()).thenReturn(new StackTraceElement[] {}); SimpleObject returnObject = RestUtil.wrapErrorResponse(mockException, "wraperrorresponsemessage"); LinkedHashMap errorResponseMap = (LinkedHashMap) returnObject.get("error"); Assert.assertEquals("", errorResponseMap.get("code")); Assert.assertEquals("", errorResponseMap.get("detail")); }
From source file:com.arkea.jenkins.openstack.heat.orchestration.template.Bundle.java
/** * Convert an object value from the yaml to string * /*from www .java 2s . c o m*/ * @param value * the object value from the yaml * @return the object in string format */ @SuppressWarnings("unchecked") private String convertValue(Object value) { if (value instanceof java.util.LinkedHashMap) { StringBuilder rtn = new StringBuilder("{"); java.util.LinkedHashMap<String, String> data = (java.util.LinkedHashMap<String, String>) value; for (String key : data.keySet()) { rtn.append(key).append(":").append(data.get(key)).append(","); } rtn.deleteCharAt(rtn.length() - 1); rtn.append("}"); return rtn.toString(); } return String.valueOf(value); }
From source file:aldenjava.opticalmapping.data.mappingresult.OptMapResultNode.java
public static OptMapResultNode reverseRefAndFrag(OptMapResultNode result, LinkedHashMap<String, DataNode> originalOptRefMap) { return OptMapResultNode.reverseRefAndFrag(result, originalOptRefMap.get(result.mappedRegion.ref)); }
From source file:org.openmrs.module.webservices.rest.web.RestUtilTest.java
/** * @see RestUtil#wrapErrorResponse(Exception,String) * @verifies sets message to the exception message if the reason given is null *///from www . jav a2 s . c om @Test public void wrapErrorResponse_shouldSetExceptionMessageIfReasonIsNull() throws Exception { SimpleObject returnObject = RestUtil.wrapErrorResponse(new Exception("exceptionmessage"), null); LinkedHashMap errorResponseMap = (LinkedHashMap) returnObject.get("error"); Assert.assertEquals("exceptionmessage", errorResponseMap.get("message")); }
From source file:org.openmrs.module.webservices.rest.web.RestUtilTest.java
/** * @see RestUtil#wrapErrorResponse(Exception,String) * @verifies sets message to the exception message if the reason given is empty *///from w w w .j a v a 2 s . c o m @Test public void wrapErrorResponse_shouldSetExceptionMessageIfReasonIsEmpty() throws Exception { SimpleObject returnObject = RestUtil.wrapErrorResponse(new Exception("exceptionmessage"), ""); LinkedHashMap errorResponseMap = (LinkedHashMap) returnObject.get("error"); Assert.assertEquals("exceptionmessage", errorResponseMap.get("message")); }
From source file:org.raxa.module.raxacore.web.v1_0.controller.DrugInventoryControllerTest.java
/** * @see DrugInventoryController#updateDrugInventory(String, SimpleObject, HttpServletRequest, HttpServletResponse) * @verifies updates a drug inv/* www. j a v a2 s . c o m*/ */ @Test public void updateDrugInventory_shouldUpdateDrugInventory() throws Exception { int before = service.getAllDrugInventories().size(); String json = "{ \"name\":\"Updated DrugInv\",\"description\":\"Update\"}"; SimpleObject post = new ObjectMapper().readValue(json, SimpleObject.class); controller.updateDrugInventory("68547121-1b70-465c-99ee-c9dfd95e7d36", post, request, response); String results = controller.getAllDrugInventories(request, response); //SimpleObject updatedRaxaAlert = SimpleObject.parseJson(results.substring(12, result.length() - 2)); LinkedHashMap updatedRaxaAlert = (LinkedHashMap) ((ArrayList) SimpleObject.parseJson(results) .get("results")).get(0); Assert.assertEquals("68547121-1b70-465c-99ee-c9dfd95e7d36", updatedRaxaAlert.get("uuid")); Assert.assertEquals("Updated DrugInv", updatedRaxaAlert.get("name")); }