// @Test // URL Pattern: [usage][getHello]=2 // EXPECTED: Success; hits +2 public void testAuthrepUsageWithNestedMethodAndUserKey() throws ServerError { ParameterMap usage = new ParameterMap(); usage.add("getHello", "2"); params.add("usage", usage); AuthorizeResponse auresp = serviceApi.authrep(params); reportResult(auresp); }
public void add(ParameterMap newMap) { for (Parameter p : shownParams.getParamList()) { if (newMap.contains(p)) { newMap.put(p); } } this.shownParams = newMap; repaintContent(); }
@Before public void setup() { serviceApi = new ServiceApiDriver(provider_key); fmt = DateTimeFormat.forPattern("YYYY-MM-dd HH:mm:ss Z"); params = new ParameterMap(); params.add("service_id", TestKeys.user_key_service_id); params.add("user_key", TestKeys.user_key); }
// @Test // URL Pattern: [usage][hits]=1 // Expected: OK results in Hits incrementing by 1 public void test_successful_report() throws ServerError { ParameterMap usage = new ParameterMap(); usage.add("hits", "1"); params.add("usage", usage); ReportResponse response = serviceApi.report(TestKeys.user_key_service_id, params); assertTrue(response.success()); }
/** * This is used to ensure that for each parameter in the builder there is a matching method or * field. This ensures that the class schema is fully readable and writable. If not method or * field annotation exists for the parameter validation fails. * * @param detail contains the details instantiators are built with */ private void validate(Detail detail) throws Exception { ParameterMap registry = scanner.getParameters(); List<Parameter> list = registry.getAll(); for (Parameter parameter : list) { Label label = resolve(parameter); String path = parameter.getPath(); if (label == null) { throw new ConstructorException("Parameter '%s' does not have a match in %s", path, detail); } validateParameter(label, parameter); } validateConstructors(); }
public BoundSql getBoundSql(Object parameterObject) { BoundSql boundSql = sqlSource.getBoundSql(parameterObject); List<ParameterMapping> parameterMappings = boundSql.getParameterMappings(); if (parameterMappings == null || parameterMappings.size() <= 0) { boundSql = new BoundSql( configuration, boundSql.getSql(), parameterMap.getParameterMappings(), parameterObject); } // check for nested result maps in parameter mappings (issue #30) for (ParameterMapping pm : boundSql.getParameterMappings()) { String rmId = pm.getResultMapId(); if (rmId != null) { ResultMap rm = configuration.getResultMap(rmId); if (rm != null) { hasNestedResultMaps |= rm.hasNestedResultMaps(); } } } return boundSql; }
// @Test // URL Pattern: [usage][hits]=1 // Expected: OK results in Hits incrementing by 1 public void testAuthrepEmptyUsageAndUserKey() throws ServerError { ParameterMap usage = new ParameterMap(); params.add("usage", usage); AuthorizeResponse auresp = serviceApi.authrep(params); reportResult(auresp); }
private void repaintContent() { if (content != null) { remove(content); } content = new JPanel(); content.setLayout(new GridBagLayout()); content.setBackground(Colors.TEMPLATE); int gridY = 0; GridBagConstraints c; for (Parameter p : shownParams.getParamList()) { c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridY; c.anchor = GridBagConstraints.WEST; c.fill = GridBagConstraints.NONE; c.insets = new Insets(0, 0, 0, 8); content.add(new JLabel(p.getName()), c); c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridY++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; final Parameter pFinal = p; final JTextField jTextField = new DJTextField(); jTextField.setText(p.getValue()); jTextField.addKeyListener( new KeyListener() { public void keyTyped(KeyEvent keyEvent) { // TODO } public void keyPressed(KeyEvent keyEvent) { // TODO } public void keyReleased(KeyEvent keyEvent) { pFinal.setValue(jTextField.getText()); } }); content.add(jTextField, c); } GridBagConstraints nc = new GridBagConstraints(); nc.gridx = 0; nc.gridy = 0; nc.weightx = 1; nc.fill = GridBagConstraints.HORIZONTAL; add(content, nc); content.updateUI(); content.repaint(); this.repaint(); }
/** * Constructs a request with optional params appended to the query string. * * @param path * @param params */ public HttpRequest(String path, ParameterMap params) { String queryString = null; if (path != null) { this.path = path; } if (params != null) { queryString = params.urlEncode(); this.path += "?" + queryString; } }