Repository: airavata Updated Branches: refs/heads/master 4ba83ccdb -> 3d3999a05
http://git-wip-us.apache.org/repos/asf/airavata/blob/3d3999a0/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/TestValidator.java ---------------------------------------------------------------------- diff --git a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/TestValidator.java b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/TestValidator.java index 30953e6..221c620 100644 --- a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/TestValidator.java +++ b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/TestValidator.java @@ -1,54 +1,54 @@ -/* - * - * 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.orchestrator.core.util; - -import org.apache.airavata.model.error.ValidationResults; -import org.apache.airavata.model.error.ValidatorResult; -import org.apache.airavata.model.experiment.ExperimentModel; -import org.apache.airavata.model.experiment.TaskDetails; -import org.apache.airavata.model.experiment.WorkflowNodeDetails; -import org.apache.airavata.orchestrator.core.exception.OrchestratorException; -import org.apache.airavata.orchestrator.core.validator.JobMetadataValidator; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class TestValidator implements JobMetadataValidator { - private final static Logger logger = LoggerFactory.getLogger(TestValidator.class); - - public ValidationResults validate(Experiment experiment, WorkflowNodeDetails workflowNodeDetail, TaskDetails taskID) { - ValidationResults validationResults = new ValidationResults(); - validationResults.setValidationState(true); - if (experiment.getProjectID() == null) { - logger.error("Project ID is not set"); - ValidatorResult validatorResult = new ValidatorResult(false); - validatorResult.setErrorDetails("Project ID is not set"); - validationResults.addToValidationResultList(validatorResult); - validationResults.setValidationState(false); - } else if (experiment.getExperimentID() == null) { - logger.error("This experiment is wrong, no experimentID set"); - ValidatorResult validatorResult = new ValidatorResult(false); - validatorResult.setErrorDetails("This experiment is wrong, no experimentID set"); - validationResults.addToValidationResultList(validatorResult); - validationResults.setValidationState(false); - } - return validationResults; - } -} +///* +// * +// * 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.orchestrator.core.util; +// +//import org.apache.airavata.model.error.ValidationResults; +//import org.apache.airavata.model.error.ValidatorResult; +//import org.apache.airavata.model.experiment.ExperimentModel; +//import org.apache.airavata.model.experiment.TaskDetails; +//import org.apache.airavata.model.experiment.WorkflowNodeDetails; +//import org.apache.airavata.orchestrator.core.exception.OrchestratorException; +//import org.apache.airavata.orchestrator.core.validator.JobMetadataValidator; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +// +//public class TestValidator implements JobMetadataValidator { +// private final static Logger logger = LoggerFactory.getLogger(TestValidator.class); +// +// public ValidationResults validate(Experiment experiment, WorkflowNodeDetails workflowNodeDetail, TaskDetails taskID) { +// ValidationResults validationResults = new ValidationResults(); +// validationResults.setValidationState(true); +// if (experiment.getProjectID() == null) { +// logger.error("Project ID is not set"); +// ValidatorResult validatorResult = new ValidatorResult(false); +// validatorResult.setErrorDetails("Project ID is not set"); +// validationResults.addToValidationResultList(validatorResult); +// validationResults.setValidationState(false); +// } else if (experiment.getExperimentID() == null) { +// logger.error("This experiment is wrong, no experimentID set"); +// ValidatorResult validatorResult = new ValidatorResult(false); +// validatorResult.setErrorDetails("This experiment is wrong, no experimentID set"); +// validationResults.addToValidationResultList(validatorResult); +// validationResults.setValidationState(false); +// } +// return validationResults; +// } +//} http://git-wip-us.apache.org/repos/asf/airavata/blob/3d3999a0/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/model/Job.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/model/Job.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/model/Job.java index 4943c3a..ae97ed2 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/model/Job.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/model/Job.java @@ -34,7 +34,7 @@ public class Job { private String jobId; private String taskId; private String processId; - private String jobDescription; + private char[] jobDescription; private Timestamp creationTime; private String computeResourceConsumed; private String jobName; @@ -72,13 +72,13 @@ public class Job { this.taskId = taskId; } - @Basic + @Lob @Column(name = "JOB_DESCRIPTION") - public String getJobDescription() { + public char[] getJobDescription() { return jobDescription; } - public void setJobDescription(String jobDescription) { + public void setJobDescription(char[] jobDescription) { this.jobDescription = jobDescription; } http://git-wip-us.apache.org/repos/asf/airavata/blob/3d3999a0/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/JobResource.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/JobResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/JobResource.java index 99a152d..10a8ced 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/JobResource.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/JobResource.java @@ -260,7 +260,9 @@ public class JobResource extends AbstractExpCatResource { job.setJobId(jobId); job.setTaskId(taskId); job.setProcessId(processId); -// job.setJobDescription(jobDescription); // fixme - Data too long for column 'JOB_DESCRIPTION' + if (jobDescription != null) { + job.setJobDescription(jobDescription.toCharArray()); + } job.setCreationTime(creationTime); job.setComputeResourceConsumed(computeResourceConsumed); job.setJobName(jobName); http://git-wip-us.apache.org/repos/asf/airavata/blob/3d3999a0/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java index 8fba449..d805116 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java @@ -651,7 +651,9 @@ public class Utils { jobResource.setProcessId(o.getProcessId()); jobResource.setTaskId(o.getTaskId()); jobResource.setCreationTime(o.getCreationTime()); - jobResource.setJobDescription(o.getJobDescription()); + if (o.getJobDescription() != null){ + jobResource.setJobDescription(new String(o.getJobDescription())); + } jobResource.setComputeResourceConsumed(o.getComputeResourceConsumed()); jobResource.setJobName(o.getJobName()); jobResource.setWorkingDir(o.getWorkingDir()); http://git-wip-us.apache.org/repos/asf/airavata/blob/3d3999a0/modules/registry/registry-core/src/main/resources/expcatalog-derby.sql ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/resources/expcatalog-derby.sql b/modules/registry/registry-core/src/main/resources/expcatalog-derby.sql index 18cb263..6ffe240 100644 --- a/modules/registry/registry-core/src/main/resources/expcatalog-derby.sql +++ b/modules/registry/registry-core/src/main/resources/expcatalog-derby.sql @@ -301,7 +301,7 @@ CREATE TABLE JOB ( JOB_ID varchar(255), TASK_ID varchar(255), PROCESS_ID varchar(255), - JOB_DESCRIPTION varchar(255), + JOB_DESCRIPTION CLOB NOT NULL, CREATION_TIME timestamp DEFAULT '0000-00-00 00:00:00', COMPUTE_RESOURCE_CONSUMED varchar(255), JOB_NAME varchar(255), http://git-wip-us.apache.org/repos/asf/airavata/blob/3d3999a0/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql b/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql index 35fa693..b09f315 100644 --- a/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql +++ b/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql @@ -303,7 +303,7 @@ CREATE TABLE JOB ( JOB_ID varchar(255), TASK_ID varchar(255), PROCESS_ID varchar(255), - JOB_DESCRIPTION varchar(255), + JOB_DESCRIPTION LONGTEXT NOT NULL, CREATION_TIME timestamp DEFAULT NOW(), COMPUTE_RESOURCE_CONSUMED varchar(255), JOB_NAME varchar(255), http://git-wip-us.apache.org/repos/asf/airavata/blob/3d3999a0/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/JobResourceTest.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/JobResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/JobResourceTest.java index 228b721..1bbf7d7 100644 --- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/JobResourceTest.java +++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/JobResourceTest.java @@ -73,9 +73,10 @@ public class JobResourceTest extends AbstractResourceTest{ taskResource.setSubTaskModel(new DataStagingTaskModel("source","destination").toString().getBytes()); taskResource.save(); - jobResource = (JobResource)taskResource.create(ResourceType.JOB); + jobResource = (JobResource)processResource.create(ResourceType.JOB); jobResource.setJobId(jobId); - taskResource.setTaskId(taskId); + jobResource.setProcessId(processId); + jobResource.setTaskId(taskId); jobResource.setJobDescription("Job Description"); jobResource.setComputeResourceConsumed("computer-resource-host"); jobResource.setJobName("JobName"); @@ -91,17 +92,17 @@ public class JobResourceTest extends AbstractResourceTest{ @Test public void testSave() throws Exception { - assertTrue("job save successfully", taskResource.isExists(ResourceType.JOB, jobId)); + assertTrue("job save successfully", processResource.isExists(ResourceType.JOB, jobId)); } @Test public void testGet() throws Exception { - assertNotNull("job data retrieved successfully", taskResource.get(ResourceType.JOB, jobId)); + assertNotNull("job data retrieved successfully", processResource.get(ResourceType.JOB, jobId)); } @Test public void testRemove() throws Exception { - taskResource.remove(ResourceType.JOB, jobId); - assertFalse("job data removed successfully", taskResource.isExists(ResourceType.JOB, jobId)); + processResource.remove(ResourceType.JOB, jobId); + assertFalse("job data removed successfully", processResource.isExists(ResourceType.JOB, jobId)); } } http://git-wip-us.apache.org/repos/asf/airavata/blob/3d3999a0/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ProcessResourceTest.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ProcessResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ProcessResourceTest.java index c2ed8f8..6349007 100644 --- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ProcessResourceTest.java +++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ProcessResourceTest.java @@ -77,6 +77,6 @@ public class ProcessResourceTest extends AbstractResourceTest{ @Test public void testRemove() throws Exception { experimentResource.remove(ResourceType.PROCESS, processId); - assertFalse("process data removed successfully", processResource.isExists(ResourceType.PROCESS, processId)); + assertFalse("process data removed successfully", experimentResource.isExists(ResourceType.PROCESS, processId)); } }
