@Override public int compareTo(FilterInfo filterInfo) { if(filterInfo.getFilterName().equals(this.getFilterName())){ return filterInfo.creationDate.compareTo(getCreationDate()); } return filterInfo.getFilterName().compareTo(this.getFilterName()); }
@Override public int compareTo(FilterInfo filterInfo) { if(filterInfo.getFilterName().equals(this.getFilterName())){ return filterInfo.creationDate.compareTo(getCreationDate()); } return filterInfo.getFilterName().compareTo(this.getFilterName()); }
assertEquals(filterInfo.getFilterID(), "null:filter:in"); assertEquals(filterInfo.getFilterType(), FilterType.INBOUND); assertEquals(filterInfo.getFilterName(), "filter"); assertFalse(filterInfo.isActive()); assertFalse(filterInfo.isCanary());
assertEquals(filterInfo.getFilterID(), "null:filter:in"); assertEquals(filterInfo.getFilterType(), FilterType.INBOUND); assertEquals(filterInfo.getFilterName(), "filter"); assertFalse(filterInfo.isActive()); assertFalse(filterInfo.isCanary());
@Override public int compareTo(FilterInfo filterInfo) { if(filterInfo.getFilterName().equals(this.getFilterName())){ return filterInfo.creationDate.compareTo(getCreationDate()); } return filterInfo.getFilterName().compareTo(this.getFilterName()); }
@Override public int compareTo(FilterInfo filterInfo) { if(filterInfo.getFilterName().equals(this.getFilterName())){ return filterInfo.creationDate.compareTo(getCreationDate()); } return filterInfo.getFilterName().compareTo(this.getFilterName()); }
private Map<String, Object> createExpectedJsonMap(FilterInfo script) { Map<String, Object> expectedJson = new LinkedHashMap<String, Object>(); expectedJson.put("filter_id", script.getFilterID()); expectedJson.put("filter_name", script.getFilterName()); expectedJson.put("filter_type", script.getFilterType()); expectedJson.put("revision", script.getRevision()); expectedJson.put("active", script.isActive()); expectedJson.put("creationDate", script.getCreationDate()); expectedJson.put("canary", script.isCanary()); return expectedJson; }
private Map<String, Object> createEndpointScriptJSON(FilterInfo script) { Map<String, Object> scriptJson = new LinkedHashMap<String, Object>(); scriptJson.put("filter_id", script.getFilterID()); scriptJson.put("filter_name", script.getFilterName()); scriptJson.put("filter_type", script.getFilterType()); scriptJson.put("revision", script.getRevision()); scriptJson.put("active", script.isActive()); scriptJson.put("creationDate", script.getCreationDate()); scriptJson.put("canary", script.isCanary()); return scriptJson; }
private void writeFilterToDisk(FilterInfo newFilter) throws IOException { String path = DynamicPropertyFactory.getInstance().getStringProperty(ZuulConstants.ZUUL_FILTER_PRE_PATH, null).get(); if (newFilter.getFilterType().equals("post")) { path = DynamicPropertyFactory.getInstance().getStringProperty(ZuulConstants.ZUUL_FILTER_POST_PATH, null).get(); } if (newFilter.getFilterType().equals("route")) { path = DynamicPropertyFactory.getInstance().getStringProperty(ZuulConstants.ZUUL_FILTER_ROUTING_PATH, null).get(); } File f = new File(path, newFilter.getFilterName() + ".groovy"); FileWriter file = new FileWriter(f); BufferedWriter out = new BufferedWriter(file); out.write(newFilter.getFilterCode()); out.close(); file.close(); System.out.println("filter written " + f.getPath()); }
private void writeFilterToDisk(FilterInfo newFilter) throws IOException { String path = DynamicPropertyFactory.getInstance().getStringProperty(ZuulConstants.ZUUL_FILTER_PRE_PATH, null).get(); if (newFilter.getFilterType().equals(FilterType.OUTBOUND)) { path = DynamicPropertyFactory.getInstance().getStringProperty(ZuulConstants.ZUUL_FILTER_POST_PATH, null).get(); } if (newFilter.getFilterType().equals(FilterType.ENDPOINT)) { path = DynamicPropertyFactory.getInstance().getStringProperty(ZuulConstants.ZUUL_FILTER_ROUTING_PATH, null).get(); } File f = new File(path, newFilter.getFilterName() + ".groovy"); FileWriter file = new FileWriter(f); BufferedWriter out = new BufferedWriter(file); out.write(newFilter.getFilterCode()); out.close(); file.close(); System.out.println("filter written " + f.getPath()); }
private void handleUploadAction(HttpServletRequest request, HttpServletResponse response) throws IOException { String filter = handlePostBody(request, response); if (filter != null) { FilterInfo filterInfo = null; try { filterInfo = FilterVerifier.getInstance().verifyFilter(filter); } catch (IllegalAccessException e) { logger.error(e.getMessage(), e); setUsageError(500, "ERROR: Unable to process uploaded data. " + e.getMessage(), response); } catch (InstantiationException e) { logger.error(e.getMessage(), e); setUsageError(500, "ERROR: Bad Filter. " + e.getMessage(), response); } filterInfo = scriptDAO.addFilter(filter, filterInfo.getFilterType(), filterInfo.getFilterName(), filterInfo.getFilterDisablePropertyName(), filterInfo.getFilterOrder()); if (filterInfo == null) { setUsageError(500, "ERROR: Unable to process uploaded data.", response); return; } response.sendRedirect(redirectPath.get()); } }
assertEquals(filterInfo.getFilterID(), "null:filter:pre"); assertEquals(filterInfo.getFilterType(), "pre"); assertEquals(filterInfo.getFilterName(), "filter"); assertFalse(filterInfo.isActive()); assertFalse(filterInfo.isCanary());
assertEquals(filterInfo.getFilterID(), "null:filter:in"); assertEquals(filterInfo.getFilterType(), FilterType.INBOUND); assertEquals(filterInfo.getFilterName(), "filter"); assertFalse(filterInfo.isActive()); assertFalse(filterInfo.isCanary());