List of usage examples for java.lang StringBuffer deleteCharAt
@Override public synchronized StringBuffer deleteCharAt(int index)
From source file:io.personium.test.jersey.box.acl.AclTest.java
() { String testBox = "testBox01"; String testRole = "testRole01"; try {//from w ww .ja v a2 s . c o m // Box?? BoxUtils.create(TEST_CELL1, testBox, TOKEN); // Box????Role?? RoleUtils.create(TEST_CELL1, TOKEN, testRole, testBox, HttpStatus.SC_CREATED); // Box?Role?ACL DavResourceUtils.setACLwithBox(TEST_CELL1, TOKEN, HttpStatus.SC_OK, testBox, "", ACL_SETTING_TEST, testRole, testBox, "<D:read/>", ""); // PROPFIND TResponse res = DavResourceUtils.propfind("box/propfind-box-allprop.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, testBox); // PROPFIND?? List<Map<String, List<String>>> list = new ArrayList<Map<String, List<String>>>(); Map<String, List<String>> map = new HashMap<String, List<String>>(); List<String> rolList = new ArrayList<String>(); rolList.add("read"); list.add(map); map.put(testRole, rolList); Element root = res.bodyAsXml().getDocumentElement(); String resorce = UrlUtils.box(TEST_CELL1, testBox); // UrlUtil???URL????? StringBuffer sb = new StringBuffer(resorce); sb.deleteCharAt(resorce.length() - 1); TestMethodUtils.aclResponseTest(root, sb.toString(), list, 1, UrlUtils.roleResource(TEST_CELL1, testBox, ""), null); } finally { // Role? RoleUtils.delete(TEST_CELL1, TOKEN, testRole, testBox); // Box1? BoxUtils.delete(TEST_CELL1, TOKEN, testBox); } }
From source file:com.fujitsu.dc.test.jersey.box.acl.AclTest.java
() { String testBox1 = "testBox01"; String testRole = "testRole02"; try {/*from w ww . j a v a2 s . c o m*/ // Box?? BoxUtils.create(TEST_CELL1, testBox1, TOKEN); // Role?? RoleUtils.create(TEST_CELL1, TOKEN, testBox1, testRole, HttpStatus.SC_CREATED); // Box?Role?ACL DavResourceUtils.setACLwithRoleBaseUrl(TEST_CELL1, TOKEN, HttpStatus.SC_OK, testBox1, "", "box/acl-setting-baseurl.txt", UrlUtils.roleResource(TEST_CELL1, testBox1, testRole), "<D:read/>", ""); // PROPFIND TResponse res = DavResourceUtils.propfind("box/propfind-box-allprop.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, testBox1); // PROPFIND?? List<Map<String, List<String>>> list = new ArrayList<Map<String, List<String>>>(); Map<String, List<String>> map = new HashMap<String, List<String>>(); List<String> rolList = new ArrayList<String>(); rolList.add("read"); list.add(map); map.put(testRole, rolList); Element root = res.bodyAsXml().getDocumentElement(); String resorce = UrlUtils.box(TEST_CELL1, testBox1); // UrlUtil???URL????? StringBuffer sb = new StringBuffer(resorce); sb.deleteCharAt(resorce.length() - 1); TestMethodUtils.aclResponseTest(root, sb.toString(), list, 1, UrlUtils.roleResource(TEST_CELL1, testBox1, ""), null); } finally { // Role? RoleUtils.delete(TEST_CELL1, TOKEN, testBox1, testRole); // Box1? BoxUtils.delete(TEST_CELL1, TOKEN, testBox1); } }
From source file:com.wabacus.system.component.application.report.configbean.crosslist.CrossListReportDynDatasetBean.java
private String getDynamicSelectCols(List<AbsCrossListReportColAndGroupBean> lstCrossColAndGroupBeans, Map<String, String> mAllSelectCols) { if (lstCrossColAndGroupBeans == null || lstCrossColAndGroupBeans.size() == 0) return ""; if (mAllSelectCols == null || mAllSelectCols.size() == 0) return ""; StringBuffer resultBuf = new StringBuffer(); String selectColsTmp;//w w w . ja va2 s .c om for (AbsCrossListReportColAndGroupBean colgroupBeanTmp : lstCrossColAndGroupBeans) { selectColsTmp = mAllSelectCols.get(colgroupBeanTmp.getRootCrossColGroupId()); if (selectColsTmp == null || selectColsTmp.trim().equals("")) continue; resultBuf.append(selectColsTmp).append(","); } if (resultBuf.length() > 0 && resultBuf.charAt(resultBuf.length() - 1) == ',') resultBuf.deleteCharAt(resultBuf.length() - 1); return resultBuf.toString(); }
From source file:com.fujitsu.dc.test.jersey.box.acl.AclTest.java
() { String testBox = "testBox_27481"; String testRole = "testRole_27481"; try {//from w w w. j a va2 s. c o m // Box?? BoxUtils.create(TEST_CELL1, testBox, TOKEN); // Box????Role?? RoleUtils.create(TEST_CELL1, TOKEN, testBox, testRole, HttpStatus.SC_CREATED); // Box??????Role?? RoleUtils.create(TEST_CELL1, TOKEN, null, testRole, HttpStatus.SC_CREATED); // Box?Box?????Role?ACL DavResourceUtils.setACLwithBox(TEST_CELL1, TOKEN, HttpStatus.SC_OK, testBox, "", ACL_SETTING_TEST, testRole, null, "<D:read/>", ""); // PROPFIND TResponse res = DavResourceUtils.propfind("box/propfind-box-allprop.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, testBox); // PROPFIND?? List<Map<String, List<String>>> list = new ArrayList<Map<String, List<String>>>(); Map<String, List<String>> map = new HashMap<String, List<String>>(); List<String> rolList = new ArrayList<String>(); rolList.add("read"); list.add(map); map.put("../__/" + testRole, rolList); Element root = res.bodyAsXml().getDocumentElement(); String resorce = UrlUtils.box(TEST_CELL1, testBox); // UrlUtil???URL????? StringBuffer sb = new StringBuffer(resorce); sb.deleteCharAt(resorce.length() - 1); TestMethodUtils.aclResponseTest(root, sb.toString(), list, 1, UrlUtils.roleResource(TEST_CELL1, testBox, ""), null); } finally { // Role?(Box?????) RoleUtils.delete(TEST_CELL1, TOKEN, testBox, testRole); // Role?(Box??????) RoleUtils.delete(TEST_CELL1, TOKEN, null, testRole); // Box? BoxUtils.delete(TEST_CELL1, TOKEN, testBox); } }
From source file:io.personium.test.jersey.box.acl.AclTest.java
() { String testBox1 = "testBox01"; String testRole = "testRole02"; try {//from www.ja v a2 s.c o m // Box?? BoxUtils.create(TEST_CELL1, testBox1, TOKEN); // Role?? RoleUtils.create(TEST_CELL1, TOKEN, testRole, testBox1, HttpStatus.SC_CREATED); // Box?Role?ACL DavResourceUtils.setACLwithRoleBaseUrl(TEST_CELL1, TOKEN, HttpStatus.SC_OK, testBox1, "", "box/acl-setting-baseurl.txt", UrlUtils.roleResource(TEST_CELL1, testBox1, testRole), "<D:read/>", ""); // PROPFIND TResponse res = DavResourceUtils.propfind("box/propfind-box-allprop.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, testBox1); // PROPFIND?? List<Map<String, List<String>>> list = new ArrayList<Map<String, List<String>>>(); Map<String, List<String>> map = new HashMap<String, List<String>>(); List<String> rolList = new ArrayList<String>(); rolList.add("read"); list.add(map); map.put(testRole, rolList); Element root = res.bodyAsXml().getDocumentElement(); String resorce = UrlUtils.box(TEST_CELL1, testBox1); // UrlUtil???URL????? StringBuffer sb = new StringBuffer(resorce); sb.deleteCharAt(resorce.length() - 1); TestMethodUtils.aclResponseTest(root, sb.toString(), list, 1, UrlUtils.roleResource(TEST_CELL1, testBox1, ""), null); } finally { // Role? RoleUtils.delete(TEST_CELL1, TOKEN, testRole, testBox1); // Box1? BoxUtils.delete(TEST_CELL1, TOKEN, testBox1); } }
From source file:io.personium.test.jersey.box.acl.AclTest.java
() { String testBox = "testBox_27481"; String testRole = "testRole_27481"; try {//www .j a v a 2 s.c o m // Box?? BoxUtils.create(TEST_CELL1, testBox, TOKEN); // Box????Role?? RoleUtils.create(TEST_CELL1, TOKEN, testRole, testBox, HttpStatus.SC_CREATED); // Box??????Role?? RoleUtils.create(TEST_CELL1, TOKEN, testRole, null, HttpStatus.SC_CREATED); // Box?Box?????Role?ACL DavResourceUtils.setACLwithBox(TEST_CELL1, TOKEN, HttpStatus.SC_OK, testBox, "", ACL_SETTING_TEST, testRole, null, "<D:read/>", ""); // PROPFIND TResponse res = DavResourceUtils.propfind("box/propfind-box-allprop.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, testBox); // PROPFIND?? List<Map<String, List<String>>> list = new ArrayList<Map<String, List<String>>>(); Map<String, List<String>> map = new HashMap<String, List<String>>(); List<String> rolList = new ArrayList<String>(); rolList.add("read"); list.add(map); map.put("../__/" + testRole, rolList); Element root = res.bodyAsXml().getDocumentElement(); String resorce = UrlUtils.box(TEST_CELL1, testBox); // UrlUtil???URL????? StringBuffer sb = new StringBuffer(resorce); sb.deleteCharAt(resorce.length() - 1); TestMethodUtils.aclResponseTest(root, sb.toString(), list, 1, UrlUtils.roleResource(TEST_CELL1, testBox, ""), null); } finally { // Role?(Box?????) RoleUtils.delete(TEST_CELL1, TOKEN, testRole, testBox); // Role?(Box??????) RoleUtils.delete(TEST_CELL1, TOKEN, testRole, null); // Box? BoxUtils.delete(TEST_CELL1, TOKEN, testBox); } }
From source file:org.opennms.netmgt.xmlrpcd.XmlrpcAnticipator.java
public synchronized void verifyAnticipated() { StringBuffer problems = new StringBuffer(); if (m_anticipated.size() > 0) { problems.append(m_anticipated.size() + " expected calls still outstanding:\n"); problems.append(listCalls("\t", m_anticipated)); }/* w w w .j a v a 2s . com*/ if (m_unanticipated.size() > 0) { problems.append(m_unanticipated.size() + " unanticipated calls received:\n"); problems.append(listCalls("\t", m_unanticipated)); } if (problems.length() > 0) { problems.deleteCharAt(problems.length() - 1); problems.insert(0, "XML-RPC Anticipator listening at port " + m_port + " has:\n"); throw new AssertionFailedError(problems.toString()); } }
From source file:org.beangle.security.core.userdetail.User.java
public String toString() { StringBuffer sb = new StringBuffer(); sb.append(super.toString()).append(": "); sb.append("Username: ").append(this.username).append("; "); sb.append("Password: [PROTECTED]; "); sb.append("Enabled: ").append(this.enabled).append("; "); sb.append("AccountExpired: ").append(this.accountExpired).append("; "); sb.append("credentialsExpired: ").append(this.credentialsExpired).append("; "); sb.append("AccountLocked: ").append(this.accountLocked).append("; "); if (!getAuthorities().isEmpty()) { sb.append("Granted Authorities: "); for (GrantedAuthority authority : getAuthorities()) { sb.append(authority.toString()).append(", "); }/*w w w . ja va 2 s . c o m*/ sb.deleteCharAt(sb.length() - 1); } else { sb.append("Not granted any authorities"); } return sb.toString(); }
From source file:com.yolanda.nohttp.BasicRequest.java
/** * Split joint non form data./* www . j ava2 s . c o m*/ * * @param paramMap param map. * @param encodeCharset charset. * @return string parameter combination, each key value on nails with {@code "&"} space. */ public static StringBuffer buildCommonParams(MultiValueMap<String, Object> paramMap, String encodeCharset) { StringBuffer paramBuffer = new StringBuffer(); Set<String> keySet = paramMap.keySet(); for (String key : keySet) { List<Object> values = paramMap.getValues(key); for (Object value : values) { if (value != null && value instanceof CharSequence) { paramBuffer.append("&"); try { paramBuffer.append(URLEncoder.encode(key, encodeCharset)); paramBuffer.append("="); paramBuffer.append(URLEncoder.encode(value.toString(), encodeCharset)); } catch (UnsupportedEncodingException e) { Logger.e("Encoding " + encodeCharset + " format is not supported by the system"); paramBuffer.append(key); paramBuffer.append("="); paramBuffer.append(value.toString()); } } } } if (paramBuffer.length() > 0) paramBuffer.deleteCharAt(0); return paramBuffer; }
From source file:com.fujitsu.dc.test.jersey.box.acl.AclTest.java
() { try {/* www .j av a 2 s .c o m*/ // Principal:all // Privilege:read?ACLbox1? DavResourceUtils.setACL(null, TOKEN, HttpStatus.SC_OK, TEST_CELL1 + "/" + BOX_NAME, ACL_ALL_TEST, null, "<D:read/>", ""); // PROPFIND?ACL?? TResponse tresponse = CellUtils.propfind(TEST_CELL1 + "/" + BOX_NAME, TOKEN, DEPTH, HttpStatus.SC_MULTI_STATUS); List<Map<String, List<String>>> list = new ArrayList<Map<String, List<String>>>(); Map<String, List<String>> map = new HashMap<String, List<String>>(); List<String> rolList = new ArrayList<String>(); rolList.add("all"); rolList.add("read"); list.add(map); Element root = tresponse.bodyAsXml().getDocumentElement(); String resorce = UrlUtils.box(TEST_CELL1, BOX_NAME); // UrlUtil???URL????? StringBuffer sb = new StringBuffer(resorce); sb.deleteCharAt(resorce.length() - 1); TestMethodUtils.aclResponseTest(root, sb.toString(), list, 1, UrlUtils.roleResource(TEST_CELL1, BOX_NAME, ""), null); // account1?box1? // ? JSONObject json = ResourceUtils.getLocalTokenByPassAuth(TEST_CELL1, "account1", "password1", -1); // ? String tokenStr = (String) json.get(OAuth2Helper.Key.ACCESS_TOKEN); // Box1???GET? ResourceUtils.accessResource("", tokenStr, HttpStatus.SC_OK, Setup.TEST_BOX1, TEST_CELL1); // ?box1???GET? ResourceUtils.accessResource("", "", HttpStatus.SC_OK, Setup.TEST_BOX1, TEST_CELL1); // AuthorizationHedder???box1???GET? ResourceUtils.accessResourceNoAuth("", HttpStatus.SC_OK, TEST_CELL1); // Box1???PUT??? DavResourceUtils.createWebDavFile(Setup.TEST_CELL1, tokenStr, "box/dav-put.txt", "hoge", Setup.TEST_BOX1, "text.txt", HttpStatus.SC_FORBIDDEN); // ?box1???PUT??? DavResourceUtils.createWebDavFile(Setup.TEST_CELL1, "", "box/dav-put.txt", "hoge", Setup.TEST_BOX1, "text.txt", HttpStatus.SC_UNAUTHORIZED); // AuthorizationHedder???box1???PUT??? DavResourceUtils.createWebDavFileNoAuthHeader(Setup.TEST_CELL1, "box/dav-put.txt", "hoge", Setup.TEST_BOX1, "text.txt", HttpStatus.SC_UNAUTHORIZED); } finally { // ? DavResourceUtils.deleteWebDavFile("box/dav-delete.txt", Setup.TEST_CELL1, TOKEN, "text.txt", -1, Setup.TEST_BOX1); // ACL??? Http.request("box/acl-authtest.txt") .with("cellPath", TEST_CELL1) .with("colname", "") .with("roleBaseUrl", UrlUtils.roleResource(TEST_CELL1, null, "")) .with("token", AbstractCase.MASTER_TOKEN_NAME) .with("level", "") .returns() .statusCode(HttpStatus.SC_OK); } }