@Test(expected=IllegalArgumentException.class) public void testBadParameters() throws Exception { strategy.setResourceTypeName("hrStorageIndex"); List<Parameter> params = new ArrayList<Parameter>(); params.add(createParameter("sibling-column-oid", ".1.3.6.1.2.1.25.2.3.1.3")); params.add(createParameter("replace-first", "s/^-$/_root_fs/")); params.add(createParameter("replace-first", "s/^- params.add(createParameter("replace-all", "s/\\s params.add(createParameter("replace-all", "s/:\\\\.* strategy.setParameters(params); }
@Override public void setParameters(List<Parameter> parameterCollection) throws IllegalArgumentException { if (parameterCollection == null) { final String msg ="Got a null parameter list, but need one containing a '" + PARAM_SIBLING_COLUMN_NAME + "' parameter."; log().fatal(msg); throw new IllegalArgumentException(msg); } for (Parameter param : parameterCollection) { if (PARAM_SIBLING_COLUMN_NAME.equals(param.getKey())) { m_siblingColumnName = param.getValue(); } else if (PARAM_REPLACE_FIRST.equals(param.getKey())) { m_replaceOps.add(new ReplaceFirstOperation(param.getValue())); } else if (PARAM_REPLACE_ALL.equals(param.getKey())) { m_replaceOps.add(new ReplaceAllOperation(param.getValue())); } else { if (param.getKey().equals("sibling-column-oid")) { final String msg = "The parameter 'sibling-column-oid' has been deprecated and it is no longer used. You should configure 'sibling-column-name' instead. For this parameter, you should use the name of any MibObj defined as string for the same resource type."; log().error(msg); throw new IllegalArgumentException(msg); } else { log().warn("Encountered unsupported parameter key=\"" + param.getKey() + "\". Can accept: " + PARAM_SIBLING_COLUMN_NAME + ", " + PARAM_REPLACE_FIRST + ", " + PARAM_REPLACE_ALL); } } } if (m_siblingColumnName == null) { final String msg = "The provided parameter list must contain a '" + PARAM_SIBLING_COLUMN_NAME + "' parameter."; log().error(msg); throw new IllegalArgumentException(msg); } }
SiblingColumnStorageStrategy extends IndexStorageStrategy { @Override public void setParameters(List<Parameter> parameterCollection) throws IllegalArgumentException { if (parameterCollection == null) { final String msg ="Got a null parameter list, but need one containing a '" + PARAM_SIBLING_COLUMN_NAME + "' parameter."; log().fatal(msg); throw new IllegalArgumentException(msg); } for (Parameter param : parameterCollection) { if (PARAM_SIBLING_COLUMN_NAME.equals(param.getKey())) { m_siblingColumnName = param.getValue(); } else if (PARAM_REPLACE_FIRST.equals(param.getKey())) { m_replaceOps.add(new ReplaceFirstOperation(param.getValue())); } else if (PARAM_REPLACE_ALL.equals(param.getKey())) { m_replaceOps.add(new ReplaceAllOperation(param.getValue())); } else { if (param.getKey().equals("sibling-column-oid")) { final String msg = "The parameter 'sibling-column-oid' has been deprecated and it is no longer used. You should configure 'sibling-column-name' instead. For this parameter, you should use the name of any MibObj defined as string for the same resource type."; log().error(msg); throw new IllegalArgumentException(msg); } else { log().warn("Encountered unsupported parameter key=\"" + param.getKey() + "\". Can accept: " + PARAM_SIBLING_COLUMN_NAME + ", " + PARAM_REPLACE_FIRST + ", " + PARAM_REPLACE_ALL); } } } if (m_siblingColumnName == null) { final String msg = "The provided parameter list must contain a '" + PARAM_SIBLING_COLUMN_NAME + "' parameter."; log().error(msg); throw new IllegalArgumentException(msg); } } }
SiblingColumnStorageStrategy extends IndexStorageStrategy { @Override public void setParameters(List<Parameter> parameterCollection) throws IllegalArgumentException { if (parameterCollection == null) { final String msg ="Got a null parameter list, but need one containing a '" + PARAM_SIBLING_COLUMN_NAME + "' parameter."; log().fatal(msg); throw new IllegalArgumentException(msg); } for (Parameter param : parameterCollection) { if (PARAM_SIBLING_COLUMN_NAME.equals(param.getKey())) { m_siblingColumnName = param.getValue(); } else if (PARAM_REPLACE_FIRST.equals(param.getKey())) { m_replaceOps.add(new ReplaceFirstOperation(param.getValue())); } else if (PARAM_REPLACE_ALL.equals(param.getKey())) { m_replaceOps.add(new ReplaceAllOperation(param.getValue())); } else { if (param.getKey().equals("sibling-column-oid")) { final String msg = "The parameter 'sibling-column-oid' has been deprecated and it is no longer used. You should configure 'sibling-column-name' instead. For this parameter, you should use the name of any MibObj defined as string for the same resource type."; log().error(msg); throw new IllegalArgumentException(msg); } else { log().warn("Encountered unsupported parameter key=\"" + param.getKey() + "\". Can accept: " + PARAM_SIBLING_COLUMN_NAME + ", " + PARAM_REPLACE_FIRST + ", " + PARAM_REPLACE_ALL); } } } if (m_siblingColumnName == null) { final String msg = "The provided parameter list must contain a '" + PARAM_SIBLING_COLUMN_NAME + "' parameter."; log().error(msg); throw new IllegalArgumentException(msg); } } SiblingColumnStorageStrategy(); }
SiblingColumnStorageStrategy extends IndexStorageStrategy { @Override public void setParameters(List<Parameter> parameterCollection) throws IllegalArgumentException { if (parameterCollection == null) { final String msg ="Got a null parameter list, but need one containing a '" + PARAM_SIBLING_COLUMN_NAME + "' parameter."; log().fatal(msg); throw new IllegalArgumentException(msg); } for (Parameter param : parameterCollection) { if (PARAM_SIBLING_COLUMN_NAME.equals(param.getKey())) { m_siblingColumnName = param.getValue(); } else if (PARAM_REPLACE_FIRST.equals(param.getKey())) { m_replaceOps.add(new ReplaceFirstOperation(param.getValue())); } else if (PARAM_REPLACE_ALL.equals(param.getKey())) { m_replaceOps.add(new ReplaceAllOperation(param.getValue())); } else { if (param.getKey().equals("sibling-column-oid")) { final String msg = "The parameter 'sibling-column-oid' has been deprecated and it is no longer used. You should configure 'sibling-column-name' instead. For this parameter, you should use the name of any MibObj defined as string for the same resource type."; log().error(msg); throw new IllegalArgumentException(msg); } else { log().warn("Encountered unsupported parameter key=\"" + param.getKey() + "\". Can accept: " + PARAM_SIBLING_COLUMN_NAME + ", " + PARAM_REPLACE_FIRST + ", " + PARAM_REPLACE_ALL); } } } if (m_siblingColumnName == null) { final String msg = "The provided parameter list must contain a '" + PARAM_SIBLING_COLUMN_NAME + "' parameter."; log().error(msg); throw new IllegalArgumentException(msg); } } SiblingColumnStorageStrategy(); @Override String getResourceNameFromIndex(CollectionResource resource); @Override void setParameters(List<Parameter> parameterCollection); }
SiblingColumnStorageStrategy extends IndexStorageStrategy { @Override public void setParameters(List<Parameter> parameterCollection) throws IllegalArgumentException { if (parameterCollection == null) { final String msg ="Got a null parameter list, but need one containing a '" + PARAM_SIBLING_COLUMN_NAME + "' parameter."; log().fatal(msg); throw new IllegalArgumentException(msg); } for (Parameter param : parameterCollection) { if (PARAM_SIBLING_COLUMN_NAME.equals(param.getKey())) { m_siblingColumnName = param.getValue(); } else if (PARAM_REPLACE_FIRST.equals(param.getKey())) { m_replaceOps.add(new ReplaceFirstOperation(param.getValue())); } else if (PARAM_REPLACE_ALL.equals(param.getKey())) { m_replaceOps.add(new ReplaceAllOperation(param.getValue())); } else { if (param.getKey().equals("sibling-column-oid")) { final String msg = "The parameter 'sibling-column-oid' has been deprecated and it is no longer used. You should configure 'sibling-column-name' instead. For this parameter, you should use the name of any MibObj defined as string for the same resource type."; log().error(msg); throw new IllegalArgumentException(msg); } else { log().warn("Encountered unsupported parameter key=\"" + param.getKey() + "\". Can accept: " + PARAM_SIBLING_COLUMN_NAME + ", " + PARAM_REPLACE_FIRST + ", " + PARAM_REPLACE_ALL); } } } if (m_siblingColumnName == null) { final String msg = "The provided parameter list must contain a '" + PARAM_SIBLING_COLUMN_NAME + "' parameter."; log().error(msg); throw new IllegalArgumentException(msg); } } SiblingColumnStorageStrategy(); @Override String getResourceNameFromIndex(CollectionResource resource); @Override void setParameters(List<Parameter> parameterCollection);  }