Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
frascati
frascati
Commits
d89abf93
Commit
d89abf93
authored
Aug 11, 2010
by
Philippe Merle
Browse files
* Improved the code quality according to checking rules of Sonar.
* Cosmetic updates.
parent
c8966fe5
Changes
3
Hide whitespace changes
Inline
Side-by-side
frascati/modules/frascati-sca-parser/src/test/java/org/ow2/frascati/parser/test/ClassWithServiceAnnotationWithNoField.java
View file @
d89abf93
/**
* OW2 FraSCAti SCA Parser
* Copyright (C) 2010 INRIA, U
STL
* Copyright (C) 2010 INRIA, U
niversity of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -33,11 +33,10 @@ import org.osoa.sca.annotations.Service;
*/
// Following annotation must define one field 'value' or 'interfaces'.
@Service
public
class
ClassWithServiceAnnotationWithNoField
implements
Runnable
public
class
ClassWithServiceAnnotationWithNoField
implements
Runnable
{
public
void
run
()
public
final
void
run
()
{
}
}
frascati/modules/frascati-sca-parser/src/test/java/org/ow2/frascati/parser/test/ClassWithServiceAnnotationWithTwoFields.java
View file @
d89abf93
/**
* OW2 FraSCAti SCA Parser
* Copyright (C) 2010 INRIA, U
STL
* Copyright (C) 2010 INRIA, U
niversity of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -33,11 +33,10 @@ import org.osoa.sca.annotations.Service;
*/
// Following annotation must define one field 'value' or 'interfaces', not both.
@Service
(
value
=
Runnable
.
class
,
interfaces
={
Runnable
.
class
})
public
class
ClassWithServiceAnnotationWithTwoFields
implements
Runnable
public
class
ClassWithServiceAnnotationWithTwoFields
implements
Runnable
{
public
void
run
()
public
final
void
run
()
{
}
}
frascati/modules/frascati-sca-parser/src/test/java/org/ow2/frascati/parser/test/ParserTest.java
View file @
d89abf93
/**
* OW2 FraSCAti: SCA Parser
* Copyright (C) 2010 INRIA, U
STL
* Copyright (C) 2010 INRIA, U
niversity of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -49,13 +49,14 @@ import org.ow2.frascati.parser.core.ParsingContextImpl;
*
* @author Philippe Merle.
*/
public
class
ParserTest
{
public
class
ParserTest
{
Parser
<
Composite
>
compositeParser
;
Parser
<
ConstrainingType
>
constrainingTypeParser
;
@Before
public
void
initialize
()
throws
Exception
{
public
final
void
initialize
()
throws
Exception
{
// Create a factory of SCA parsers.
org
.
ow2
.
frascati
.
parser
.
Parser
parserFactory
=
new
org
.
ow2
.
frascati
.
parser
.
Parser
();
// Create a parser component.
...
...
@@ -69,7 +70,8 @@ public class ParserTest {
}
@Test
public
void
parseParser
()
throws
Exception
{
public
final
void
parseParser
()
throws
Exception
{
// Parse the parser composite.
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"org/ow2/frascati/parser/Parser.composite"
);
...
...
@@ -78,7 +80,8 @@ public class ParserTest {
}
@Test
public
void
parseCompositeParser
()
throws
Exception
{
public
final
void
parseCompositeParser
()
throws
Exception
{
// Parse the parser composite.
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"org/ow2/frascati/parser/CompositeParser.composite"
);
...
...
@@ -87,7 +90,8 @@ public class ParserTest {
}
@Test
public
void
parseScaParser
()
throws
Exception
{
public
final
void
parseScaParser
()
throws
Exception
{
// Parse the parser composite.
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"org/ow2/frascati/parser/ScaParser.composite"
);
...
...
@@ -96,7 +100,8 @@ public class ParserTest {
}
@Test
public
void
parseMetamodelProviderType
()
throws
Exception
{
public
final
void
parseMetamodelProviderType
()
throws
Exception
{
// Parse the parser composite.
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"org/ow2/frascati/parser/MetamodelProviderType"
);
...
...
@@ -105,7 +110,8 @@ public class ParserTest {
}
@Test
public
void
parseResolverPluginType
()
throws
Exception
{
public
final
void
parseResolverPluginType
()
throws
Exception
{
// Parse the parser composite.
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"org/ow2/frascati/parser/ResolverType"
);
...
...
@@ -114,7 +120,8 @@ public class ParserTest {
}
@Test
public
void
parseCompositeWithoutFileExtension
()
throws
Exception
{
public
final
void
parseCompositeWithoutFileExtension
()
throws
Exception
{
// Parse the parser composite.
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"org/ow2/frascati/parser/Parser"
);
...
...
@@ -123,7 +130,8 @@ public class ParserTest {
}
@Test
public
void
parseCompositeWithFullQName
()
throws
Exception
{
public
final
void
parseCompositeWithFullQName
()
throws
Exception
{
// Parse the parser composite.
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"org/ow2/frascati/parser"
,
"Parser"
,
"parser"
);
...
...
@@ -132,7 +140,8 @@ public class ParserTest {
}
@Test
public
void
parseNotFoundComposite
()
throws
Exception
{
public
final
void
parseNotFoundComposite
()
throws
Exception
{
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"NotFoundComposite"
);
try
{
...
...
@@ -147,7 +156,8 @@ public class ParserTest {
}
@Test
public
void
parseEmptyCompositeFile
()
throws
Exception
{
public
final
void
parseEmptyCompositeFile
()
throws
Exception
{
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"EmptyCompositeFile"
);
try
{
...
...
@@ -161,7 +171,8 @@ public class ParserTest {
}
@Test
public
void
parseSyntaxError
()
throws
Exception
{
public
final
void
parseSyntaxError
()
throws
Exception
{
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"SyntaxError"
);
try
{
...
...
@@ -175,7 +186,8 @@ public class ParserTest {
}
@Test
public
void
parseNotFoundInclude
()
throws
Exception
{
public
final
void
parseNotFoundInclude
()
throws
Exception
{
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"NotFoundInclude"
);
try
{
...
...
@@ -190,7 +202,8 @@ public class ParserTest {
}
@Test
public
void
parseIncludeSyntaxError
()
throws
Exception
{
public
final
void
parseIncludeSyntaxError
()
throws
Exception
{
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"IncludeSyntaxError"
);
try
{
...
...
@@ -205,7 +218,8 @@ public class ParserTest {
}
@Test
public
void
parseNotFoundJavaClass
()
throws
Exception
{
public
final
void
parseNotFoundJavaClass
()
throws
Exception
{
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"NotFoundJavaClass"
);
try
{
...
...
@@ -220,7 +234,8 @@ public class ParserTest {
}
@Test
public
void
parseNotFoundConstrainingType
()
throws
Exception
{
public
final
void
parseNotFoundConstrainingType
()
throws
Exception
{
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"NotFoundConstrainingType"
);
try
{
...
...
@@ -235,7 +250,8 @@ public class ParserTest {
}
@Test
public
void
parseComponentReferenceTarget
()
throws
Exception
{
public
final
void
parseComponentReferenceTarget
()
throws
Exception
{
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"ComponentReferenceTarget"
);
try
{
...
...
@@ -250,7 +266,8 @@ public class ParserTest {
}
@Test
public
void
parsePromote
()
throws
Exception
{
public
final
void
parsePromote
()
throws
Exception
{
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"Promote"
);
try
{
...
...
@@ -265,7 +282,8 @@ public class ParserTest {
}
@Test
public
void
parseCompositeReferencePromoteSeveralComponentReferences
()
throws
Exception
{
public
final
void
parseCompositeReferencePromoteSeveralComponentReferences
()
throws
Exception
{
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"CompositeReferencePromoteSeveralComponentReferences"
);
Composite
composite
=
compositeParser
.
parse
(
qname
,
parsingContext
);
...
...
@@ -273,7 +291,8 @@ public class ParserTest {
}
@Test
public
void
parseAutowire
()
throws
Exception
{
public
final
void
parseAutowire
()
throws
Exception
{
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"Autowire"
);
Composite
composite
=
compositeParser
.
parse
(
qname
,
parsingContext
);
...
...
@@ -282,7 +301,8 @@ public class ParserTest {
}
@Test
public
void
parseCompositeReferenceAutowire
()
throws
Exception
{
public
final
void
parseCompositeReferenceAutowire
()
throws
Exception
{
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"CompositeReferenceAutowire"
);
Composite
composite
=
compositeParser
.
parse
(
qname
,
parsingContext
);
...
...
@@ -292,7 +312,8 @@ public class ParserTest {
}
@Test
public
void
parseIncorrectAutowire
()
throws
Exception
{
public
final
void
parseIncorrectAutowire
()
throws
Exception
{
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"IncorrectAutowire"
);
try
{
...
...
@@ -307,7 +328,8 @@ public class ParserTest {
}
@Test
public
void
parseClassWithServiceAnnotation
()
throws
Exception
{
public
final
void
parseClassWithServiceAnnotation
()
throws
Exception
{
ParsingContext
parsingContext
=
new
ParsingContextImpl
();
QName
qname
=
new
QName
(
"ClassWithServiceAnnotation"
);
Composite
composite
=
compositeParser
.
parse
(
qname
,
parsingContext
);
...
...
@@ -315,7 +337,8 @@ public class ParserTest {
assertEquals
(
"Number of warnings must be equals to 2."
,
2
,
parsingContext
.
getWarnings
());
}
protected
void
assertNoErrorsAndWarnings
(
ParsingContext
parsingContext
)
{
protected
final
void
assertNoErrorsAndWarnings
(
ParsingContext
parsingContext
)
{
assertEquals
(
"Number of errors must be equals to 0."
,
0
,
parsingContext
.
getErrors
());
assertEquals
(
"Number of warnings must be equals to 0."
,
0
,
parsingContext
.
getWarnings
());
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment