Skip to content

Commit 0b927cd

Browse files
authored
Gcloud warning (#1512)
* work in progress * Add gcloud plugin warning * make pom scanner case sensitive
1 parent 5b26128 commit 0b927cd

3 files changed

Lines changed: 23 additions & 3 deletions

File tree

plugins/com.google.cloud.tools.eclipse.appengine.validation.test/src/com/google/cloud/tools/eclipse/appengine/validation/PomXmlScannerTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,23 @@ public void testEndElement() throws SAXException {
7272
assertEquals(ELEMENT_MESSAGE, message);
7373
}
7474

75+
@Test
76+
public void testEndElement_gcloudPlugin() throws SAXException {
77+
scanner.startElement("", "plugin", "", new AttributesImpl());
78+
scanner.startElement("", "groupId", "", new AttributesImpl());
79+
String groupId = "com.google.appengine";
80+
scanner.characters(groupId.toCharArray(), 0, groupId.length());
81+
scanner.endElement("", "groupId", "");
82+
assertFalse(scanner.getSaveContents());
83+
84+
scanner.startElement("", "artifactId", "", new AttributesImpl());
85+
String artifactId = "gcloud-maven-plugin";
86+
scanner.characters(artifactId.toCharArray(), 0, artifactId.length());
87+
scanner.endElement("", "artifactId", "");
88+
assertEquals(1, scanner.getBlacklist().size());
89+
90+
String message = scanner.getBlacklist().peek().getMessage();
91+
assertEquals(ELEMENT_MESSAGE, message);
92+
}
93+
7594
}

plugins/com.google.cloud.tools.eclipse.appengine.validation/src/com/google/cloud/tools/eclipse/appengine/validation/PomXmlScanner.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ public void endElement (String uri, String localName, String qName)
8888
} else if (insidePlugin && "artifactId".equalsIgnoreCase(localName)) {
8989
// Found closing <artifactId> tag with parent <plugin>
9090
saveContents = false;
91-
if ("appengine-maven-plugin".equalsIgnoreCase(elementContents.toString())) {
91+
if ("appengine-maven-plugin".equals(elementContents.toString()) ||
92+
"gcloud-maven-plugin".equals(elementContents.toString())) {
9293
foundArtifactId = true;
9394
}
9495
}
@@ -97,7 +98,7 @@ public void endElement (String uri, String localName, String qName)
9798
// with the same <plugin> parent
9899
DocumentLocation start = new DocumentLocation(lineNumber, columnNumber - 9);
99100
String message = Messages.getString("maven.plugin");
100-
BannedElement element = new MavenPluginElement(message, start, 9 /*length of <groupId>*/);
101+
BannedElement element = new MavenPluginElement(message, start, 0);
101102
addToBlacklist(element);
102103
foundAppEngineGroupId = false;
103104
foundArtifactId = false;

plugins/com.google.cloud.tools.eclipse.appengine.validation/src/com/google/cloud/tools/eclipse/appengine/validation/messages.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ application.element=Project ID should be specified at deploy time
22
remove.application.element=Remove application element
33
web.xml.version=App Engine Standard does not support this servlet version
44
convert.servlet=Convert to Java Servlet API 2.5
5-
maven.plugin=A new App Engine Maven plugin is available
5+
maven.plugin=This App Engine Maven plugin has been deprecated

0 commit comments

Comments
 (0)