throw new UnsupportedException("Method not supported");
}
-
}
import org.argeo.slc.core.build.Distribution;\r
\r
/** An instance of a software system. */\r
-public interface DeployedSystem\r
- extends TargetData {\r
+public interface DeployedSystem extends TargetData {\r
public String getDeployedSystemId();\r
\r
public Distribution getDistribution();\r
public void setTargetData(TargetData targetData);\r
\r
public void setDeploymentData(DeploymentData deploymentData);\r
- \r
+\r
public void setDistribution(Distribution distribution);\r
\r
public void execute();\r
public interface ManageableDeployedSystem extends DeployedSystem {
public void start();
+
public void stop();
}
}\r
\r
@Override\r
- public SimpleSElement clone(){\r
+ public SimpleSElement clone() {\r
return new SimpleSElement(this);\r
}\r
\r
/** Gets the name part of the path. */\r
public String getName() {\r
int lastSep = getAsUniqueString().lastIndexOf(separator);\r
- return getAsUniqueString().substring(lastSep+1);\r
+ return getAsUniqueString().substring(lastSep + 1);\r
}\r
\r
/** Create a path without parent. */\r
private List<TreeSPath> activePaths;\r
\r
public <T extends StructureElement> T getElement(TreeSPath path) {\r
- return (T)elements.get(path);\r
+ return (T) elements.get(path);\r
}\r
\r
public List<StructureElement> listElements() {\r
import org.argeo.slc.core.structure.StructureElement;\r
import org.argeo.slc.core.structure.StructureRegistry;\r
\r
-public interface TreeSRelated extends StructureAware<TreeSPath>{\r
+public interface TreeSRelated extends StructureAware<TreeSPath> {\r
public TreeSPath getBasePath();\r
+\r
public StructureRegistry<TreeSPath> getRegistry();\r
+\r
public StructureElement getStructureElement(String key);\r
}\r
package org.argeo.slc.core.test;\r
\r
-\r
public class BasicTestData implements TestData {\r
private Object expected;\r
private Object reached;\r
import org.argeo.slc.core.SlcException;
public abstract class SlcTestUtils {
- public static String statusToString(Integer status){
- if(status.equals(TestStatus.PASSED)){
+ public static String statusToString(Integer status) {
+ if (status.equals(TestStatus.PASSED)) {
return TestStatus.STATUSSTR_PASSED;
- }
- else if(status.equals(TestStatus.FAILED)){
+ } else if (status.equals(TestStatus.FAILED)) {
return TestStatus.STATUSSTR_FAILED;
- }
- else if(status.equals(TestStatus.ERROR)){
+ } else if (status.equals(TestStatus.ERROR)) {
return TestStatus.STATUSSTR_ERROR;
- }
- else{
- throw new SlcException("Unrecognized status "+status);
+ } else {
+ throw new SlcException("Unrecognized status " + status);
}
}
-
- public static Integer stringToStatus(String statusStr){
- if(statusStr.equals(TestStatus.STATUSSTR_PASSED)){
+
+ public static Integer stringToStatus(String statusStr) {
+ if (statusStr.equals(TestStatus.STATUSSTR_PASSED)) {
return TestStatus.PASSED;
- }
- else if(statusStr.equals(TestStatus.STATUSSTR_FAILED)){
+ } else if (statusStr.equals(TestStatus.STATUSSTR_FAILED)) {
return TestStatus.FAILED;
- }
- else if(statusStr.equals(TestStatus.STATUSSTR_ERROR)){
+ } else if (statusStr.equals(TestStatus.STATUSSTR_ERROR)) {
return TestStatus.ERROR;
- }
- else{
- throw new SlcException("Unrecognized status string "+statusStr);
+ } else {
+ throw new SlcException("Unrecognized status string " + statusStr);
}
}
-
- private SlcTestUtils(){
-
+
+ private SlcTestUtils() {
+
}
}
/** Listener to the operations on a test result. */\r
public interface TestResultListener<T extends TestResult> {\r
/** Notified when a part was added to a test result. */\r
- public void resultPartAdded(T testResult,\r
- TestResultPart testResultPart);\r
+ public void resultPartAdded(T testResult, TestResultPart testResultPart);\r
\r
/** Stops listening and release the related resources. */\r
public void close(T testResult);\r
package org.argeo.slc.core.test;\r
\r
-\r
/**\r
* Part of a test result.\r
* \r
import org.argeo.slc.core.process.SlcExecutionAware;\r
\r
/** The actual run of a test */\r
-public interface TestRun extends SlcExecutionAware{\r
+public interface TestRun extends SlcExecutionAware {\r
/** Gets UUID */\r
public String getUuid();\r
\r
\r
public interface ParentContextAware extends ContextAware {\r
public Collection<ContextAware> getChildContexts();\r
+\r
public void addChildContext(ContextAware contextAware);\r
}\r
// If has a parent, sync it.\r
super.afterPropertiesSet();\r
} else {\r
- if(children.size()>0){\r
+ if (children.size() > 0) {\r
// No need to synchronize if no children\r
ContextUtils.synchronize(this);\r
}\r
* Complex implementation of a test result compatible with a tree based\r
* structure.\r
*/\r
-public class TreeTestResult implements TestResult, StructureAware<TreeSPath>,Comparable<TreeTestResult> {\r
+public class TreeTestResult implements TestResult, StructureAware<TreeSPath>,\r
+ Comparable<TreeTestResult> {\r
private Log log = LogFactory.getLog(TreeTestResult.class);\r
\r
private List<TestResultListener<TreeTestResult>> listeners = new Vector<TestResultListener<TreeTestResult>>();\r
}\r
index.close();\r
}\r
- log.info("Generated HTML test result report to "+reportDir);\r
+ log.info("Generated HTML test result report to " + reportDir);\r
}\r
\r
/**\r
\r
public interface SlcExecutionDao {\r
public void create(SlcExecution slcExecution);\r
+\r
public void update(SlcExecution slcExecution);\r
+\r
public SlcExecution getSlcExecution(String uuid);\r
+\r
public List<SlcExecution> listSlcExecutions();\r
}\r
\r
/** Updates an existing registry. */\r
public void update(TreeSRegistry registry);\r
- \r
+\r
/** Sync with local registry */\r
public void syncPath(TreeSRegistry registry,\r
StructureRegistry<TreeSPath> localRegistry, TreeSPath path);\r
\r
/** Lists all test results. */\r
public List<T> listTestResults();\r
- \r
\r
public void close(String id, Date closeDate);\r
}\r
\r
public interface TestRunDescriptorDao {\r
public TestRunDescriptor getTestRunDescriptor(String id);\r
+\r
public void saveOrUpdate(TestRunDescriptor testRunDescriptor);\r
}\r
/** The position of this issue. */\r
protected DiffKey key;\r
\r
- /** Constructor without key*/\r
+ /** Constructor without key */\r
public DiffIssueKey(DiffPosition position) {\r
super(position);\r
}\r
- \r
- /** Constructor with key*/\r
+\r
+ /** Constructor with key */\r
public DiffIssueKey(DiffPosition position, DiffKey key) {\r
super(position);\r
this.key = key;\r
public Object getKey() {\r
return key;\r
}\r
- \r
+\r
@Override\r
public String toString() {\r
if (key != null) {\r
this.reached = reached;\r
}\r
\r
- public DiffNotMatched(DiffPosition position, Object expected, Object reached, DiffKey key) {\r
+ public DiffNotMatched(DiffPosition position, Object expected,\r
+ Object reached, DiffKey key) {\r
super(position, key);\r
this.expected = expected;\r
this.reached = reached;\r
\r
@Override\r
public String toString() {\r
- String result = position + ": not matched " + expected + " <> " + reached;\r
+ String result = position + ": not matched " + expected + " <> "\r
+ + reached;\r
if (super.key != null) {\r
- result = result + " - Key: " + super.toString();\r
+ result = result + " - Key: " + super.toString();\r
}\r
- \r
+\r
return result;\r
}\r
\r
try {\r
return baseUrlRes.getURL();\r
} catch (IOException e) {\r
- throw new SlcException("Cannot get url from "+baseUrlRes,e);\r
+ throw new SlcException("Cannot get url from " + baseUrlRes, e);\r
}\r
}\r
\r
- public void setBaseUrlRes(Resource baseUrlRes){\r
+ public void setBaseUrlRes(Resource baseUrlRes) {\r
this.baseUrlRes = baseUrlRes;\r
}\r
- \r
- \r
- \r
+\r
public File getBaseLocation() {\r
return baseLocation;\r
}\r
\r
import org.argeo.slc.core.deploy.DeployedSystem;\r
\r
-public interface WebApplication extends DeployedSystem{\r
+public interface WebApplication extends DeployedSystem {\r
public URL getBaseUrl();\r
+\r
public File getRootLocation();\r
}\r
import org.dbunit.dataset.xml.FlatXmlDataSet;\r
import org.springframework.core.io.Resource;\r
\r
-public class DbUnitDeploymentData implements DeploymentData{\r
+public class DbUnitDeploymentData implements DeploymentData {\r
private Resource dataSetLocation;\r
\r
- public IDataSet createDataSet(){\r
+ public IDataSet createDataSet() {\r
try {\r
InputStream in = dataSetLocation.getInputStream();\r
IDataSet dataSet = new FlatXmlDataSet(in);\r
}\r
\r
}\r
- \r
+\r
public void setDataSetLocation(Resource dataSetLocation) {\r
this.dataSetLocation = dataSetLocation;\r
}\r
- \r
- \r
+\r
}\r
import javax.sql.DataSource;
-import org.argeo.slc.core.UnsupportedException;
-import org.argeo.slc.core.build.Distribution;
import org.argeo.slc.core.deploy.AbstractDeployedSystem;
-import org.argeo.slc.core.deploy.DeployedSystem;
-import org.argeo.slc.core.deploy.DeploymentData;
-import org.argeo.slc.core.deploy.TargetData;
public class SimpleJdbcDatabase extends AbstractDeployedSystem implements
JdbcAware {
TreeSPath path1 = new TreeSPath("/test");\r
TreeSPath path2 = new TreeSPath("/test");\r
assertEquals(path1, path2);\r
- \r
+\r
path1 = new TreeSPath("/test/subdir/anotherdir");\r
path2 = new TreeSPath("/test/subdir/anotherdir");\r
assertEquals(path1, path2);\r
- \r
+\r
path1 = new TreeSPath("/test/subdir/anotherd");\r
path2 = new TreeSPath("/test/subdir/anotherdir");\r
assertNotSame(path1, path2);\r
- \r
+\r
path1 = new TreeSPath("/test/subdir");\r
path2 = new TreeSPath("/test/subdir/anotherdir");\r
assertNotSame(path1, path2);\r
- \r
+\r
path1 = new TreeSPath("/test/subd/anotherdir");\r
path2 = new TreeSPath("/test/subdir/anotherdir");\r
assertNotSame(path1, path2);\r
}\r
- \r
- public void testCheckFormat(){\r
- try{\r
+\r
+ public void testCheckFormat() {\r
+ try {\r
new TreeSPath("hello");\r
fail("Bad format should be rejected");\r
- }catch(Exception e){\r
+ } catch (Exception e) {\r
// exception expected\r
}\r
- \r
- try{\r
+\r
+ try {\r
new TreeSPath("/");\r
fail("Bad format should be rejected");\r
- }catch(Exception e){\r
+ } catch (Exception e) {\r
// exception expected\r
}\r
- \r
+\r
assertEquals(new TreeSPath("/test"), new TreeSPath("/test/"));\r
- assertEquals(new TreeSPath("/test/dir"), new TreeSPath("//test///dir////"));\r
+ assertEquals(new TreeSPath("/test/dir"), new TreeSPath(\r
+ "//test///dir////"));\r
}\r
}\r