Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Webtools Releng
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Projects
webtools
Releng
Webtools Releng
Commits
b39bab36
Commit
b39bab36
authored
17 years ago
by
david_williams
Browse files
Options
Downloads
Patches
Plain Diff
adjust for new features ... from emf?
parent
b217ebf4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/org.eclipse.wtp.releng.tests/src/org/eclipse/wtp/releng/tests/BuildTests.java
+89
-89
89 additions, 89 deletions
...ng.tests/src/org/eclipse/wtp/releng/tests/BuildTests.java
with
89 additions
and
89 deletions
tests/org.eclipse.wtp.releng.tests/src/org/eclipse/wtp/releng/tests/BuildTests.java
+
89
−
89
View file @
b39bab36
...
...
@@ -28,17 +28,17 @@ import org.eclipse.core.runtime.Platform;
import
org.eclipse.equinox.app.IApplication
;
public
class
BuildTests
extends
TestCase
{
public
class
FileSuffixFilter
implements
FilenameFilter
{
private
String
suffix
;
public
FileSuffixFilter
(
String
suffix
)
{
this
.
suffix
=
suffix
;
}
/**
* @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
*/
...
...
@@ -57,29 +57,30 @@ public class BuildTests extends TestCase {
private
static
final
String
[]
REQUIRED_PLUGIN_FILES
=
{
"about.html"
,
"plugin.properties"
,
"plugin.xml"
};
private
static
final
String
REQUIRED_PLUGIN_SUFFIX
=
".jar"
;
private
static
final
String
[]
REQUIRED_FEATURE_PLUGIN_FILES
=
{
"about.html"
,
"about.ini"
,
"about.mappings"
,
"about.properties"
,
"plugin.properties"
,
"plugin.xml"
};
private
static
final
String
REQUIRED_FEATURE_PLUGIN_SUFFIX
=
".gif"
;
private
static
final
String
[]
REQUIRED_FRAGMENT_FILES
=
{
"fragment.xml"
};
private
static
final
String
REQUIRED_FRAGMENT_SUFFIX
=
""
;
private
static
final
String
[]
REQUIRED_SWT_FRAGMENT_FILES
=
{
"fragment.properties"
};
private
static
final
String
REQUIRED_SWT_FRAGMENT_SUFFIX
=
""
;
private
static
final
String
[]
REQUIRED_SOURCE_FILES
=
{
"about.html"
};
private
static
final
String
REQUIRED_SOURCE_SUFFIX
=
".zip"
;
private
static
final
String
[]
REQUIRED_BUNDLE_FILES
=
{
"about.html"
};
private
static
final
String
REQUIRED_BUNDLE_MANIFEST
=
"MANIFEST.MF"
;
private
static
final
String
REQUIRED_BUNDLE_SUFFIX
=
".jar"
;
private
static
final
String
[]
SUFFIX_EXEMPT_LIST
=
{
"org.eclipse.swt"
,
"org.apache.ant"
};
private
static
final
int
EXPECTED_NUMBER_OF_FEATURES
=
1
43
;
private
static
final
String
[]
SUFFIX_EXEMPT_LIST
=
{
"org.eclipse.swt"
,
"org.apache.ant"
};
private
static
final
int
EXPECTED_NUMBER_OF_FEATURES
=
1
55
;
private
static
final
int
EXPECTED_NUMBER_OF_PLUGINS
=
568
;
/**
* Constructor for EmptyDirectoriesTest.
*
* @param arg0
*/
public
BuildTests
(
String
arg0
)
{
...
...
@@ -92,18 +93,18 @@ public class BuildTests extends TestCase {
String
installDir
=
Platform
.
getInstallLocation
().
getURL
().
getPath
();
File
featureDir
=
new
File
(
installDir
,
"features"
);
File
[]
features
=
featureDir
.
listFiles
();
for
(
int
i
=
0
;
i
<
features
.
length
;
i
++)
{
File
aFeature
=
features
[
i
];
if
(!
testDirectory
(
aFeature
,
REQUIRED_FEATURE_FILES
,
REQUIRED_FEATURE_SUFFIX
))
{
result
.
add
(
aFeature
.
getPath
());
}
}
String
aString
=
""
;
if
(
result
.
size
()
>
0
)
{
Iterator
iter
=
result
.
iterator
();
while
(
iter
.
hasNext
())
{
String
element
=
(
String
)
iter
.
next
();
...
...
@@ -115,26 +116,26 @@ public class BuildTests extends TestCase {
public
void
testNumberOfFeatures
()
{
String
installDir
=
Platform
.
getInstallLocation
().
getURL
().
getPath
();
File
featureDir
=
new
File
(
installDir
,
"features"
);
File
[]
features
=
featureDir
.
listFiles
();
int
nFeatures
=
features
.
length
;
assertEquals
(
"there were more or less features than expected: "
,
EXPECTED_NUMBER_OF_FEATURES
,
nFeatures
);
//System.out.println("wtp releng tests show nFeatures=" + nFeatures);
//
System.out.println("wtp releng tests show nFeatures=" + nFeatures);
}
public
void
_testPluginFiles
()
{
List
result
=
new
ArrayList
();
String
installDir
=
Platform
.
getInstallLocation
().
getURL
().
getPath
();
File
pluginDir
=
new
File
(
installDir
,
"plugins"
);
File
[]
plugins
=
pluginDir
.
listFiles
();
System
.
out
.
println
(
"nPlugins: "
+
plugins
.
length
);
for
(
int
i
=
0
;
i
<
plugins
.
length
;
i
++)
{
File
aPlugin
=
plugins
[
i
];
if
(
aPlugin
.
getName
().
indexOf
(
"test"
)
==
-
1
)
{
...
...
@@ -143,10 +144,10 @@ public class BuildTests extends TestCase {
}
}
}
String
aString
=
""
;
if
(
result
.
size
()
>
0
)
{
Iterator
iter
=
result
.
iterator
();
while
(
iter
.
hasNext
())
{
String
element
=
(
String
)
iter
.
next
();
...
...
@@ -163,76 +164,79 @@ public class BuildTests extends TestCase {
File
[]
plugins
=
pluginDir
.
listFiles
();
int
nPlugins
=
plugins
.
length
;
assertEquals
(
"there were more or less plugins than expected: "
,
EXPECTED_NUMBER_OF_PLUGINS
,
nPlugins
);
//System.out.println("wtp.releng tests shows nPlugins=" + nPlugins);
// System.out.println("wtp.releng tests shows nPlugins=" + nPlugins);
}
private
boolean
testPluginFile
(
File
aPlugin
)
{
// Are we a doc plugin?
if
(
testDirectory
(
aPlugin
,
REQUIRED_PLUGIN_FILES
,
".zip"
))
{
return
true
;
}
// Are we a feature plugin?
if
(
testDirectory
(
aPlugin
,
REQUIRED_FEATURE_PLUGIN_FILES
,
REQUIRED_FEATURE_PLUGIN_SUFFIX
))
{
return
true
;
}
// Are we a regular plugin
if
(
testDirectory
(
aPlugin
,
REQUIRED_PLUGIN_FILES
,
REQUIRED_PLUGIN_SUFFIX
))
{
return
true
;
}
}
// Are we a source plugin
if
(
testSourcePlugin
(
aPlugin
))
{
return
true
;
}
// Are we a fragment
if
((
testDirectory
(
aPlugin
,
REQUIRED_FRAGMENT_FILES
,
REQUIRED_FRAGMENT_SUFFIX
))||(
testBundleDirectory
(
aPlugin
,
REQUIRED_BUNDLE_FILES
,
REQUIRED_BUNDLE_MANIFEST
,
REQUIRED_FRAGMENT_SUFFIX
)))
{
if
((
testDirectory
(
aPlugin
,
REQUIRED_FRAGMENT_FILES
,
REQUIRED_FRAGMENT_SUFFIX
))
||
(
testBundleDirectory
(
aPlugin
,
REQUIRED_BUNDLE_FILES
,
REQUIRED_BUNDLE_MANIFEST
,
REQUIRED_FRAGMENT_SUFFIX
)))
{
return
true
;
}
}
// Are we an swt fragment
if
(
testDirectory
(
aPlugin
,
REQUIRED_SWT_FRAGMENT_FILES
,
REQUIRED_SWT_FRAGMENT_SUFFIX
))
{
return
true
;
}
}
// Are we a bundle?
if
(
testBundleDirectory
(
aPlugin
,
REQUIRED_BUNDLE_FILES
,
REQUIRED_BUNDLE_MANIFEST
,
REQUIRED_BUNDLE_SUFFIX
))
{
return
true
;
}
// No then we are bad
return
false
;
}
private
boolean
testPluginJar
(
File
aDirectory
,
String
[]
requiredFiles
){
ArrayList
list
=
new
ArrayList
();
try
{
ZipFile
jarredPlugin
=
new
ZipFile
(
aDirectory
);
Enumeration
_enum
=
jarredPlugin
.
entries
();
while
(
_enum
.
hasMoreElements
()){
list
.
add
(
_enum
.
nextElement
().
toString
());
}
}
catch
(
ZipException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
if
(!
list
.
containsAll
(
Arrays
.
asList
(
requiredFiles
)))
{
return
false
;
private
boolean
testPluginJar
(
File
aDirectory
,
String
[]
requiredFiles
)
{
ArrayList
list
=
new
ArrayList
();
try
{
ZipFile
jarredPlugin
=
new
ZipFile
(
aDirectory
);
Enumeration
_enum
=
jarredPlugin
.
entries
();
while
(
_enum
.
hasMoreElements
())
{
list
.
add
(
_enum
.
nextElement
().
toString
());
}
return
true
;
}
catch
(
ZipException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
if
(!
list
.
containsAll
(
Arrays
.
asList
(
requiredFiles
)))
{
return
false
;
}
return
true
;
}
private
boolean
testDirectory
(
File
aDirectory
,
String
[]
requiredFiles
,
String
requiredSuffix
)
{
if
(
aDirectory
.
getName
().
endsWith
(
".jar"
)){
return
testPluginJar
(
aDirectory
,
requiredFiles
);
}
else
{
if
(!
Arrays
.
asList
(
aDirectory
.
list
()).
containsAll
(
Arrays
.
asList
(
requiredFiles
)))
{
if
(
aDirectory
.
getName
().
endsWith
(
".jar"
))
{
return
testPluginJar
(
aDirectory
,
requiredFiles
);
}
else
{
if
(!
Arrays
.
asList
(
aDirectory
.
list
()).
containsAll
(
Arrays
.
asList
(
requiredFiles
)))
{
return
false
;
}
...
...
@@ -241,28 +245,25 @@ public class BuildTests extends TestCase {
index
=
aDirectory
.
getName
().
length
();
}
//String plainName = aDirectory.getName().substring(0, index);
//
String plainName = aDirectory.getName().substring(0, index);
/*
if (requiredSuffix.equals("")
|| Arrays.asList(SUFFIX_EXEMPT_LIST).contains(plainName)) {
return true;
} else if (aDirectory
.listFiles(new FileSuffixFilter(requiredSuffix)).length == 0) {
return false;
}
*/
* if (requiredSuffix.equals("") ||
* Arrays.asList(SUFFIX_EXEMPT_LIST).contains(plainName)) { return
* true; } else if (aDirectory .listFiles(new
* FileSuffixFilter(requiredSuffix)).length == 0) { return false; }
*/
}
return
true
;
}
private
boolean
testBundleDirectory
(
File
aDirectory
,
String
[]
requiredFiles
,
String
manifestFile
,
String
requiredSuffix
)
{
if
(
aDirectory
.
getName
().
endsWith
(
".jar"
))
{
return
testPluginJar
(
aDirectory
,
requiredFiles
);
}
else
{
if
(!
Arrays
.
asList
(
aDirectory
.
list
()).
containsAll
(
Arrays
.
asList
(
requiredFiles
)))
{
}
else
{
if
(!
Arrays
.
asList
(
aDirectory
.
list
()).
containsAll
(
Arrays
.
asList
(
requiredFiles
)))
{
return
false
;
}
...
...
@@ -278,7 +279,8 @@ public class BuildTests extends TestCase {
String
[]
metaFiles
=
metaDir
.
list
();
if
(
metaFiles
==
null
)
{
return
(
false
);
}
else
{
}
else
{
for
(
int
i
=
0
;
i
<
metaFiles
.
length
;
i
++)
{
String
filename
=
metaFiles
[
i
];
if
(
filename
==
manifestFile
)
{
...
...
@@ -291,11 +293,10 @@ public class BuildTests extends TestCase {
return
false
;
}
if
(
requiredSuffix
.
equals
(
""
)
||
Arrays
.
asList
(
SUFFIX_EXEMPT_LIST
).
contains
(
plainName
))
{
if
(
requiredSuffix
.
equals
(
""
)
||
Arrays
.
asList
(
SUFFIX_EXEMPT_LIST
).
contains
(
plainName
))
{
return
true
;
}
else
if
(
aDirectory
.
listFiles
(
new
FileSuffixFilter
(
requiredSuffix
)).
length
==
0
)
{
}
else
if
(
aDirectory
.
listFiles
(
new
FileSuffixFilter
(
requiredSuffix
)).
length
==
0
)
{
return
false
;
}
}
...
...
@@ -313,13 +314,13 @@ public class BuildTests extends TestCase {
if
(!
testDirectory
(
aPlugin
,
REQUIRED_PLUGIN_FILES
,
""
))
{
return
false
;
}
File
sourceDir
=
new
File
(
aPlugin
,
"src"
);
File
[]
sourceDirs
=
sourceDir
.
listFiles
();
if
(
sourceDirs
==
null
)
{
return
false
;
}
for
(
int
i
=
0
;
i
<
sourceDirs
.
length
;
i
++)
{
File
aSourceDir
=
sourceDirs
[
i
];
if
(!
testDirectory
(
aSourceDir
,
REQUIRED_SOURCE_FILES
,
REQUIRED_SOURCE_SUFFIX
))
{
...
...
@@ -327,22 +328,21 @@ public class BuildTests extends TestCase {
}
}
return
true
;
}
}
/**
* Compares the feature and plug-in versions contained in this Eclipse
* Compares the feature and plug-in versions contained in this Eclipse
* configuration, against a known previous Eclipse configuration.
* @throws Exception
*
* @throws Exception
*/
public
void
testVersionCompare
()
throws
Exception
{
VersionLister
versionLister
=
new
VersionLister
();
String
[]
args
=
new
String
[]
{
"-testToReference"
,
"1.5.4"
,
"-listToReferenceFile"
};
String
[]
args
=
new
String
[]{
"-testToReference"
,
"1.5.4"
,
"-listToReferenceFile"
};
Object
result
=
versionLister
.
run
(
args
);
boolean
testok
=
(
IApplication
.
EXIT_OK
.
equals
(
result
));
assertTrue
(
"There is an error in versioning. See full listing for details."
,
testok
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment