Commit 77d15efc authored by Piotr Gawron's avatar Piotr Gawron
Browse files

new versioning system

parent 2fe8deba
minerva (11) stable; urgency=medium
minerva (11alpha) stable; urgency=medium
* Export to image without selecting region
......
<?xml version="1.0" encoding="UTF-8"?>
<project name="minerva" default="main" basedir=".">
<property environment="env"/>
<property name="build.dir" value="web/target" />
<property name="war.file" value="web-1.0.war" />
<property name="tomcat.home" value="${env.CATALINA_HOME}" />
<property name="tomcat.deploy.dir" value="${tomcat.home}/webapps" />
<condition property="isWindows">
<os family="windows" />
</condition>
<condition property="isUnix">
<os family="unix" />
</condition>
<target name="war-exists">
<available file="${tomcat.deploy.dir}/${ant.project.name}.war" property="war.exists"/>
</target>
<target name="remove-war" depends="war-exists" if="war.exists">
<delete file="${tomcat.deploy.dir}/${ant.project.name}.war" />
</target>
<target name="war-dir-exists">
<available file="${tomcat.deploy.dir}/${ant.project.name}" property="war-dir.exists" type="dir"/>
</target>
<target name="remove-war-dir" depends="war-dir-exists" if="war-dir.exists">
<delete dir="${tomcat.deploy.dir}/${ant.project.name}" />
</target>
<target name="deploy" depends="remove-war,remove-war-dir">
<copy file="${build.dir}/${war.file}" todir="${tomcat.deploy.dir}" />
<move file="${tomcat.deploy.dir}/${war.file}" tofile="${tomcat.deploy.dir}/${ant.project.name}.war"/>
</target>
<target name="main" depends="tomcat-stop,maven-build,deploy,tomcat-start">
</target>
<target name="all" depends="main">
</target>
<target name="tomcat-start">
<exec executable="${tomcat.home}/bin/startup.bat">
</exec>
</target>
<target name="tomcat-stop">
<exec executable="${tomcat.home}/bin/shutdown.bat">
</exec>
</target>
<target name="maven-build" depends="svnversion, maven-build-windows, maven-build-unix"/>
<target name="maven-build-windows" if="isWindows">
<exec dir="." executable="cmd" >
<arg line="/c mvn -Dmaven.test.skip=true clean install -pl web -am" />
</exec>
</target>
<target name="maven-build-unix" if="isUnix">
<exec dir="." executable="sh" >
<arg line="-c 'mvn -Dmaven.test.skip=true clean install -pl web -am'" />
</exec>
</target>
<target name="maven-test" depends="maven-test-windows, maven-test-unix"/>
<target name="maven-test-windows" depends="maven-build" if="isWindows">
<exec dir="." executable="cmd" >
<arg line="/c mvn test -fn" />
<!-- <arg line="/c mvn surefire-report:report" /> -->
</exec>
</target>
<target name="maven-test-unix" depends="maven-build" if="isUnix">
<exec dir="." executable="sh" >
<arg line="-c 'mvn test -fn'" />
<!-- <arg line="-c 'mvn surefire-report:report'" /> -->
</exec>
</target>
<target name="deployMapFiles">
<copy todir="${tomcat.deploy.dir}/map_images">
<fileset dir="map_images" />
</copy>
</target>
<target name="svnversion">
<exec executable="svnversion" outputproperty="svnversion" />
<tstamp>
<format property="build.time" pattern="dd/MM/yyyy HH:mm"
unit="hour"/>
</tstamp>
<echo >SVN Version: ${svnversion}
Build timestamp: ${build.time}</echo>
<echo file="web/src/main/webapp/svnversion.txt">${svnversion}
${build.time}</echo>
</target>
<target name="debian-pkg" depends="maven-build">
<exec executable="debian/create-debian-pkg.sh"/>
</target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project name="minerva" default="main" basedir=".">
<property environment="env"/>
<property name="build.dir" value="web/target" />
<property name="war.file" value="web-1.0.war" />
<property name="tomcat.home" value="${env.CATALINA_HOME}" />
<property name="tomcat.deploy.dir" value="${tomcat.home}/webapps" />
<condition property="isWindows">
<os family="windows" />
</condition>
<condition property="isUnix">
<os family="unix" />
</condition>
<target name="war-exists">
<available file="${tomcat.deploy.dir}/${ant.project.name}.war" property="war.exists"/>
</target>
<target name="remove-war" depends="war-exists" if="war.exists">
<delete file="${tomcat.deploy.dir}/${ant.project.name}.war" />
</target>
<target name="war-dir-exists">
<available file="${tomcat.deploy.dir}/${ant.project.name}" property="war-dir.exists" type="dir"/>
</target>
<target name="remove-war-dir" depends="war-dir-exists" if="war-dir.exists">
<delete dir="${tomcat.deploy.dir}/${ant.project.name}" />
</target>
<target name="deploy" depends="remove-war,remove-war-dir">
<copy file="${build.dir}/${war.file}" todir="${tomcat.deploy.dir}" />
<move file="${tomcat.deploy.dir}/${war.file}" tofile="${tomcat.deploy.dir}/${ant.project.name}.war"/>
</target>
<target name="main" depends="tomcat-stop,maven-build,deploy,tomcat-start">
</target>
<target name="all" depends="main">
</target>
<target name="tomcat-start">
<exec executable="${tomcat.home}/bin/startup.bat">
</exec>
</target>
<target name="tomcat-stop">
<exec executable="${tomcat.home}/bin/shutdown.bat">
</exec>
</target>
<target name="maven-build" depends="gitversion, maven-build-windows, maven-build-unix"/>
<target name="maven-build-windows" if="isWindows">
<exec dir="." executable="cmd" >
<arg line="/c mvn -Dmaven.test.skip=true clean install -pl web -am" />
</exec>
</target>
<target name="maven-build-unix" if="isUnix">
<exec dir="." executable="sh" >
<arg line="-c 'mvn -Dmaven.test.skip=true clean install -pl web -am'" />
</exec>
</target>
<target name="maven-test" depends="maven-test-windows, maven-test-unix"/>
<target name="maven-test-windows" depends="maven-build" if="isWindows">
<exec dir="." executable="cmd" >
<arg line="/c mvn test -fn" />
<!-- <arg line="/c mvn surefire-report:report" /> -->
</exec>
</target>
<target name="maven-test-unix" depends="maven-build" if="isUnix">
<exec dir="." executable="sh" >
<arg line="-c 'mvn test -fn'" />
<!-- <arg line="-c 'mvn surefire-report:report'" /> -->
</exec>
</target>
<target name="deployMapFiles">
<copy todir="${tomcat.deploy.dir}/map_images">
<fileset dir="map_images" />
</copy>
</target>
<target name="gitversion">
<exec executable="git" outputproperty="gitversion">
<arg value="rev-parse"/>
<arg value="HEAD"/>
</exec>
<tstamp>
<format property="build.time" pattern="dd/MM/yyyy HH:mm"
unit="hour"/>
</tstamp>
<echo >GIT Version: ${gitversion}
Build timestamp: ${build.time}</echo>
<echo file="web/src/main/webapp/version.txt">${gitversion}
${build.time}</echo>
<copy file="CHANGELOG" tofile="web/src/main/webapp/CHANGELOG" overwrite="true"/>
</target>
<target name="debian-pkg" depends="maven-build">
<exec executable="debian/create-debian-pkg.sh"/>
</target>
</project>
package lcsb.mapviewer.services.view;
import java.io.Serializable;
import lcsb.mapviewer.model.log.FrameworkVersion;
/**
* View representation of the {@link FrameworkVersion}. Contains information
* about single framework version.
*
* @author Piotr Gawron
*
*/
public class FrameworkVersionView extends AbstractView<FrameworkVersion> implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Version of the framework.
*/
private String version;
/**
* When this version was committed to svn.
*/
private String svnVersion;
/**
* Description (optional).
*/
private String description;
/**
* When the framework was built.
*/
private String time;
/**
* Is this a devel version of framework.
*/
private Boolean devel;
/**
* Default constructor.
*
* @param object
* {@link FrameworkVersion} representing original information
*/
protected FrameworkVersionView(FrameworkVersion object) {
super(object);
}
/**
* Default constructor. Should be used only for deserialization.
*/
protected FrameworkVersionView() {
}
/**
* @return the version
* @see #version
*/
public String getVersion() {
return version;
}
/**
* @param version
* the version to set
* @see #version
*/
public void setVersion(String version) {
this.version = version;
}
/**
* @return the svnVersion
* @see #svnVersion
*/
public String getSvnVersion() {
return svnVersion;
}
/**
* @param svnVersion
* the svnVersion to set
* @see #svnVersion
*/
public void setSvnVersion(String svnVersion) {
this.svnVersion = svnVersion;
}
/**
* @return the description
* @see #description
*/
public String getDescription() {
return description;
}
/**
* @param description
* the description to set
* @see #description
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @return the time
* @see #time
*/
public String getTime() {
return time;
}
/**
* @param time
* the time to set
* @see #time
*/
public void setTime(String time) {
this.time = time;
}
/**
* @return the devel
* @see #devel
*/
public Boolean getDevel() {
return devel;
}
/**
* @param devel
* the devel to set
* @see #devel
*/
public void setDevel(Boolean devel) {
this.devel = devel;
}
}
package lcsb.mapviewer.common;
import java.io.Serializable;
/**
* View representation of the {@link FrameworkVersion}. Contains information
* about single framework version.
*
* @author Piotr Gawron
*
*/
public class FrameworkVersion implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Version of the framework.
*/
private String version;
/**
* When this version was committed to git.
*/
private String gitVersion;
/**
* When the framework was built.
*/
private String time;
/**
* Default constructor.
*
*/
public FrameworkVersion() {
}
/**
* @return the version
* @see #version
*/
public String getVersion() {
return version;
}
/**
* @param version
* the version to set
* @see #version
*/
public void setVersion(String version) {
this.version = version;
}
/**
* @return the gitVersion
* @see #gitVersion
*/
public String getGitVersion() {
return gitVersion;
}
/**
* @param gitVersion
* the gitVersion to set
* @see #gitVersion
*/
public void setGitVersion(String gitVersion) {
this.gitVersion = gitVersion;
}
/**
* @return the time
* @see #time
*/
public String getTime() {
return time;
}
/**
* @param time
* the time to set
* @see #time
*/
public void setTime(String time) {
this.time = time;
}
}
package lcsb.mapviewer.common;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import java.io.File;
import java.lang.reflect.Constructor;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class ConfigurationTest {
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void testGetters() {
Configuration.setApplicationCacheOn(false);
assertFalse(Configuration.isApplicationCacheOn());
Configuration.setAutocompleteSize(1);
assertEquals(1, Configuration.getAutocompleteSize());
Configuration.setDbCacheOn(false);
assertFalse(Configuration.isDbCacheOn());
}
@Test
public void testLoadSystemVersion() {
Configuration.loadSystemVersion((String) null);
assertEquals("Unknown", Configuration.getSystemVersion(null));
assertEquals("Unknown", Configuration.getSystemBuild(null));
}
@Test
public void testLoadSystemVersion2() {
Configuration.loadSystemVersion(new File("unknown.xxx"));
assertEquals("Unknown", Configuration.getSystemVersion(null));
assertEquals("Unknown", Configuration.getSystemBuild(null));
}
@Test
public void testGetSystemVersion() {
assertEquals("100", Configuration.getSystemVersion("testFiles/version/", true));
assertEquals("100", Configuration.getSystemVersion(null, false));
}
@Test
public void testGetSystemBuild() {
assertEquals("102", Configuration.getSystemBuild("testFiles/version/", true));
assertEquals("102", Configuration.getSystemBuild(null, false));
}
@Test
public void testXGetSystemVersion() {
String frame = "test";
Configuration.setxFrameDomain(frame);
assertEquals(frame, Configuration.getxFrameDomain());
}
@Test
public void testWebAppDir() {
String dir = "test2";
Configuration.setWebAppDir(dir);
assertEquals(dir, Configuration.getWebAppDir());
}
@Test
public void testPrivateConstructor() throws Exception {
try {
Constructor<?> constr = Configuration.class.getDeclaredConstructor(new Class<?>[] {});
constr.setAccessible(true);
assertNotNull(constr.newInstance(new Object[] {}));
} catch (Exception e) {
throw e;
}
}
}
package lcsb.mapviewer.common;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import java.io.File;
import java.lang.reflect.Constructor;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class ConfigurationTest {
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void testGetters() {
Configuration.setApplicationCacheOn(false);
assertFalse(Configuration.isApplicationCacheOn());
Configuration.setAutocompleteSize(1);
assertEquals(1, Configuration.getAutocompleteSize());
Configuration.setDbCacheOn(false);
assertFalse(Configuration.isDbCacheOn());
}
@Test
public void testLoadSystemBuildVersion() {
Configuration.loadSystemVersion((String) null);
assertEquals("Unknown", Configuration.getSystemBuildVersion(null));
assertEquals("Unknown", Configuration.getSystemBuild(null));
assertEquals("Unknown", Configuration.getSystemVersion(null));
}
@Test
public void testLoadSystemBuildVersion2() {
Configuration.loadSystemVersion((String)null);
Configuration.loadSystemVersion(new File("unknown.xxx"));
assertEquals("Unknown", Configuration.getSystemBuildVersion(null));
assertEquals("Unknown", Configuration.getSystemBuild(null));
assertEquals("Unknown", Configuration.getSystemVersion(null));
}
@Test
public void testGetSystemBuildVersion() {
assertEquals("100", Configuration.getSystemBuildVersion("testFiles/version/", true));
assertEquals("100", Configuration.getSystemBuildVersion(null, false));