Example usage for java.lang Integer toString

List of usage examples for java.lang Integer toString

Introduction

In this page you can find the example usage for java.lang Integer toString.

Prototype

public String toString() 

Source Link

Document

Returns a String object representing this Integer 's value.

Usage

From source file:com.evolveum.polygon.test.scim.StandardScimTestUtils.java

protected static Set<Attribute> userSingleValUpdateBuilder(Integer testNumber) {

    Set<Attribute> attributeSet = new HashSet<Attribute>();
    attributeSet.add(AttributeBuilder.build(NICKNAME, testNumber.toString()));

    attributeSet.add(AttributeBuilder.build(FAMILYNAME, "TestUpdate"));
    //   attributeSet.add(AttributeBuilder.build("externalId", testNumber.toString()));

    return attributeSet;

}

From source file:com.evolveum.polygon.test.scim.StandardScimTestUtils.java

protected static JSONObject userToConnIdSimulation(Integer testNumber) {
    JSONObject testJson = new JSONObject();

    StringBuilder buildUpdateEmailAdress = new StringBuilder(testNumber.toString())
            .append("testupdateuser@testdomain.com");

    JSONObject nameObject = new JSONObject();
    nameObject.put("givenName", JSONObject.NULL);
    nameObject.put("familyName", JSONObject.NULL);

    JSONArray emailArray = new JSONArray();

    JSONObject emailObject = new JSONObject();
    emailObject.put("value", buildUpdateEmailAdress.toString());
    emailObject.put("primary", true);

    emailArray.put(emailObject);//from www. ja  v  a 2  s .co m

    testJson.put("displayName", "");
    testJson.put("active", true);
    testJson.put("userName", buildUpdateEmailAdress.toString());

    testJson.put("nickName", testNumber.toString());
    testJson.put("emails", emailArray);
    testJson.put("name", nameObject);
    testJson.put("id", "123456789");

    return testJson;
}

From source file:com.gst.integrationtests.common.GroupHelper.java

public static void verifyGroupDeleted(final RequestSpecification requestSpec,
        final ResponseSpecification responseSpec, final Integer generatedGroupID) {
    List<String> list = new ArrayList<>();
    System.out//from w w  w  .j  a v  a  2 s  .c  o  m
            .println("------------------------------CHECK GROUP DELETED------------------------------------\n");
    final String GROUP_URL = "/fineract-provider/api/v1/groups/?" + Utils.TENANT_IDENTIFIER;
    list = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "pageItems");

    assertFalse("GROUP NOT DELETED", list.toString().contains("id=" + generatedGroupID.toString()));
}

From source file:com.aurel.track.admin.customize.lists.importList.ImportListBL.java

/**
 * Imports a list from an xml file/*from   w  w w. j  a v  a  2 s .  c  o  m*/
 * @param uploadFile
 * @return
 */
public static void importList(File uploadFile, String node, boolean overwriteExisting, boolean clearChildren) {
    ListOptionIDTokens listOptionIDTokens = ListBL.decodeNode(node);
    Integer repository = listOptionIDTokens.getRepository();
    Integer projectID = null;
    if (ListBL.REPOSITORY_TYPE.PROJECT == repository) {
        projectID = listOptionIDTokens.getProjectID();
    }
    boolean contained = false;
    Map<Integer, Integer> listObjectIdMap = new HashMap<Integer, Integer>();
    try {
        EntityImporter entityImporter = new EntityImporter();
        Map<String, String> extraAttributes = new HashMap<String, String>();
        if (projectID != null) {
            extraAttributes.put("project", projectID.toString());
            extraAttributes.put("repositoryType", TListBean.REPOSITORY_TYPE.PROJECT + "");
        } else {
            extraAttributes.put("project", null);
            extraAttributes.put("repositoryType", TListBean.REPOSITORY_TYPE.PUBLIC + "");
        }
        ImportContext importContext = new ImportContext();
        importContext.setEntityType("TListBean");
        importContext.setOverrideExisting(overwriteExisting);
        importContext.setClearChildren(clearChildren);
        importContext.setAttributeMap(extraAttributes);
        entityImporter.importFile(uploadFile, importContext);
    } catch (EntityImporterException e) {
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
        JSONUtility.encodeJSONFailure(e.getMessage());
    } catch (Exception e) {
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
        JSONUtility.encodeJSONFailure(e.getMessage());
    }
}

From source file:edu.umass.cs.gigapaxos.testing.TESTPaxosConfig.java

/**
 * FIXME: should not be public.// w  w w . ja  v  a  2 s  .  co  m
 * 
 * @param clientFacing
 * @return Paxos node config.
 */
public static NodeConfig<Integer> getFromPaxosConfig(final boolean clientFacing) {
    final NodeConfig<String> defaultNC = PaxosConfig.getDefaultNodeConfig();
    return new NodeConfig<Integer>() {

        @Override
        public Integer valueOf(String strValue) {
            return Integer.valueOf(strValue);
        }

        @Override
        public Set<Integer> getValuesFromStringSet(Set<String> strNodes) {
            throw new RuntimeException("Method not implemented");
        }

        @Override
        public Set<Integer> getValuesFromJSONArray(JSONArray array) throws JSONException {
            throw new RuntimeException("Method not implemented");
        }

        @Override
        public boolean nodeExists(Integer id) {
            return defaultNC.nodeExists(id.toString());
        }

        @Override
        public InetAddress getNodeAddress(Integer id) {
            return defaultNC.nodeExists(id.toString()) ? defaultNC.getNodeAddress(id.toString())
                    : nodeConfig.getNodeAddress(id);
            // SampleNodeConfig.getLocalAddress();
        }

        @Override
        public InetAddress getBindAddress(Integer id) {
            return this.getNodeAddress(id);
        }

        int clientPortOffset = PaxosConfig.getClientPortOffset();

        @Override
        public int getNodePort(Integer id) {
            int port = (defaultNC.nodeExists(id.toString()) ? defaultNC.getNodePort(id.toString())
                    : nodeConfig.getNodePort(id))
                    // adds to either of the two above
                    + (clientFacing ? clientPortOffset : 0);
            return port;
        }

        @Override
        public Set<Integer> getNodeIDs() {
            Set<String> nodes = defaultNC.getNodeIDs();
            Set<Integer> intIDs = new HashSet<Integer>();
            for (String s : nodes)
                intIDs.add(Integer.valueOf(s));
            for (int id : nodeConfig.getNodeIDs())
                intIDs.add(id);
            return intIDs;
        }

        public String toString() {
            String s = "";
            for (Integer id : this.getNodeIDs()) {
                s = (s + id + ":" + this.getNodeAddress(id) + ":" + this.getNodePort(id) + " ");
            }
            return s;
        }
    };
}

From source file:com.evolveum.polygon.test.scim.StandardScimTestUtils.java

private static Set<Attribute> userCreateBuilder(Integer testNumber) {

    StringBuilder testAttributeString = new StringBuilder();

    Set<Attribute> attributeSet = new HashSet<Attribute>();

    testAttributeString.append(testNumber.toString()).append("testusertestuser@testdomain.com");

    attributeSet.add(AttributeBuilder.build(USERNAME, testAttributeString.toString()));
    attributeSet.add(AttributeBuilder.build(NICKNAME, testAttributeString.toString()));

    attributeSet.add(AttributeBuilder.build(EMAILWORKVALUE, testAttributeString.toString()));
    attributeSet.add(AttributeBuilder.build(EMAILWORKPRIMARY, true));

    attributeSet.add(AttributeBuilder.build("title", "Mr."));
    attributeSet.add(AttributeBuilder.build(FAMILYNAME, "User"));
    attributeSet.add(AttributeBuilder.build("name.givenName", "Test"));

    attributeSet.add(AttributeBuilder.build(OperationalAttributes.ENABLE_NAME, true));

    return attributeSet;
}

From source file:com.google.enterprise.connector.sharepoint.TestConfiguration.java

/**
 * Returns a list of documents with the given webId and listId
 * //from  w ww .ja v a  2  s.c  o m
 * @param webId The web-id
 * @param listId The list-id
 * @return The list of documents
 */
public static List<SPDocument> getDocuments(WebState web, ListState list) {
    List<SPDocument> listOfDocs = new ArrayList<SPDocument>();

    Random r = new Random();

    for (int i = 0; i < 10; i++) {

        Integer docId = r.nextInt(200000);
        SPDocument doc = null;
        if (i % 3 == 0) {
            doc = new SPDocument(docId.toString(), "X", Calendar.getInstance(), ActionType.DELETE);
        } else {
            doc = new SPDocument(docId.toString(), "X", Calendar.getInstance(), ActionType.ADD);
        }
        doc.setParentWeb(web);
        doc.setParentList(list);

        listOfDocs.add(doc);
    }

    return listOfDocs;
}

From source file:com.gst.integrationtests.common.GroupHelper.java

public static void verifyGroupMembers(final RequestSpecification requestSpec,
        final ResponseSpecification responseSpec, final Integer generatedGroupID, final Integer groupMember) {
    List<String> list = new ArrayList<>();
    System.out//from w  ww  .  j  a va2  s.  c o m
            .println("------------------------------CHECK GROUP MEMBERS------------------------------------\n");
    final String GROUP_URL = "/fineract-provider/api/v1/groups/" + generatedGroupID
            + "?associations=clientMembers&" + Utils.TENANT_IDENTIFIER;
    list = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "clientMembers");
    assertTrue("ERROR IN GROUP MEMBER", list.toString().contains("id=" + groupMember.toString()));
}

From source file:com.cynertia.track.iCalendar.ICalendarSynchronizeAction.java

private static VEvent createEvent(Date startDate, Date endDate, String title, Integer itemID,
        String description, Integer responsibleID, VTimeZone tz) throws SocketException {
    VEvent issueEvent = new VEvent(new Date(startDate.getTime()), new Date(endDate.getTime()), title);

    // add timezone info..
    issueEvent.getProperties().add(tz.getTimeZoneId());

    // add description
    issueEvent.getProperties().add(new Description(description));

    // TODO: more adds

    // generate unique identifier..
    UidGenerator ug = new UidGenerator(itemID.toString());
    issueEvent.getProperties().add(ug.generateUid());

    //add organizer to method=PUBLISH for Outlook
    try {//w  ww .j  av a2  s. c om
        TPersonBean personBean = LookupContainer.getPersonBean(responsibleID);
        if (personBean != null) {
            String email = personBean.getEmail();
            if (email != null) {
                URI mailToURI = new URI("MAILTO", email, null);
                issueEvent.getProperties().add(new Organizer(mailToURI));
            }
        }
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        LOGGER.error(ExceptionUtils.getStackTrace(e));
    }
    return issueEvent;
}

From source file:com.evolveum.polygon.test.scim.StandardScimTestUtils.java

private static Filter getFilter(String filterType, String resourceName, Integer testNumber, Uid userTestUid,
        Uid groupTestUid) {/*from w w w .  j  a v  a 2  s . c  o m*/
    Filter filter = null;
    StringBuilder idName = new StringBuilder(testNumber.toString()).append(" ").append("test");
    if ("contains".equalsIgnoreCase(filterType)) {
        if (USERS.equals(resourceName)) {
            filter = (ContainsFilter) FilterBuilder
                    .contains(AttributeBuilder.build(USERNAME, testNumber.toString()));
        } else if (GROUPS.equals(resourceName)) {

            filter = (ContainsFilter) FilterBuilder
                    .contains(AttributeBuilder.build(DISPLAYNAME, testNumber.toString()));
        }
    } else if ("equals".equalsIgnoreCase(filterType)) {

        if (USERS.equals(resourceName)) {
            filter = (EqualsFilter) FilterBuilder
                    .equalTo(AttributeBuilder.build(USERNAME, testNumber.toString()));
        } else if (GROUPS.equals(resourceName)) {

            filter = (EqualsFilter) FilterBuilder
                    .equalTo(AttributeBuilder.build(DISPLAYNAME, idName.toString()));
        }
    } else if ("uid".equalsIgnoreCase(filterType)) {
        if (USERS.equals(resourceName)) {
            filter = (EqualsFilter) FilterBuilder.equalTo(userTestUid);
        } else if (GROUPS.equals(resourceName)) {
            filter = (EqualsFilter) FilterBuilder.equalTo(groupTestUid);
        }
    } else if ("startswith".equalsIgnoreCase(filterType)) {
        if (USERS.equals(resourceName)) {

            filter = (StartsWithFilter) FilterBuilder
                    .startsWith(AttributeBuilder.build(USERNAME, testNumber.toString()));
        } else if (GROUPS.equals(resourceName)) {

            filter = (StartsWithFilter) FilterBuilder
                    .startsWith(AttributeBuilder.build(DISPLAYNAME, testNumber.toString()));
        }

    } else if ("endswith".equalsIgnoreCase(filterType)) {
        if (USERS.equals(resourceName)) {
            filter = (EndsWithFilter) FilterBuilder
                    .endsWith(AttributeBuilder.build(USERNAME, "testdomain.com"));
        } else if (GROUPS.equals(resourceName)) {
            filter = (EndsWithFilter) FilterBuilder
                    .endsWith(AttributeBuilder.build(DISPLAYNAME, testNumber.toString()));
        }
    } else if ("or".equalsIgnoreCase(filterType)) {
        if (USERS.equals(resourceName)) {

            Filter leftFilter = (ContainsFilter) FilterBuilder
                    .contains(AttributeBuilder.build(USERNAME, testNumber.toString()));

            Filter rightFilter = (ContainsFilter) FilterBuilder
                    .contains(AttributeBuilder.build(USERNAME, "test"));

            filter = (OrFilter) FilterBuilder.or(leftFilter, rightFilter);

        } else if (GROUPS.equals(resourceName)) {

            Filter leftFilter = (ContainsFilter) FilterBuilder
                    .contains(AttributeBuilder.build(DISPLAYNAME, idName.toString()));

            Filter rightFilter = (ContainsFilter) FilterBuilder
                    .contains(AttributeBuilder.build(DISPLAYNAME, "test"));

            filter = (OrFilter) FilterBuilder.or(leftFilter, rightFilter);
        }
        // TODO check
    } else if ("and".equalsIgnoreCase(filterType)) {
        if (USERS.equals(resourceName)) {

            Filter leftFilter = (ContainsFilter) FilterBuilder
                    .contains(AttributeBuilder.build(USERNAME, testNumber.toString()));

            Filter rightFilter = (ContainsFilter) FilterBuilder
                    .contains(AttributeBuilder.build(USERNAME, testNumber.toString()));

            filter = (AndFilter) FilterBuilder.and(leftFilter, rightFilter);

        } else if (GROUPS.equals(resourceName)) {

            Filter leftFilter = (ContainsFilter) FilterBuilder
                    .contains(AttributeBuilder.build(DISPLAYNAME, idName.toString()));

            Filter rightFilter = (ContainsFilter) FilterBuilder
                    .contains(AttributeBuilder.build(DISPLAYNAME, idName.toString()));

            filter = (AndFilter) FilterBuilder.and(leftFilter, rightFilter);
        }
        // TODO check
    } else if ("containsall".equalsIgnoreCase(filterType)) {
        if (GROUPS.equals(resourceName)) {
            filter = (ContainsAllValuesFilter) FilterBuilder
                    .containsAllValues(AttributeBuilder.build(MEMBERSDEFAULT, userTestUid.getUidValue()));
        }
    }

    return filter;
}