From 09a2c484f0a3d9711fcc6321f0cb31f08ed148e3 Mon Sep 17 00:00:00 2001 From: nishadi Date: Sat, 24 Feb 2018 18:21:32 +0530 Subject: [PATCH] CommentMgtTestHelper Dummy data for comments Testing. --- .../services/util/CommentMgtTestHelper.java | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/test/java/org/wso2/carbon/device/application/mgt/store/api/services/util/CommentMgtTestHelper.java diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/test/java/org/wso2/carbon/device/application/mgt/store/api/services/util/CommentMgtTestHelper.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/test/java/org/wso2/carbon/device/application/mgt/store/api/services/util/CommentMgtTestHelper.java new file mode 100644 index 00000000000..bb019a0e1f1 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/test/java/org/wso2/carbon/device/application/mgt/store/api/services/util/CommentMgtTestHelper.java @@ -0,0 +1,59 @@ +package org.wso2.carbon.device.application.mgt.store.api.services.util; +/* + * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * you may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.wso2.carbon.device.application.mgt.common.Comment; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import static org.wso2.carbon.registry.core.jdbc.DumpConstants.UUID; + +/** + * Helper class for Comment Management API test cases. + */ + +public class CommentMgtTestHelper { + + private static final String COMMENT_TEXT = "Dummy Comment"; + private static final String CREATED_BY = "TEST_CREATED_BY"; + private static final String MODIFIED_BY="TEST_MODIFIED_BY"; + private static final int PARENT_ID=123; + private static final int COMMENT_ID=1; + + /** + * Creates a Comment with given text and given uuid. + * If the text is null, the COMMENT_TEXT will be used as the Dummy Comment. + * + * @param commentText : Text of the Comment + * @return Comment + */ + public static Comment getDummyComment(String commentText, String uuid) { + Comment comment = new Comment(); + comment.setId(COMMENT_ID); + comment.setCreatedBy(CREATED_BY); + comment.setModifiedBy(MODIFIED_BY); + comment.setParent(PARENT_ID); + comment.setComment(commentText != null ? commentText : COMMENT_TEXT); + + return comment; + } +} + +