Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SAREF
saref-pipeline
Commits
3559c90c
Commit
3559c90c
authored
Mar 11, 2020
by
Maxime Lefrançois
Browse files
starting integration
parents
Changes
28
Expand all
Hide whitespace changes
Inline
Side-by-side
.gitignore
0 → 100644
View file @
3559c90c
/target/
dependency-reduced-pom.xml
.project
.classpath
.settings
\ No newline at end of file
.gitlab-ci.yml
0 → 100644
View file @
3559c90c
image
:
maven:3.6.2-jdk-8
build
:
stage
:
build
script
:
-
mvn package
artifacts
:
paths
:
-
target/sarefPipeline.jar
only
:
-
master
README.md
0 → 100644
View file @
3559c90c
# Description
This project integrates the SAREF development and documentation generation pipeline
pom.xml
0 → 100644
View file @
3559c90c
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
fr.emse.gitlab.saref
</groupId>
<artifactId>
saref-pipeline
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<name>
saref-pipeline
</name>
<developers>
<developer>
<name>
Omar Qawasmeh
</name>
<email>
omar.alqawasmeh@emse.fr
</email>
<url>
https://perso.univ-st-etienne.fr/alo09685/
</url>
<organization>
Ecole des mines de Saint-Etienne
</organization>
<organizationUrl>
http://www.mines-stetienne.fr/
</organizationUrl>
<timezone>
+1
</timezone>
</developer>
<developer>
<name>
Maxime Lefrançois
</name>
<email>
maxime.lefrancois@emse.fr
</email>
<url>
http://www.maxime-lefrancois.info/
</url>
<organization>
Ecole des mines de Saint-Etienne
</organization>
<organizationUrl>
http://www.mines-stetienne.fr/
</organizationUrl>
<timezone>
+1
</timezone>
</developer>
</developers>
<organization>
<name>
École des Mines de Saint-Étienne
</name>
<url>
http://www.mines-stetienne.fr/
</url>
</organization>
<licenses>
<license>
<name>
The Apache Software License, Version 2.0
</name>
<url>
http://www.apache.org/licenses/LICENSE-2.0.txt
</url>
</license>
</licenses>
<properties>
<maven.compiler.source>
1.8
</maven.compiler.source>
<maven.compiler.target>
1.8
</maven.compiler.target>
<maven.build.timestamp.format>
yyyy-MM-dd'T'HH:mm:ssZ
</maven.build.timestamp.format>
<jdk.version>
1.8
</jdk.version>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<sparql-generate.version>
2.0-SNAPSHOT
</sparql-generate.version>
</properties>
<dependencies>
<!-- <dependency> -->
<!-- <groupId>org.topbraid</groupId> -->
<!-- <artifactId>shacl</artifactId> -->
<!-- <version>1.3.1</version> -->
<!-- </dependency> -->
<dependency>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-log4j12
</artifactId>
<version>
1.7.25
</version>
</dependency>
<dependency>
<groupId>
com.fasterxml.jackson.dataformat
</groupId>
<artifactId>
jackson-dataformat-xml
</artifactId>
<version>
2.10.1
</version>
</dependency>
<dependency>
<groupId>
org.apache.jena
</groupId>
<artifactId>
jena-tdb
</artifactId>
<version>
3.4.0
</version>
</dependency>
<dependency>
<groupId>
fr.emse.ci
</groupId>
<artifactId>
sparql-generate-jena
</artifactId>
<version>
2.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
fr.emse.ci
</groupId>
<artifactId>
sparql-generate-markdown
</artifactId>
<version>
2.0-SNAPSHOT
</version>
</dependency>
<dependency>
<!-- see Porcelain https://git-scm.com/book/uz/v2/Appendix-B%3A-Embedding-Git-in-your-Applications-JGit -->
<groupId>
org.eclipse.jgit
</groupId>
<artifactId>
org.eclipse.jgit
</artifactId>
<version>
5.2.1.201812262042-r
</version>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
2.8.2
</version>
<type>
jar
</type>
</dependency>
</dependencies>
<build>
<finalName>
${project.artifactId}
</finalName>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-shade-plugin
</artifactId>
<version>
2.4.1
</version>
<executions>
<execution>
<phase>
package
</phase>
<goals>
<goal>
shade
</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation=
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"
>
<mainClass>
fr.emse.gitlab.saref.Main
</mainClass>
</transformer>
</transformers>
<filters>
<filter>
<artifact>
*:*
</artifact>
<excludes>
<exclude>
META-INF/*.SF
</exclude>
<exclude>
META-INF/*.DSA
</exclude>
<exclude>
META-INF/*.RSA
</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
src/main/java/fr/emse/gitlab/saref/Main.java
0 → 100644
View file @
3559c90c
package
fr.emse.gitlab.saref
;
import
java.awt.Desktop
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.StringWriter
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
java.net.URLEncoder
;
import
javax.xml.bind.JAXBContext
;
import
javax.xml.bind.JAXBException
;
import
javax.xml.bind.Marshaller
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.log4j.Layout
;
import
org.apache.log4j.PatternLayout
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
fr.emse.gitlab.saref.entities.TestSuites
;
import
fr.emse.gitlab.saref.jobs.JobRunner
;
import
fr.emse.gitlab.saref.jobs.library.ReadOntologies
;
import
fr.emse.gitlab.saref.jobs.library.RepositoryStructureChecker
;
import
fr.emse.gitlab.saref.utils.SAREF
;
public
class
Main
{
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
Main
.
class
);
private
static
final
Layout
LAYOUT
=
new
PatternLayout
(
"%d{mm:ss,SSS} %t %-5p %c:%L - %m%n"
);
private
static
final
org
.
apache
.
log4j
.
Logger
ROOT_LOGGER
=
org
.
apache
.
log4j
.
Logger
.
getRootLogger
();
private
static
TestSuites
testSuites
=
new
TestSuites
();
private
static
File
directory
;
private
static
File
target
;
public
static
void
main
(
String
[]
args
)
throws
IOException
,
InterruptedException
,
URISyntaxException
,
JAXBException
{
if
(
args
.
length
==
0
)
{
directory
=
new
File
(
""
).
getAbsoluteFile
();
}
else
if
(
args
.
length
>
1
)
{
throw
new
IllegalArgumentException
(
"Expecting at most one argument: the location of the SAREF directory where to run the pipeline"
);
}
else
{
directory
=
new
File
(
args
[
0
]).
getAbsoluteFile
();
}
target
=
new
File
(
directory
,
"target"
);
FileUtils
.
forceDelete
(
target
);
FileUtils
.
forceMkdir
(
target
);
File
logFile
=
new
File
(
directory
,
"target/output.log"
);
ROOT_LOGGER
.
addAppender
(
new
org
.
apache
.
log4j
.
RollingFileAppender
(
LAYOUT
,
logFile
.
getAbsolutePath
(),
false
));
LOG
.
info
(
"Starting pipeline"
);
JobRunner
checker
=
new
RepositoryStructureChecker
(
directory
);
checker
.
doJob
(
testSuites
);
if
(
testSuites
.
getErrors
()
>
0
)
{
reportAndExit
(-
1
);
}
checker
=
new
ReadOntologies
(
directory
);
checker
.
doJob
(
testSuites
);
reportAndExit
(
0
);
}
private
static
void
reportAndExit
(
int
code
)
{
try
{
File
report
=
new
File
(
target
,
"report_output.xml"
);
JAXBContext
jaxbContext
=
JAXBContext
.
newInstance
(
TestSuites
.
class
);
Marshaller
jaxbMarshaller
=
jaxbContext
.
createMarshaller
();
jaxbMarshaller
.
setProperty
(
Marshaller
.
JAXB_FORMATTED_OUTPUT
,
Boolean
.
TRUE
);
jaxbMarshaller
.
marshal
(
testSuites
,
report
);
jaxbMarshaller
.
marshal
(
testSuites
,
System
.
out
);
final
StringWriter
sw
=
new
StringWriter
();
jaxbMarshaller
.
marshal
(
testSuites
,
sw
);
if
(
Desktop
.
isDesktopSupported
()
&&
Desktop
.
getDesktop
().
isSupported
(
Desktop
.
Action
.
BROWSE
))
{
Desktop
.
getDesktop
().
browse
(
new
URI
(
SAREF
.
BASE
+
"report.html?report="
+
URLEncoder
.
encode
(
sw
.
toString
(),
"UTF-8"
)));
}
}
catch
(
JAXBException
|
URISyntaxException
|
IOException
ex
)
{
LOG
.
error
(
"Exception:"
,
ex
);
ex
.
printStackTrace
();
}
System
.
exit
(
code
);
}
// private static void testRead() {
// try {
// JAXBContext jaxbContext = JAXBContext.newInstance(TestSuite.class);
// Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
//
// TestCase testCase = (TestCase) jaxbUnmarshaller.unmarshal(target);
//
// } catch (JAXBException e) {
// e.printStackTrace();
// }
// }
}
src/main/java/fr/emse/gitlab/saref/entities/Contributor.java
0 → 100644
View file @
3559c90c
/*
* Copyright 2020 École des Mines de Saint-Étienne.
*
* Licensed 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
fr.emse.gitlab.saref.entities
;
import
org.eclipse.jgit.lib.PersonIdent
;
/**
*
* @author maxime.lefrancois
*/
public
class
Contributor
{
private
final
String
name
;
private
final
String
emailAddress
;
public
Contributor
(
PersonIdent
person
)
{
name
=
person
.
getName
();
emailAddress
=
person
.
getEmailAddress
();
}
public
Contributor
(
String
aName
,
String
aEmailAddress
)
{
name
=
aName
;
emailAddress
=
aEmailAddress
;
}
/**
* Get name of person
*
* @return Name of person
*/
public
String
getName
()
{
return
name
;
}
/**
* Get email address of person
*
* @return email address of person
*/
public
String
getEmailAddress
()
{
return
emailAddress
;
}
/**
* {@inheritDoc}
* <p>
* Hashcode is based only on the email address.
*/
@Override
public
int
hashCode
()
{
return
getEmailAddress
().
hashCode
();
}
/**
* {@inheritDoc}
*/
@Override
public
boolean
equals
(
Object
o
)
{
if
(
o
instanceof
Contributor
)
{
final
Contributor
p
=
(
Contributor
)
o
;
return
getName
().
equals
(
p
.
getName
())
&&
getEmailAddress
().
equals
(
p
.
getEmailAddress
());
}
return
false
;
}
/**
* {@inheritDoc}
*/
@Override
public
String
toString
()
{
final
StringBuilder
r
=
new
StringBuilder
();
r
.
append
(
"Contributor["
);
r
.
append
(
getName
());
r
.
append
(
", "
);
r
.
append
(
getEmailAddress
());
r
.
append
(
"]"
);
return
r
.
toString
();
}
}
src/main/java/fr/emse/gitlab/saref/entities/Group.java
0 → 100644
View file @
3559c90c
/*
* Copyright 2020 École des Mines de Saint-Étienne.
*
* Licensed 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
fr.emse.gitlab.saref.entities
;
import
java.util.List
;
/**
*
* @author maxime.lefrancois
*/
public
class
Group
{
public
List
<
Project
>
projects
;
}
src/main/java/fr/emse/gitlab/saref/entities/Project.java
0 → 100644
View file @
3559c90c
/*
* Copyright 2020 École des Mines de Saint-Étienne.
*
* Licensed 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
fr.emse.gitlab.saref.entities
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.apache.jena.rdf.model.Resource
;
/**
*
* @author maxime.lefrancois
*/
public
class
Project
{
public
String
name
;
public
String
http_url_to_repo
;
public
transient
File
directory
;
public
transient
List
<
Version
>
releases
=
new
ArrayList
<>();
public
transient
String
namespace
;
public
transient
String
prefix
;
public
transient
Resource
resource
;
}
src/main/java/fr/emse/gitlab/saref/entities/Property.java
0 → 100644
View file @
3559c90c
/**
*
*/
package
fr.emse.gitlab.saref.entities
;
import
javax.xml.bind.annotation.XmlRootElement
;
/**
* @author Omar Qawasmeh
*
*
*/
@XmlRootElement
public
class
Property
{
}
src/main/java/fr/emse/gitlab/saref/entities/Term.java
0 → 100644
View file @
3559c90c
/*
* Copyright 2020 École des Mines de Saint-Étienne.
*
* Licensed 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
fr.emse.gitlab.saref.entities
;
/**
*
* @author maxime.lefrancois
*/
public
class
Term
{
private
final
String
id
;
private
final
String
localName
;
public
Term
(
String
id
,
String
localName
)
{
this
.
id
=
id
;
this
.
localName
=
localName
;
}
public
String
getId
()
{
return
id
;
}
public
String
getLocalName
()
{
return
localName
;
}
/**
* {@inheritDoc}
* <p>
* Hashcode is based only on the id.
*/
@Override
public
int
hashCode
()
{
return
getLocalName
().
hashCode
();
}
/**
* {@inheritDoc}
*/
@Override
public
boolean
equals
(
Object
o
)
{
if
(
o
instanceof
Contributor
)
{
final
Term
p
=
(
Term
)
o
;
return
getId
().
equals
(
p
.
getId
())
&&
getLocalName
().
equals
(
p
.
getLocalName
());
}
return
false
;
}
/**
* {@inheritDoc}
*/
@Override
public
String
toString
()
{
final
StringBuilder
r
=
new
StringBuilder
();
r
.
append
(
"Term["
);
r
.
append
(
getId
());
r
.
append
(
", "
);
r
.
append
(
getLocalName
());
r
.
append
(
"]"
);
return
r
.
toString
();
}
}
src/main/java/fr/emse/gitlab/saref/entities/TestCase.java
0 → 100644
View file @
3559c90c
/**
*
*/
package
fr.emse.gitlab.saref.entities
;
import
java.io.Serializable
;
import
javax.xml.bind.annotation.XmlAttribute
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlRootElement
;
import
javax.xml.bind.annotation.XmlTransient
;
import
javax.xml.bind.annotation.XmlType
;
/**
* @author Omar Qawasmeh
*
*
*/
@XmlRootElement
(
name
=
"testcase"
)
@XmlType
(
propOrder
=
{
"name"
,
"status"
,
"error"
,
"failure"
,
"systemErr"
,
"systemOut"
})
public
class
TestCase
{
@XmlAttribute
private
String
name
=
""
;
@XmlTransient
private
String
status
=
"success"
;
@XmlElement
private
Error
error
;
@XmlElement
private
Error
failure
;
@XmlTransient
private
String
systemErr
;
@XmlTransient
private
String
systemOut
;
public
TestCase
()
{
}
public
TestCase
(
final
String
name
)
{
this
.
name
=
name
;
}
public
String
getName
()
{
return
name
;
}
@XmlAttribute
public
String
getStatus
()
{
return
status
;
}
@XmlElement
(
name
=
"system-err"
)
public
String
getSystemErr
()
{
return
systemErr
;
}
public
void
setSystemErr
(
String
systemErr
)
{
this
.
systemErr
=
systemErr
;
}
@XmlElement
(
name
=
"system-out"
)
public
String
getSystemOut
()
{
return
systemOut
;
}
public
void
setSystemOut
(
String
systemOut
)
{
this
.
systemOut
=
systemOut
;
}
public
void
setStatus
(
Status
status
)
{
this
.
status
=
status
.
getName
();
}
public
void
setError
(
String
type
,
String
message
)
{
this
.
error
=
new
Error
(
type
,
message
);
this
.
status
=
"error"
;
}