http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/utils/ThriftDataModelConversion.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/utils/ThriftDataModelConversion.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/utils/ThriftDataModelConversion.java index 474fcf5..044e9af 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/utils/ThriftDataModelConversion.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/utils/ThriftDataModelConversion.java @@ -41,7 +41,7 @@ import java.util.List; public class ThriftDataModelConversion { private final static Logger logger = LoggerFactory.getLogger(ThriftDataModelConversion.class); - public static Project getProject (ProjectExperimentCatResource pr) throws RegistryException { + public static Project getProject (ProjectResource pr) throws RegistryException { if (pr != null) { Project project = new Project(); project.setProjectID(pr.getId()); @@ -51,10 +51,10 @@ public class ThriftDataModelConversion { } project.setDescription(pr.getDescription()); project.setOwner(pr.getWorker().getUser()); - List<ProjectUserExperimentCatResource> projectUserList = pr.getProjectUserList(); + List<ProjectUserResource> projectUserList = pr.getProjectUserList(); List<String> sharedUsers = new ArrayList<String>(); if (projectUserList != null && !projectUserList.isEmpty()){ - for (ProjectUserExperimentCatResource resource : projectUserList){ + for (ProjectUserResource resource : projectUserList){ sharedUsers.add(resource.getUserName()); } } @@ -64,7 +64,7 @@ public class ThriftDataModelConversion { return null; } - public static Gateway getGateway (GatewayExperimentCatResource resource){ + public static Gateway getGateway (GatewayResource resource){ Gateway gateway = new Gateway(); gateway.setGatewayId(resource.getGatewayId()); gateway.setGatewayName(resource.getGatewayName()); @@ -76,13 +76,13 @@ public class ThriftDataModelConversion { public static List<Gateway> getAllGateways (List<ExperimentCatResource> gatewayList){ List<Gateway> gateways = new ArrayList<Gateway>(); for (ExperimentCatResource resource : gatewayList){ - gateways.add(getGateway((GatewayExperimentCatResource)resource)); + gateways.add(getGateway((GatewayResource)resource)); } return gateways; } - public static Experiment getExperiment(ExperimentExperimentCatResource experimentResource) throws RegistryException { + public static Experiment getExperiment(ExperimentResource experimentResource) throws RegistryException { if (experimentResource != null){ Experiment experiment = new Experiment(); experiment.setProjectID(experimentResource.getProjectId()); @@ -97,34 +97,34 @@ public class ThriftDataModelConversion { experiment.setEnableEmailNotification(experimentResource.isEnableEmailNotifications()); experiment.setGatewayExecutionId(experimentResource.getGatewayExecutionId()); if (experiment.isEnableEmailNotification()){ - List<NotificationEmailExperimentCatResource> notificationEmails = experimentResource.getNotificationEmails(); + List<NotificationEmailResource> notificationEmails = experimentResource.getNotificationEmails(); experiment.setEmailAddresses(getEmailAddresses(notificationEmails)); } experiment.setWorkflowTemplateVersion(experimentResource.getWorkflowTemplateVersion()); experiment.setWorkflowExecutionInstanceId(experimentResource.getWorkflowExecutionId()); - List<ExperimentInputExperimentCatResource> experimentInputs = experimentResource.getExperimentInputs(); + List<ExperimentInputResource> experimentInputs = experimentResource.getExperimentInputs(); experiment.setExperimentInputs(getExpInputs(experimentInputs)); - List<ExperimentOutputExperimentCatResource> experimentOutputs = experimentResource.getExperimentOutputs(); + List<ExperimentOutputResource> experimentOutputs = experimentResource.getExperimentOutputs(); experiment.setExperimentOutputs(getExpOutputs(experimentOutputs)); - StatusExperimentCatResource experimentStatus = experimentResource.getExperimentStatus(); + StatusResource experimentStatus = experimentResource.getExperimentStatus(); if (experimentStatus != null){ experiment.setExperimentStatus(getExperimentStatus(experimentStatus)); } - List<StatusExperimentCatResource> changeList = experimentResource.getWorkflowNodeStatuses(); + List<StatusResource> changeList = experimentResource.getWorkflowNodeStatuses(); if (changeList != null && !changeList.isEmpty()){ experiment.setStateChangeList(getWorkflowNodeStatusList(changeList)); } - List<WorkflowNodeDetailExperimentCatResource> workflowNodeDetails = experimentResource.getWorkflowNodeDetails(); + List<WorkflowNodeDetailResource> workflowNodeDetails = experimentResource.getWorkflowNodeDetails(); if (workflowNodeDetails != null && !workflowNodeDetails.isEmpty()){ experiment.setWorkflowNodeDetailsList(getWfNodeList(workflowNodeDetails)); } - List<ErrorDetailExperimentCatResource> errorDetails = experimentResource.getErrorDetails(); + List<ErrorDetailResource> errorDetails = experimentResource.getErrorDetails(); if (errorDetails!= null && !errorDetails.isEmpty()){ experiment.setErrors(getErrorDetailList(errorDetails)); } if (experimentResource.isExists(ResourceType.CONFIG_DATA, experimentResource.getExpID())){ - ConfigDataExperimentCatResource userConfigData = experimentResource.getUserConfigData(experimentResource.getExpID()); + ConfigDataResource userConfigData = experimentResource.getUserConfigData(experimentResource.getExpID()); experiment.setUserConfigurationData(getUserConfigData(userConfigData)); } return experiment; @@ -132,7 +132,7 @@ public class ThriftDataModelConversion { return null; } - public static ExperimentSummary getExperimentSummary(ExperimentSummaryExperimentCatResource experimentSummaryResource) throws RegistryException { + public static ExperimentSummary getExperimentSummary(ExperimentSummaryResource experimentSummaryResource) throws RegistryException { if (experimentSummaryResource != null){ ExperimentSummary experimentSummary = new ExperimentSummary(); experimentSummary.setProjectID(experimentSummaryResource.getProjectID()); @@ -142,7 +142,7 @@ public class ThriftDataModelConversion { experimentSummary.setName(experimentSummaryResource.getExpName()); experimentSummary.setDescription(experimentSummaryResource.getDescription()); experimentSummary.setApplicationId(experimentSummaryResource.getApplicationId()); - StatusExperimentCatResource experimentStatus = experimentSummaryResource.getStatus(); + StatusResource experimentStatus = experimentSummaryResource.getStatus(); if (experimentStatus != null){ experimentSummary.setExperimentStatus(getExperimentStatus(experimentStatus)); } @@ -154,8 +154,8 @@ public class ThriftDataModelConversion { public static InputDataObjectType getInput(Object object){ if (object != null){ InputDataObjectType dataObjectType = new InputDataObjectType(); - if (object instanceof ExperimentInputExperimentCatResource){ - ExperimentInputExperimentCatResource expInput = (ExperimentInputExperimentCatResource) object; + if (object instanceof ExperimentInputResource){ + ExperimentInputResource expInput = (ExperimentInputResource) object; dataObjectType.setName(expInput.getExperimentKey()); dataObjectType.setValue(expInput.getValue()); if (expInput.getDataType() != null){ @@ -170,8 +170,8 @@ public class ThriftDataModelConversion { dataObjectType.setRequiredToAddedToCommandLine(expInput.getRequiredToCMD()); dataObjectType.setDataStaged(expInput.isDataStaged()); return dataObjectType; - }else if (object instanceof NodeInputExperimentCatResource){ - NodeInputExperimentCatResource nodeInputResource = (NodeInputExperimentCatResource)object; + }else if (object instanceof NodeInputResource){ + NodeInputResource nodeInputResource = (NodeInputResource)object; dataObjectType.setName(nodeInputResource.getInputKey()); dataObjectType.setValue(nodeInputResource.getValue()); if (nodeInputResource.getDataType() != null){ @@ -186,8 +186,8 @@ public class ThriftDataModelConversion { dataObjectType.setRequiredToAddedToCommandLine(nodeInputResource.getRequiredToCMD()); dataObjectType.setDataStaged(nodeInputResource.isDataStaged()); return dataObjectType; - }else if (object instanceof ApplicationInputExperimentCatResource){ - ApplicationInputExperimentCatResource inputResource = (ApplicationInputExperimentCatResource)object; + }else if (object instanceof ApplicationInputResource){ + ApplicationInputResource inputResource = (ApplicationInputResource)object; dataObjectType.setName(inputResource.getInputKey()); dataObjectType.setValue(inputResource.getValue()); if (inputResource.getDataType() != null){ @@ -212,8 +212,8 @@ public class ThriftDataModelConversion { public static OutputDataObjectType getOutput(Object object){ if (object != null){ OutputDataObjectType dataObjectType = new OutputDataObjectType(); - if (object instanceof ExperimentOutputExperimentCatResource){ - ExperimentOutputExperimentCatResource expOutput = (ExperimentOutputExperimentCatResource)object; + if (object instanceof ExperimentOutputResource){ + ExperimentOutputResource expOutput = (ExperimentOutputResource)object; dataObjectType.setName(expOutput.getExperimentKey()); dataObjectType.setValue(expOutput.getValue()); if (expOutput.getDataType() != null){ @@ -226,8 +226,8 @@ public class ThriftDataModelConversion { dataObjectType.setSearchQuery(expOutput.getSearchQuery()); dataObjectType.setApplicationArgument(expOutput.getAppArgument()); return dataObjectType; - }else if (object instanceof NodeOutputExperimentCatResource){ - NodeOutputExperimentCatResource nodeOutputResource = (NodeOutputExperimentCatResource)object; + }else if (object instanceof NodeOutputResource){ + NodeOutputResource nodeOutputResource = (NodeOutputResource)object; dataObjectType.setName(nodeOutputResource.getOutputKey()); dataObjectType.setValue(nodeOutputResource.getValue()); if (nodeOutputResource.getDataType() != null){ @@ -240,8 +240,8 @@ public class ThriftDataModelConversion { dataObjectType.setSearchQuery(nodeOutputResource.getSearchQuery()); dataObjectType.setApplicationArgument(nodeOutputResource.getAppArgument()); return dataObjectType; - }else if (object instanceof ApplicationOutputExperimentCatResource){ - ApplicationOutputExperimentCatResource outputResource = (ApplicationOutputExperimentCatResource)object; + }else if (object instanceof ApplicationOutputResource){ + ApplicationOutputResource outputResource = (ApplicationOutputResource)object; dataObjectType.setName(outputResource.getOutputKey()); dataObjectType.setValue(outputResource.getValue()); dataObjectType.setIsRequired(outputResource.isRequired()); @@ -261,20 +261,20 @@ public class ThriftDataModelConversion { return null; } - public static List<String> getEmailAddresses (List<NotificationEmailExperimentCatResource> resourceList){ + public static List<String> getEmailAddresses (List<NotificationEmailResource> resourceList){ List<String> emailAddresses = new ArrayList<String>(); if (resourceList != null && !resourceList.isEmpty()){ - for (NotificationEmailExperimentCatResource emailResource : resourceList){ + for (NotificationEmailResource emailResource : resourceList){ emailAddresses.add(emailResource.getEmailAddress()); } } return emailAddresses; } - public static List<InputDataObjectType> getExpInputs (List<ExperimentInputExperimentCatResource> exInputList){ + public static List<InputDataObjectType> getExpInputs (List<ExperimentInputResource> exInputList){ List<InputDataObjectType> expInputs = new ArrayList<InputDataObjectType>(); if (exInputList != null && !exInputList.isEmpty()){ - for (ExperimentInputExperimentCatResource inputResource : exInputList){ + for (ExperimentInputResource inputResource : exInputList){ InputDataObjectType exInput = getInput(inputResource); expInputs.add(exInput); } @@ -282,10 +282,10 @@ public class ThriftDataModelConversion { return expInputs; } - public static List<OutputDataObjectType> getExpOutputs (List<ExperimentOutputExperimentCatResource> experimentOutputResourceList){ + public static List<OutputDataObjectType> getExpOutputs (List<ExperimentOutputResource> experimentOutputResourceList){ List<OutputDataObjectType> exOutputs = new ArrayList<OutputDataObjectType>(); if (experimentOutputResourceList != null && !experimentOutputResourceList.isEmpty()){ - for (ExperimentOutputExperimentCatResource outputResource : experimentOutputResourceList){ + for (ExperimentOutputResource outputResource : experimentOutputResourceList){ OutputDataObjectType output = getOutput(outputResource); exOutputs.add(output); } @@ -293,10 +293,10 @@ public class ThriftDataModelConversion { return exOutputs; } - public static List<InputDataObjectType> getNodeInputs (List<NodeInputExperimentCatResource> nodeInputResources){ + public static List<InputDataObjectType> getNodeInputs (List<NodeInputResource> nodeInputResources){ List<InputDataObjectType> nodeInputs = new ArrayList<InputDataObjectType>(); if (nodeInputResources != null && !nodeInputResources.isEmpty()){ - for (NodeInputExperimentCatResource inputResource : nodeInputResources){ + for (NodeInputResource inputResource : nodeInputResources){ InputDataObjectType nodeInput = getInput(inputResource); nodeInputs.add(nodeInput); } @@ -304,10 +304,10 @@ public class ThriftDataModelConversion { return nodeInputs; } - public static List<OutputDataObjectType> getNodeOutputs (List<NodeOutputExperimentCatResource> nodeOutputResourceList){ + public static List<OutputDataObjectType> getNodeOutputs (List<NodeOutputResource> nodeOutputResourceList){ List<OutputDataObjectType> nodeOutputs = new ArrayList<OutputDataObjectType>(); if (nodeOutputResourceList != null && !nodeOutputResourceList.isEmpty()){ - for (NodeOutputExperimentCatResource outputResource : nodeOutputResourceList){ + for (NodeOutputResource outputResource : nodeOutputResourceList){ OutputDataObjectType output = getOutput(outputResource); nodeOutputs.add(output); } @@ -315,10 +315,10 @@ public class ThriftDataModelConversion { return nodeOutputs; } - public static List<InputDataObjectType> getApplicationInputs (List<ApplicationInputExperimentCatResource> applicationInputResources){ + public static List<InputDataObjectType> getApplicationInputs (List<ApplicationInputResource> applicationInputResources){ List<InputDataObjectType> appInputs = new ArrayList<InputDataObjectType>(); if (applicationInputResources != null && !applicationInputResources.isEmpty()){ - for (ApplicationInputExperimentCatResource inputResource : applicationInputResources){ + for (ApplicationInputResource inputResource : applicationInputResources){ InputDataObjectType appInput = getInput(inputResource); appInputs.add(appInput); } @@ -326,10 +326,10 @@ public class ThriftDataModelConversion { return appInputs; } - public static List<OutputDataObjectType> getApplicationOutputs (List<ApplicationOutputExperimentCatResource> outputResources){ + public static List<OutputDataObjectType> getApplicationOutputs (List<ApplicationOutputResource> outputResources){ List<OutputDataObjectType> appOutputs = new ArrayList<OutputDataObjectType>(); if (outputResources != null && !outputResources.isEmpty()){ - for (ApplicationOutputExperimentCatResource outputResource : outputResources){ + for (ApplicationOutputResource outputResource : outputResources){ OutputDataObjectType output = getOutput(outputResource); appOutputs.add(output); } @@ -337,7 +337,7 @@ public class ThriftDataModelConversion { return appOutputs; } - public static ExperimentStatus getExperimentStatus(StatusExperimentCatResource status){ + public static ExperimentStatus getExperimentStatus(StatusResource status){ if (status != null){ ExperimentStatus experimentStatus = new ExperimentStatus(); if (status.getState() == null || status.getState().equals("")){ @@ -350,7 +350,7 @@ public class ThriftDataModelConversion { return null; } - public static WorkflowNodeStatus getWorkflowNodeStatus (StatusExperimentCatResource status){ + public static WorkflowNodeStatus getWorkflowNodeStatus (StatusResource status){ if (status != null){ WorkflowNodeStatus workflowNodeStatus = new WorkflowNodeStatus(); if (status.getState() == null || status.getState().equals("")){ @@ -363,7 +363,7 @@ public class ThriftDataModelConversion { return null; } - public static TaskStatus getTaskStatus (StatusExperimentCatResource status){ + public static TaskStatus getTaskStatus (StatusResource status){ if (status != null){ TaskStatus taskStatus = new TaskStatus(); if (status.getState() == null || status.getState().equals("")){ @@ -376,7 +376,7 @@ public class ThriftDataModelConversion { return null; } - public static JobStatus getJobStatus (StatusExperimentCatResource status){ + public static JobStatus getJobStatus (StatusResource status){ if (status != null){ JobStatus jobStatus = new JobStatus(); if (status.getState() == null || status.getState().equals("")){ @@ -393,7 +393,7 @@ public class ThriftDataModelConversion { return null; } - public static TransferStatus getTransferStatus (StatusExperimentCatResource status){ + public static TransferStatus getTransferStatus (StatusResource status){ if (status != null){ TransferStatus transferStatus = new TransferStatus(); if (status.getState() == null || status.getState().equals("")){ @@ -406,7 +406,7 @@ public class ThriftDataModelConversion { return null; } - public static ApplicationStatus getApplicationStatus (StatusExperimentCatResource status){ + public static ApplicationStatus getApplicationStatus (StatusResource status){ if (status != null){ ApplicationStatus applicationStatus = new ApplicationStatus(); if (status.getState() == null || status.getState().equals("")){ @@ -419,30 +419,30 @@ public class ThriftDataModelConversion { return null; } - public static List<WorkflowNodeStatus> getWorkflowNodeStatusList(List<StatusExperimentCatResource> statuses){ + public static List<WorkflowNodeStatus> getWorkflowNodeStatusList(List<StatusResource> statuses){ List<WorkflowNodeStatus> wfNodeStatuses = new ArrayList<WorkflowNodeStatus>(); if (statuses != null && !statuses.isEmpty()){ - for (StatusExperimentCatResource statusResource : statuses){ + for (StatusResource statusResource : statuses){ wfNodeStatuses.add(getWorkflowNodeStatus(statusResource)); } } return wfNodeStatuses; } - public static WorkflowNodeDetails getWorkflowNodeDetails(WorkflowNodeDetailExperimentCatResource nodeDetailResource) throws RegistryException { + public static WorkflowNodeDetails getWorkflowNodeDetails(WorkflowNodeDetailResource nodeDetailResource) throws RegistryException { if (nodeDetailResource != null){ WorkflowNodeDetails wfNode = new WorkflowNodeDetails(); wfNode.setNodeInstanceId(nodeDetailResource.getNodeInstanceId()); wfNode.setCreationTime(nodeDetailResource.getCreationTime().getTime()); wfNode.setNodeName(nodeDetailResource.getNodeName()); - List<NodeInputExperimentCatResource> nodeInputs = nodeDetailResource.getNodeInputs(); + List<NodeInputResource> nodeInputs = nodeDetailResource.getNodeInputs(); wfNode.setNodeInputs(getNodeInputs(nodeInputs)); - List<NodeOutputExperimentCatResource> nodeOutputs = nodeDetailResource.getNodeOutputs(); + List<NodeOutputResource> nodeOutputs = nodeDetailResource.getNodeOutputs(); wfNode.setNodeOutputs(getNodeOutputs(nodeOutputs)); - List<TaskDetailExperimentCatResource> taskDetails = nodeDetailResource.getTaskDetails(); + List<TaskDetailResource> taskDetails = nodeDetailResource.getTaskDetails(); wfNode.setTaskDetailsList(getTaskDetailsList(taskDetails)); wfNode.setWorkflowNodeStatus(getWorkflowNodeStatus(nodeDetailResource.getWorkflowNodeStatus())); - List<ErrorDetailExperimentCatResource> errorDetails = nodeDetailResource.getErrorDetails(); + List<ErrorDetailResource> errorDetails = nodeDetailResource.getErrorDetails(); wfNode.setErrors(getErrorDetailList(errorDetails)); wfNode.setExecutionUnit(ExecutionUnit.valueOf(nodeDetailResource.getExecutionUnit())); wfNode.setExecutionUnitData(nodeDetailResource.getExecutionUnitData()); @@ -451,50 +451,50 @@ public class ThriftDataModelConversion { return null; } - public static List<WorkflowNodeDetails> getWfNodeList (List<WorkflowNodeDetailExperimentCatResource> resources) throws RegistryException { + public static List<WorkflowNodeDetails> getWfNodeList (List<WorkflowNodeDetailResource> resources) throws RegistryException { List<WorkflowNodeDetails> workflowNodeDetailsList = new ArrayList<WorkflowNodeDetails>(); if (resources != null && !resources.isEmpty()){ - for (WorkflowNodeDetailExperimentCatResource resource : resources){ + for (WorkflowNodeDetailResource resource : resources){ workflowNodeDetailsList.add(getWorkflowNodeDetails(resource)); } } return workflowNodeDetailsList; } - public static TaskDetails getTaskDetail (TaskDetailExperimentCatResource taskDetailResource) throws RegistryException { + public static TaskDetails getTaskDetail (TaskDetailResource taskDetailResource) throws RegistryException { if (taskDetailResource != null){ TaskDetails taskDetails = new TaskDetails(); String taskId = taskDetailResource.getTaskId(); taskDetails.setTaskID(taskId); taskDetails.setApplicationId(taskDetailResource.getApplicationId()); taskDetails.setApplicationVersion(taskDetailResource.getApplicationVersion()); - List<ApplicationInputExperimentCatResource> applicationInputs = taskDetailResource.getApplicationInputs(); + List<ApplicationInputResource> applicationInputs = taskDetailResource.getApplicationInputs(); taskDetails.setApplicationInputs(getApplicationInputs(applicationInputs)); - List<ApplicationOutputExperimentCatResource> applicationOutputs = taskDetailResource.getApplicationOutputs(); + List<ApplicationOutputResource> applicationOutputs = taskDetailResource.getApplicationOutputs(); taskDetails.setApplicationOutputs(getApplicationOutputs(applicationOutputs)); taskDetails.setEnableEmailNotification(taskDetailResource.isEnableEmailNotifications()); if (taskDetails.isEnableEmailNotification()){ - List<NotificationEmailExperimentCatResource> notificationEmails = taskDetailResource.getNotificationEmails(); + List<NotificationEmailResource> notificationEmails = taskDetailResource.getNotificationEmails(); taskDetails.setEmailAddresses(getEmailAddresses(notificationEmails)); } taskDetails.setApplicationDeploymentId(taskDetailResource.getApplicationDeploymentId()); if (taskDetailResource.isExists(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, taskId)){ - ComputationSchedulingExperimentCatResource computationScheduling = taskDetailResource.getComputationScheduling(taskId); + ComputationSchedulingResource computationScheduling = taskDetailResource.getComputationScheduling(taskId); taskDetails.setTaskScheduling(getComputationalResourceScheduling(computationScheduling)); } if (taskDetailResource.isExists(ResourceType.ADVANCE_INPUT_DATA_HANDLING, taskId)){ - AdvanceInputDataHandlingExperimentCatResource inputDataHandling = taskDetailResource.getInputDataHandling(taskId); + AdvanceInputDataHandlingResource inputDataHandling = taskDetailResource.getInputDataHandling(taskId); taskDetails.setAdvancedInputDataHandling(getAdvanceInputDataHandling(inputDataHandling)); } if (taskDetailResource.isExists(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, taskId)){ - AdvancedOutputDataHandlingExperimentCatResource outputDataHandling = taskDetailResource.getOutputDataHandling(taskId); + AdvancedOutputDataHandlingResource outputDataHandling = taskDetailResource.getOutputDataHandling(taskId); taskDetails.setAdvancedOutputDataHandling(getAdvanceOutputDataHandling(outputDataHandling)); } taskDetails.setTaskStatus(getTaskStatus(taskDetailResource.getTaskStatus())); - List<JobDetailExperimentCatResource> jobDetailList = taskDetailResource.getJobDetailList(); + List<JobDetailResource> jobDetailList = taskDetailResource.getJobDetailList(); taskDetails.setJobDetailsList(getJobDetailsList(jobDetailList)); taskDetails.setErrors(getErrorDetailList(taskDetailResource.getErrorDetailList())); taskDetails.setDataTransferDetailsList(getDataTransferlList(taskDetailResource.getDataTransferDetailList())); @@ -503,20 +503,20 @@ public class ThriftDataModelConversion { return null; } - public static List<TaskDetails> getTaskDetailsList (List<TaskDetailExperimentCatResource> resources) throws RegistryException { + public static List<TaskDetails> getTaskDetailsList (List<TaskDetailResource> resources) throws RegistryException { List<TaskDetails> taskDetailsList = new ArrayList<TaskDetails>(); if (resources != null && !resources.isEmpty()){ - for (TaskDetailExperimentCatResource resource : resources){ + for (TaskDetailResource resource : resources){ taskDetailsList.add(getTaskDetail(resource)); } } return taskDetailsList; } - public static List<JobDetails> getJobDetailsList(List<JobDetailExperimentCatResource> jobs) throws RegistryException { + public static List<JobDetails> getJobDetailsList(List<JobDetailResource> jobs) throws RegistryException { List<JobDetails> jobDetailsList = new ArrayList<JobDetails>(); if (jobs != null && !jobs.isEmpty()){ - for (JobDetailExperimentCatResource resource : jobs){ + for (JobDetailResource resource : jobs){ jobDetailsList.add(getJobDetail(resource)); } } @@ -524,19 +524,19 @@ public class ThriftDataModelConversion { } - public static JobDetails getJobDetail(JobDetailExperimentCatResource jobDetailResource) throws RegistryException { + public static JobDetails getJobDetail(JobDetailResource jobDetailResource) throws RegistryException { if (jobDetailResource != null){ JobDetails jobDetails = new JobDetails(); jobDetails.setJobID(jobDetailResource.getJobId()); jobDetails.setJobDescription(jobDetailResource.getJobDescription()); jobDetails.setCreationTime(jobDetailResource.getCreationTime().getTime()); - StatusExperimentCatResource jobStatus = jobDetailResource.getJobStatus(); + StatusResource jobStatus = jobDetailResource.getJobStatus(); jobDetails.setJobStatus(getJobStatus(jobStatus)); jobDetails.setJobName(jobDetailResource.getJobName()); jobDetails.setWorkingDir(jobDetailResource.getWorkingDir()); - StatusExperimentCatResource applicationStatus = jobDetailResource.getApplicationStatus(); + StatusResource applicationStatus = jobDetailResource.getApplicationStatus(); jobDetails.setApplicationStatus(getApplicationStatus(applicationStatus)); - List<ErrorDetailExperimentCatResource> errorDetails = jobDetailResource.getErrorDetails(); + List<ErrorDetailResource> errorDetails = jobDetailResource.getErrorDetails(); jobDetails.setErrors(getErrorDetailList(errorDetails)); jobDetails.setComputeResourceConsumed(jobDetailResource.getComputeResourceConsumed()); return jobDetails; @@ -544,7 +544,7 @@ public class ThriftDataModelConversion { return null; } - public static ErrorDetails getErrorDetails (ErrorDetailExperimentCatResource resource){ + public static ErrorDetails getErrorDetails (ErrorDetailResource resource){ if (resource != null){ ErrorDetails errorDetails = new ErrorDetails(); errorDetails.setErrorID(String.valueOf(resource.getErrorId())); @@ -560,17 +560,17 @@ public class ThriftDataModelConversion { return null; } - public static List<ErrorDetails> getErrorDetailList (List<ErrorDetailExperimentCatResource> errorDetailResources){ + public static List<ErrorDetails> getErrorDetailList (List<ErrorDetailResource> errorDetailResources){ List<ErrorDetails> errorDetailsList = new ArrayList<ErrorDetails>(); if (errorDetailResources != null && !errorDetailResources.isEmpty()){ - for (ErrorDetailExperimentCatResource errorDetailResource : errorDetailResources){ + for (ErrorDetailResource errorDetailResource : errorDetailResources){ errorDetailsList.add(getErrorDetails(errorDetailResource)); } } return errorDetailsList; } - public static DataTransferDetails getDataTransferDetail (DataTransferDetailExperimentCatResource resource) throws RegistryException { + public static DataTransferDetails getDataTransferDetail (DataTransferDetailResource resource) throws RegistryException { if (resource != null){ DataTransferDetails details = new DataTransferDetails(); details.setTransferID(resource.getTransferId()); @@ -582,10 +582,10 @@ public class ThriftDataModelConversion { return null; } - public static List<DataTransferDetails> getDataTransferlList (List<DataTransferDetailExperimentCatResource> resources) throws RegistryException { + public static List<DataTransferDetails> getDataTransferlList (List<DataTransferDetailResource> resources) throws RegistryException { List<DataTransferDetails> transferDetailsList = new ArrayList<DataTransferDetails>(); if (resources != null && !resources.isEmpty()){ - for (DataTransferDetailExperimentCatResource resource : resources){ + for (DataTransferDetailResource resource : resources){ transferDetailsList.add(getDataTransferDetail(resource)); } } @@ -593,7 +593,7 @@ public class ThriftDataModelConversion { } - public static UserConfigurationData getUserConfigData (ConfigDataExperimentCatResource resource) throws RegistryException { + public static UserConfigurationData getUserConfigData (ConfigDataResource resource) throws RegistryException { if (resource != null){ UserConfigurationData data = new UserConfigurationData(); data.setAiravataAutoSchedule(resource.isAiravataAutoSchedule()); @@ -602,25 +602,25 @@ public class ThriftDataModelConversion { data.setUserDN(resource.getUserDn()); data.setGenerateCert(resource.isGenerateCert()); String expID = resource.getExperimentId(); - ExperimentExperimentCatResource experimentResource = new ExperimentExperimentCatResource(); + ExperimentResource experimentResource = new ExperimentResource(); experimentResource.setExpID(expID); if (experimentResource.isExists(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, expID)){ - ComputationSchedulingExperimentCatResource computationScheduling = experimentResource.getComputationScheduling(expID); + ComputationSchedulingResource computationScheduling = experimentResource.getComputationScheduling(expID); data.setComputationalResourceScheduling(getComputationalResourceScheduling(computationScheduling)); } if (experimentResource.isExists(ResourceType.ADVANCE_INPUT_DATA_HANDLING, expID)){ - AdvanceInputDataHandlingExperimentCatResource inputDataHandling = experimentResource.getInputDataHandling(expID); + AdvanceInputDataHandlingResource inputDataHandling = experimentResource.getInputDataHandling(expID); data.setAdvanceInputDataHandling(getAdvanceInputDataHandling(inputDataHandling)); } if (experimentResource.isExists(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, expID)){ - AdvancedOutputDataHandlingExperimentCatResource outputDataHandling = experimentResource.getOutputDataHandling(expID); + AdvancedOutputDataHandlingResource outputDataHandling = experimentResource.getOutputDataHandling(expID); data.setAdvanceOutputDataHandling(getAdvanceOutputDataHandling(outputDataHandling)); } if (experimentResource.isExists(ResourceType.QOS_PARAM, expID)){ - QosParamExperimentCatResource qoSparams = experimentResource.getQOSparams(expID); + QosParamResource qoSparams = experimentResource.getQOSparams(expID); data.setQosParams(getQOSParams(qoSparams)); } return data; @@ -629,7 +629,7 @@ public class ThriftDataModelConversion { } - public static ComputationalResourceScheduling getComputationalResourceScheduling (ComputationSchedulingExperimentCatResource csr){ + public static ComputationalResourceScheduling getComputationalResourceScheduling (ComputationSchedulingResource csr){ if (csr != null){ ComputationalResourceScheduling scheduling = new ComputationalResourceScheduling(); scheduling.setResourceHostId(csr.getResourceHostId()); @@ -647,7 +647,7 @@ public class ThriftDataModelConversion { return null; } - public static AdvancedInputDataHandling getAdvanceInputDataHandling(AdvanceInputDataHandlingExperimentCatResource adhr){ + public static AdvancedInputDataHandling getAdvanceInputDataHandling(AdvanceInputDataHandlingResource adhr){ if (adhr != null){ AdvancedInputDataHandling adih = new AdvancedInputDataHandling(); adih.setStageInputFilesToWorkingDir(adhr.isStageInputFiles()); @@ -659,7 +659,7 @@ public class ThriftDataModelConversion { return null; } - public static AdvancedOutputDataHandling getAdvanceOutputDataHandling(AdvancedOutputDataHandlingExperimentCatResource adodh){ + public static AdvancedOutputDataHandling getAdvanceOutputDataHandling(AdvancedOutputDataHandlingResource adodh){ if (adodh != null){ AdvancedOutputDataHandling outputDataHandling = new AdvancedOutputDataHandling(); outputDataHandling.setOutputDataDir(adodh.getOutputDataDir()); @@ -670,7 +670,7 @@ public class ThriftDataModelConversion { return null; } - public static QualityOfServiceParams getQOSParams (QosParamExperimentCatResource qos){ + public static QualityOfServiceParams getQOSParams (QosParamResource qos){ if (qos != null){ QualityOfServiceParams qosParams = new QualityOfServiceParams(); qosParams.setStartExecutionAt(qos.getStartExecutionAt());
http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/resources/META-INF/experiment-catalog.xml ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/resources/META-INF/experiment-catalog.xml b/modules/registry/registry-core/src/main/resources/META-INF/experiment-catalog.xml deleted file mode 100644 index d854c5d..0000000 --- a/modules/registry/registry-core/src/main/resources/META-INF/experiment-catalog.xml +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0"?> -<!--* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF 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. - * -* --> -<persistence xmlns="http://java.sun.com/xml/ns/persistence" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"> - <persistence-unit name="experiment_data"> - <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> - <class>org.apache.airavata.registry.core.experiment.catalog.model.Gateway</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.Configuration</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.Users</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.Gateway_Worker</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.Project</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.ProjectUser</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.Experiment</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.Notification_Email</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.Experiment_Input</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.Experiment_Output</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.WorkflowNodeDetail</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.TaskDetail</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.ErrorDetail</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.ApplicationInput</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.ApplicationOutput</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.NodeInput</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.NodeOutput</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.JobDetail</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.DataTransferDetail</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.Status</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.ExperimentConfigData</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.Computational_Resource_Scheduling</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.AdvancedInputDataHandling</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.AdvancedOutputDataHandling</class> - <class>org.apache.airavata.registry.core.experiment.catalog.model.QosParam</class> - <exclude-unlisted-classes>true</exclude-unlisted-classes> - <!--properties> - <property name="openjpa.ConnectionURL" - value="jdbc:mysql://localhost:3306/persitant_data" /> - <property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver" /> - <property name="openjpa.ConnectionUserName" value="airavata" /> - <property name="openjpa.ConnectionPassword" value="airavata" /> - <property name="openjpa.DynamicEnhancementAgent" value="true" /> - <property name="openjpa.RuntimeUnenhancedClasses" value="supported" /> - <property name="openjpa.Log" value="SQL=TRACE" /> - <property name="openjpa.ConnectionFactoryProperties" - value="PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=60000" /> - </properties--> - </persistence-unit> -</persistence> http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml b/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml index dc74376..438aab4 100644 --- a/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml +++ b/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml @@ -64,4 +64,33 @@ <class>org.apache.airavata.registry.core.app.catalog.model.Configuration</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> </persistence-unit> + <persistence-unit name="experiment_data"> + <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> + <class>org.apache.airavata.registry.core.experiment.catalog.model.Gateway</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.Configuration</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.Users</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.Gateway_Worker</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.Project</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.ProjectUser</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.Experiment</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.Notification_Email</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.Experiment_Input</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.Experiment_Output</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.WorkflowNodeDetail</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.TaskDetail</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.ErrorDetail</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.ApplicationInput</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.ApplicationOutput</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.NodeInput</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.NodeOutput</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.JobDetail</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.DataTransferDetail</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.Status</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.ExperimentConfigData</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.Computational_Resource_Scheduling</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.AdvancedInputDataHandling</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.AdvancedOutputDataHandling</class> + <class>org.apache.airavata.registry.core.experiment.catalog.model.QosParam</class> + <exclude-unlisted-classes>true</exclude-unlisted-classes> + </persistence-unit> </persistence> http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/AbstractResourceTest.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/AbstractResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/AbstractResourceTest.java index 14bde6e..dc5501c 100644 --- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/AbstractResourceTest.java +++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/AbstractResourceTest.java @@ -19,14 +19,14 @@ * */ -package org.apache.airavata.registry.core.experiment.catalog; +package org.apache.airavata.experiment.catalog; import org.apache.airavata.common.utils.ServerSettings; -import org.apache.airavata.registry.core.experiment.catalog.util.Initialize; +import org.apache.airavata.experiment.catalog.util.Initialize; import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils; import org.apache.airavata.registry.core.experiment.catalog.resources.*; -import org.apache.airavata.registry.core.experiment.catalog.resources.GatewayExperimentCatResource; -import org.apache.airavata.registry.core.experiment.catalog.resources.WorkerExperimentCatResource; +import org.apache.airavata.registry.core.experiment.catalog.resources.GatewayResource; +import org.apache.airavata.registry.core.experiment.catalog.resources.WorkerResource; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -36,23 +36,23 @@ import java.util.Calendar; public abstract class AbstractResourceTest { - private GatewayExperimentCatResource gatewayResource; - private WorkerExperimentCatResource workerResource; - private UserExperimentCatResource userResource; - private ProjectExperimentCatResource projectResource; + private GatewayResource gatewayResource; + private WorkerResource workerResource; + private UserResource userResource; + private ProjectResource projectResource; private static Initialize initialize; @BeforeClass public static void setUpBeforeClass() throws Exception { - initialize = new Initialize("registry-derby.sql"); + initialize = new Initialize("expcatalog-derby.sql"); initialize.initializeDB(); } @Before public void setUp() throws Exception { - gatewayResource = (GatewayExperimentCatResource) ExpCatResourceUtils.getGateway(ServerSettings.getDefaultUserGateway()); - workerResource = (WorkerExperimentCatResource) ExpCatResourceUtils.getWorker(gatewayResource.getGatewayName(), ServerSettings.getDefaultUser()); - userResource = (UserExperimentCatResource) ExpCatResourceUtils.getUser(ServerSettings.getDefaultUser()); + gatewayResource = (GatewayResource) ExpCatResourceUtils.getGateway(ServerSettings.getDefaultUserGateway()); + workerResource = (WorkerResource) ExpCatResourceUtils.getWorker(gatewayResource.getGatewayName(), ServerSettings.getDefaultUser()); + userResource = (UserResource) ExpCatResourceUtils.getUser(ServerSettings.getDefaultUser()); projectResource = workerResource.getProject("default"); } @@ -67,23 +67,23 @@ public abstract class AbstractResourceTest { } - public GatewayExperimentCatResource getGatewayResource() { + public GatewayResource getGatewayResource() { return gatewayResource; } - public WorkerExperimentCatResource getWorkerResource() { + public WorkerResource getWorkerResource() { return workerResource; } - public UserExperimentCatResource getUserResource() { + public UserResource getUserResource() { return userResource; } - public ProjectExperimentCatResource getProjectResource() { + public ProjectResource getProjectResource() { return projectResource; } - public void setProjectResource(ProjectExperimentCatResource projectResource) { + public void setProjectResource(ProjectResource projectResource) { this.projectResource = projectResource; } http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java index d6f0191..9b9e945 100644 --- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java +++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java @@ -19,11 +19,11 @@ * */ -package org.apache.airavata.registry.core.experiment.catalog; +package org.apache.airavata.experiment.catalog; import org.apache.airavata.registry.core.experiment.catalog.ResourceType; -import org.apache.airavata.registry.core.experiment.catalog.resources.ComputationSchedulingExperimentCatResource; -import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentExperimentCatResource; +import org.apache.airavata.registry.core.experiment.catalog.resources.ComputationSchedulingResource; +import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentResource; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -36,15 +36,15 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; public class ComputationalSchedulingTest extends AbstractResourceTest { - private ExperimentExperimentCatResource experimentResource; - private ComputationSchedulingExperimentCatResource schedulingResource; + private ExperimentResource experimentResource; + private ComputationSchedulingResource schedulingResource; private String experimentID = "testExpID"; @Override @Before public void setUp() throws Exception { super.setUp(); - experimentResource = (ExperimentExperimentCatResource) getGatewayResource().create(ResourceType.EXPERIMENT); + experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT); experimentResource.setExpID(experimentID); experimentResource.setExecutionUser(getWorkerResource().getUser()); experimentResource.setProjectId(getProjectResource().getId()); @@ -56,7 +56,7 @@ public class ComputationalSchedulingTest extends AbstractResourceTest { experimentResource.setExpName("TestExperiment"); experimentResource.save(); - schedulingResource = (ComputationSchedulingExperimentCatResource)experimentResource.create(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING); + schedulingResource = (ComputationSchedulingResource)experimentResource.create(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING); schedulingResource.setResourceHostId("testResource"); schedulingResource.setCpuCount(10); schedulingResource.setNodeCount(5); http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationExperimentCatResourceTest.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationExperimentCatResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationExperimentCatResourceTest.java deleted file mode 100644 index 9636454..0000000 --- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationExperimentCatResourceTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF 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. -* -*/ - -package org.apache.airavata.registry.core.experiment.catalog; -import static org.junit.Assert.*; - -import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils; -import org.apache.airavata.registry.core.experiment.catalog.resources.ConfigurationExperimentCatResource; -import org.junit.After; -import org.junit.Test; - -import java.sql.Timestamp; -import java.util.Calendar; - -public class ConfigurationExperimentCatResourceTest extends AbstractResourceTest { - - @Override - public void setUp() throws Exception { - super.setUp(); - } - @Test - public void testSave() throws Exception { - ConfigurationExperimentCatResource configuration = ExpCatResourceUtils.createConfiguration("testConfigKey"); - configuration.setConfigVal("testConfigValue"); - Calendar calender = Calendar.getInstance(); - java.util.Date d = calender.getTime(); - Timestamp currentTime = new Timestamp(d.getTime()); - configuration.setExpireDate(currentTime); - configuration.setCategoryID("SYSTEM"); - configuration.save(); - - assertTrue("Configuration Save succuessful", ExpCatResourceUtils.isConfigurationExist("testConfigKey")); - //remove test configuration - ExpCatResourceUtils.removeConfiguration("testConfigKey"); - } - - @After - public void tearDown() throws Exception { - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java new file mode 100644 index 0000000..fdcc553 --- /dev/null +++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java @@ -0,0 +1,58 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF 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. +* +*/ + +package org.apache.airavata.experiment.catalog; +import static org.junit.Assert.*; + +import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils; +import org.apache.airavata.registry.core.experiment.catalog.resources.ConfigurationResource; +import org.junit.After; +import org.junit.Test; + +import java.sql.Timestamp; +import java.util.Calendar; + +public class ConfigurationResourceTest extends AbstractResourceTest { + + @Override + public void setUp() throws Exception { + super.setUp(); + } + @Test + public void testSave() throws Exception { + ConfigurationResource configuration = ExpCatResourceUtils.createConfiguration("testConfigKey"); + configuration.setConfigVal("testConfigValue"); + Calendar calender = Calendar.getInstance(); + java.util.Date d = calender.getTime(); + Timestamp currentTime = new Timestamp(d.getTime()); + configuration.setExpireDate(currentTime); + configuration.setCategoryID("SYSTEM"); + configuration.save(); + + assertTrue("Configuration Save succuessful", ExpCatResourceUtils.isConfigurationExist("testConfigKey")); + //remove test configuration + ExpCatResourceUtils.removeConfiguration("testConfigKey"); + } + + @After + public void tearDown() throws Exception { + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentCatalogUseCaseTest.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentCatalogUseCaseTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentCatalogUseCaseTest.java deleted file mode 100644 index d66dd16..0000000 --- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentCatalogUseCaseTest.java +++ /dev/null @@ -1,296 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF 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. - * -*/ -package org.apache.airavata.registry.core.experiment.catalog; - -import junit.framework.Assert; -import org.apache.airavata.common.exception.ApplicationSettingsException; -import org.apache.airavata.common.utils.ServerSettings; -import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; -import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; -import org.apache.airavata.model.workspace.Project; -import org.apache.airavata.model.workspace.experiment.*; -import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory; -import org.apache.airavata.registry.core.experiment.catalog.util.Initialize; -import org.apache.airavata.registry.cpi.*; -import org.apache.airavata.registry.cpi.utils.Constants; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.sql.SQLException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -/** - * This class contains test cases for the RegistryImpl class which is the default registry - * implementation. These test cases are written from the perspective of the Airavata API - * such as creating/updating/deleting/searching projects and experiments etc. - */ -public class ExperimentCatalogUseCaseTest { - - private static ExperimentCatalog experimentCatalog; - private static Initialize initialize; - - @BeforeClass - public static void setupBeforeClass() throws RegistryException, SQLException { - initialize = new Initialize("registry-derby.sql"); - initialize.initializeDB(); - experimentCatalog = RegistryFactory.getDefaultRegistry(); - } - - @Test - public void testProject(){ - try { - String TAG = System.currentTimeMillis() + ""; - - String gatewayId = ServerSettings.getDefaultUserGateway(); - - //testing the creation of a project - Project project = new Project(); - project.setOwner("TestUser"+TAG); - project.setName("TestProject"+TAG); - project.setDescription("This is a test project"+TAG); - String projectId1 = (String) experimentCatalog.add(ExpCatParentDataType.PROJECT, project, gatewayId); - Assert.assertNotNull(projectId1); - - //testing the update of a project - Project updatedProject = new Project(); - updatedProject.setProjectID(projectId1); - updatedProject.setOwner("TestUser"+TAG); - updatedProject.setName("UpdatedTestProject"+TAG); - updatedProject.setDescription("This is an updated test project"+TAG); - experimentCatalog.update(ExperimentCatalogModelType.PROJECT, updatedProject, projectId1); - - //testing project retrieval - Project retrievedProject = (Project) experimentCatalog.get(ExperimentCatalogModelType.PROJECT, projectId1); - Assert.assertEquals(updatedProject.getProjectID(), retrievedProject.getProjectID()); - Assert.assertEquals(updatedProject.getOwner(), retrievedProject.getOwner()); - Assert.assertEquals(updatedProject.getName(), retrievedProject.getName()); - Assert.assertEquals(updatedProject.getDescription(), retrievedProject.getDescription()); - Assert.assertNotNull(retrievedProject.getCreationTime()); - //created user should be in the shared users list - Assert.assertTrue(retrievedProject.getSharedUsers().size()==1); - - //creating more projects for the same user - project = new Project(); - project.setOwner("TestUser"+TAG); - project.setName("Project Terrible"+TAG); - project.setDescription("This is a test project_2"+TAG); - String projectId2 = (String) experimentCatalog.add(ExpCatParentDataType.PROJECT, project, gatewayId); - Assert.assertNotNull(projectId2); - - project = new Project(); - project.setOwner("TestUser"+TAG); - project.setName("Project Funny"+TAG); - project.setDescription("This is a test project_3"+TAG); - String projectId3 = (String) experimentCatalog.add(ExpCatParentDataType.PROJECT, project, gatewayId); - Assert.assertNotNull(projectId3); - - project = new Project(); - project.setOwner("TestUser"+TAG); - project.setName("Project Stupid"+TAG); - project.setDescription("This is a test project_4"+TAG); - String projectId4 = (String) experimentCatalog.add(ExpCatParentDataType.PROJECT, project, gatewayId); - Assert.assertNotNull(projectId4); - - project = new Project(); - project.setOwner("TestUser"+TAG); - project.setName("Project Boring"+TAG); - project.setDescription("This is a test project_5"+TAG); - String projectId5 = (String) experimentCatalog.add(ExpCatParentDataType.PROJECT, project, gatewayId); - Assert.assertNotNull(projectId5); - - //test get all projects created by the user - List<Object> list = experimentCatalog.get(ExperimentCatalogModelType.PROJECT, - Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG); - Assert.assertTrue(list.size()==5); - - //search project by project name - Map<String, String> filters = new HashMap<String, String>(); - filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG); - filters.put(Constants.FieldConstants.ProjectConstants.PROJECT_NAME, "Terrible"+TAG); - list = experimentCatalog.search(ExperimentCatalogModelType.PROJECT, filters); - Assert.assertTrue(list.size()==1); - - //search project by project description - filters = new HashMap<String, String>(); - filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG); - filters.put(Constants.FieldConstants.ProjectConstants.DESCRIPTION, "test project_2"+TAG); - list = experimentCatalog.search(ExperimentCatalogModelType.PROJECT, filters); - Assert.assertTrue(list.size()==1); - - //search project with only ownername - filters = new HashMap<String, String>(); - filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG); - list = experimentCatalog.search(ExperimentCatalogModelType.PROJECT, filters); - Assert.assertTrue(list.size()==5); - - //search projects with pagination - filters = new HashMap<String, String>(); - filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG); - list = experimentCatalog.search(ExperimentCatalogModelType.PROJECT, filters, 2, 2, - Constants.FieldConstants.ProjectConstants.CREATION_TIME, ResultOrderType.DESC); - Assert.assertTrue(list.size()==2); - Project project1 = (Project)list.get(0); - Project project2 = (Project)list.get(1); - Assert.assertTrue(project1.getCreationTime()-project2.getCreationTime() > 0); - } catch (RegistryException e) { - e.printStackTrace(); - Assert.fail(); - } catch (ApplicationSettingsException e) { - e.printStackTrace(); - } - } - - @Test - public void testExperiment(){ - try { - long time = System.currentTimeMillis(); - String TAG = time + ""; - - String gatewayId = ServerSettings.getDefaultUserGateway(); - - //creating project - Project project = new Project(); - project.setOwner("TestUser"+TAG); - project.setName("TestProject"+TAG); - project.setDescription("This is a test project"+TAG); - String projectId1 = (String) experimentCatalog.add(ExpCatParentDataType.PROJECT, project, gatewayId); - Assert.assertNotNull(projectId1); - - //creating sample echo experiment. assumes echo application is already defined - InputDataObjectType inputDataObjectType = new InputDataObjectType(); - inputDataObjectType.setName("Input_to_Echo"); - inputDataObjectType.setValue("Hello World"); - - ComputationalResourceScheduling scheduling = new ComputationalResourceScheduling(); - scheduling.setResourceHostId(UUID.randomUUID().toString()); - scheduling.setComputationalProjectAccount("TG-STA110014S"); - scheduling.setTotalCPUCount(1); - scheduling.setNodeCount(1); - scheduling.setWallTimeLimit(15); - scheduling.setQueueName("normal"); - - UserConfigurationData userConfigurationData = new UserConfigurationData(); - userConfigurationData.setAiravataAutoSchedule(false); - userConfigurationData.setOverrideManualScheduledParams(false); - userConfigurationData.setComputationalResourceScheduling(scheduling); - - Experiment experiment = new Experiment(); - experiment.setProjectID(projectId1); - experiment.setUserName("TestUser" + TAG); - experiment.setName("TestExperiment"+TAG); - experiment.setDescription("Test 1 experiment"); - experiment.setApplicationId(UUID.randomUUID().toString()); - experiment.setUserConfigurationData(userConfigurationData); - experiment.addToExperimentInputs(inputDataObjectType); - - String experimentId1 = (String) experimentCatalog.add(ExpCatParentDataType.EXPERIMENT, experiment, gatewayId); - Assert.assertNotNull(experimentId1); - - //retrieving the stored experiment - Experiment retrievedExperiment = (Experiment) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT, - experimentId1); - Assert.assertNotNull(retrievedExperiment); - Assert.assertEquals(retrievedExperiment.getProjectID(), experiment.getProjectID()); - Assert.assertEquals(retrievedExperiment.getDescription(), experiment.getDescription()); - Assert.assertEquals(retrievedExperiment.getName(), experiment.getName()); - Assert.assertEquals(retrievedExperiment.getApplicationId(), experiment.getApplicationId()); - Assert.assertNotNull(retrievedExperiment.getUserConfigurationData()); - Assert.assertNotNull(retrievedExperiment.getExperimentInputs()); - - //updating an existing experiment - experiment.setName("NewExperimentName"+TAG); - OutputDataObjectType outputDataObjectType = new OutputDataObjectType(); - outputDataObjectType.setName("Output_to_Echo"); - outputDataObjectType.setValue("Hello World"); - experiment.addToExperimentOutputs(outputDataObjectType); - experimentCatalog.update(ExperimentCatalogModelType.EXPERIMENT, experiment, experimentId1); - - //creating more experiments - experiment = new Experiment(); - experiment.setProjectID(projectId1); - experiment.setUserName("TestUser" + TAG); - experiment.setName("TestExperiment2" + TAG); - experiment.setDescription("Test 2 experiment"); - experiment.setApplicationId(UUID.randomUUID().toString()); - experiment.setUserConfigurationData(userConfigurationData); - experiment.addToExperimentInputs(inputDataObjectType); - - String experimentId2 = (String) experimentCatalog.add(ExpCatParentDataType.EXPERIMENT, experiment, gatewayId); - Assert.assertNotNull(experimentId2); - - experiment = new Experiment(); - experiment.setProjectID(projectId1); - experiment.setUserName("TestUser" + TAG); - experiment.setName("TestExperiment3"+TAG); - experiment.setDescription("Test 3 experiment"); - experiment.setApplicationId(UUID.randomUUID().toString()); - experiment.setUserConfigurationData(userConfigurationData); - experiment.addToExperimentInputs(inputDataObjectType); - - String experimentId3 = (String) experimentCatalog.add(ExpCatParentDataType.EXPERIMENT, experiment, gatewayId); - Assert.assertNotNull(experimentId3); - - //searching experiments by - Map<String, String> filters = new HashMap<String, String>(); - filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, "TestUser" + TAG); - filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId); - filters.put(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_NAME, "Experiment2"); - filters.put(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_STATUS, ExperimentState.CREATED.toString()); - filters.put(Constants.FieldConstants.ExperimentConstants.FROM_DATE, time - 999999999 + ""); - filters.put(Constants.FieldConstants.ExperimentConstants.TO_DATE, time + 999999999 + ""); - List<Object> results = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT, filters); - Assert.assertTrue(results.size()==1); - - //retrieving all experiments in project - List<Object> list = experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT, - Constants.FieldConstants.ExperimentConstants.PROJECT_ID, projectId1); - Assert.assertTrue(list.size()==3); - - //searching all user experiments - filters = new HashMap(); - filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, "TestUser" + TAG); - filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId); - list = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT, filters); - Assert.assertTrue(list.size()==3); - - //searching user experiments with pagination - filters = new HashMap(); - filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, "TestUser" + TAG); - filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId); - list = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT, filters, 2, 1, - Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC); - Assert.assertTrue(list.size()==2); - ExperimentSummary exp1 = (ExperimentSummary)list.get(0); - ExperimentSummary exp2 = (ExperimentSummary)list.get(1); - Assert.assertTrue(exp1.getCreationTime()-exp2.getCreationTime() > 0); - - } catch (RegistryException e) { - e.printStackTrace(); - Assert.fail(); - } catch (ApplicationSettingsException e) { - e.printStackTrace(); - } - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentExperimentCatResourceTest.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentExperimentCatResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentExperimentCatResourceTest.java deleted file mode 100644 index e59d842..0000000 --- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentExperimentCatResourceTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF 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. -* -*/ - -package org.apache.airavata.registry.core.experiment.catalog; - -import static org.junit.Assert.*; - -import java.sql.Timestamp; -import java.util.Date; - -import org.apache.airavata.registry.core.experiment.catalog.ResourceType; -import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentExperimentCatResource; -import org.junit.After; -import org.junit.Test; - -public class ExperimentExperimentCatResourceTest extends AbstractResourceTest { - private ExperimentExperimentCatResource experimentResource; - private String experimentID = "testExpID"; - - @Override - public void setUp() throws Exception { - super.setUp(); - experimentResource = (ExperimentExperimentCatResource) getGatewayResource().create(ResourceType.EXPERIMENT); - experimentResource.setExpID(experimentID); - experimentResource.setExecutionUser(getWorkerResource().getUser()); - experimentResource.setProjectId(getProjectResource().getId()); - Timestamp currentDate = new Timestamp(new Date().getTime()); - experimentResource.setCreationTime(currentDate); - experimentResource.setApplicationId("testApplication"); - experimentResource.setApplicationVersion("1.0"); - experimentResource.setDescription("Test Application"); - experimentResource.setExpName("TestExperiment"); - experimentResource.save(); - } - - @Test - public void testCreate() throws Exception { - assertNotNull("experiment data resource has being created ", experimentResource); - } - - @Test - public void testSave() throws Exception { - assertTrue("experiment save successfully", getGatewayResource().isExists(ResourceType.EXPERIMENT, experimentID)); - } - - @Test - public void testGet() throws Exception { - assertNotNull("experiment data retrieved successfully", getGatewayResource().get(ResourceType.EXPERIMENT, experimentID)); - } - - @Test - public void testRemove() throws Exception { - getGatewayResource().remove(ResourceType.EXPERIMENT, experimentID); - assertFalse("experiment data removed successfully", getGatewayResource().isExists(ResourceType.EXPERIMENT, experimentID)); - } - - @After - public void tearDown() throws Exception { - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputExperimentCatResourceTest.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputExperimentCatResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputExperimentCatResourceTest.java deleted file mode 100644 index 0ec3566..0000000 --- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputExperimentCatResourceTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/* -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF 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. -* -*/ - -package org.apache.airavata.registry.core.experiment.catalog; - -import org.apache.airavata.registry.core.experiment.catalog.ResourceType; -import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentExperimentCatResource; -import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentInputExperimentCatResource; -import org.junit.After; -import org.junit.Test; - -import java.util.List; - -import static org.junit.Assert.assertTrue; - - -public class ExperimentInputExperimentCatResourceTest extends AbstractResourceTest { - private ExperimentExperimentCatResource experimentResource; - private String experimentID = "testExpID"; - ExperimentInputExperimentCatResource experimentInputResource; - - @Override - public void setUp() throws Exception { - super.setUp(); - experimentResource = (ExperimentExperimentCatResource) getGatewayResource().create(ResourceType.EXPERIMENT); - experimentResource.setExpID(experimentID); - experimentResource.setExecutionUser(getWorkerResource().getUser()); - experimentResource.setProjectId(getProjectResource().getId()); - experimentResource.setCreationTime(getCurrentTimestamp()); - experimentResource.setApplicationId("testApplication"); - experimentResource.setApplicationVersion("1.0"); - experimentResource.setDescription("Test Application"); - experimentResource.setExpName("TestExperiment"); - experimentResource.save(); - - experimentInputResource = (ExperimentInputExperimentCatResource)experimentResource.create(ResourceType.EXPERIMENT_INPUT); - experimentInputResource.setExperimentId(experimentID); - experimentInputResource.setExperimentKey("testKey"); - experimentInputResource.setValue("testValue"); - experimentInputResource.setDataType("string"); - experimentInputResource.save(); - } - - @Test - public void testSave() throws Exception { - assertTrue("Experiment Input saved successfully", experimentResource.isExists(ResourceType.EXPERIMENT_INPUT, experimentID)); - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testGet () throws Exception { - List<ExperimentInputExperimentCatResource> experimentInputs = experimentResource.getExperimentInputs(); - System.out.println("input counts : " + experimentInputs.size()); - assertTrue("Experiment input retrieved successfully...", experimentInputs.size() > 0); - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java new file mode 100644 index 0000000..aaf4f9d --- /dev/null +++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java @@ -0,0 +1,77 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF 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. +* +*/ + +package org.apache.airavata.experiment.catalog; + +import org.apache.airavata.registry.core.experiment.catalog.ResourceType; +import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentInputResource; +import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentResource; +import org.junit.After; +import org.junit.Test; + +import java.util.List; + +import static org.junit.Assert.assertTrue; + + +public class ExperimentInputResourceTest extends AbstractResourceTest { + private ExperimentResource experimentResource; + private String experimentID = "testExpID"; + ExperimentInputResource experimentInputResource; + + @Override + public void setUp() throws Exception { + super.setUp(); + experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT); + experimentResource.setExpID(experimentID); + experimentResource.setExecutionUser(getWorkerResource().getUser()); + experimentResource.setProjectId(getProjectResource().getId()); + experimentResource.setCreationTime(getCurrentTimestamp()); + experimentResource.setApplicationId("testApplication"); + experimentResource.setApplicationVersion("1.0"); + experimentResource.setDescription("Test Application"); + experimentResource.setExpName("TestExperiment"); + experimentResource.save(); + + experimentInputResource = (ExperimentInputResource)experimentResource.create(ResourceType.EXPERIMENT_INPUT); + experimentInputResource.setExperimentId(experimentID); + experimentInputResource.setExperimentKey("testKey"); + experimentInputResource.setValue("testValue"); + experimentInputResource.setDataType("string"); + experimentInputResource.save(); + } + + @Test + public void testSave() throws Exception { + assertTrue("Experiment Input saved successfully", experimentResource.isExists(ResourceType.EXPERIMENT_INPUT, experimentID)); + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testGet () throws Exception { + List<ExperimentInputResource> experimentInputs = experimentResource.getExperimentInputs(); + System.out.println("input counts : " + experimentInputs.size()); + assertTrue("Experiment input retrieved successfully...", experimentInputs.size() > 0); + } +}
