-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
preserve datastore-indexes-auto across non-clean rebuilds (#164)
* preserve datastore-indexes-auto across non-clean rebuilds
- Loading branch information
1 parent
b2384a4
commit f006d98
Showing
2 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...in/src/test/java/com/google/cloud/tools/gradle/appengine/standard/ExplodeWarTaskTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright (c) 2017 Google Inc. All Right Reserved. | ||
* | ||
* 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 com.google.cloud.tools.gradle.appengine.standard; | ||
|
||
import com.google.cloud.tools.gradle.appengine.TestProject; | ||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import org.gradle.testkit.runner.BuildResult; | ||
import org.junit.Assert; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.TemporaryFolder; | ||
|
||
public class ExplodeWarTaskTest { | ||
|
||
@Rule public final TemporaryFolder testProjectDir = new TemporaryFolder(); | ||
|
||
@Test | ||
public void testSyncTask() throws IOException { | ||
BuildResult buildResult = | ||
new TestProject(testProjectDir.getRoot()) | ||
.addStandardBuildFile() | ||
.addAppEngineWebXml() | ||
.applyGradleRunner("explodeWar"); | ||
|
||
Path explodedApp = | ||
testProjectDir | ||
.getRoot() | ||
.toPath() | ||
.resolve("build") | ||
.resolve("exploded-" + testProjectDir.getRoot().getName()); | ||
Path appengineGenerated = explodedApp.resolve("WEB-INF").resolve("appengine-generated"); | ||
Path junkXml = appengineGenerated.resolve("junk.xml"); | ||
Path datastoreIndexesAutoXml = appengineGenerated.resolve("datastore-indexes-auto.xml"); | ||
|
||
Assert.assertTrue(Files.isDirectory(explodedApp)); | ||
Assert.assertFalse(Files.isRegularFile(datastoreIndexesAutoXml)); | ||
Assert.assertFalse(Files.isRegularFile(junkXml)); | ||
|
||
// creates files that we will test persistence on | ||
Files.createDirectory(appengineGenerated); | ||
Files.createFile(junkXml); | ||
Files.createFile(datastoreIndexesAutoXml); | ||
|
||
// run explodeWar again to see if we preserve datastore-indexes-auto and remove junk, force | ||
// it to skip UP-TO-DATE checks | ||
new TestProject(testProjectDir.getRoot()).applyGradleRunner("explodeWar", "--rerun-tasks"); | ||
|
||
Assert.assertTrue(Files.isRegularFile(datastoreIndexesAutoXml)); | ||
Assert.assertFalse(Files.isRegularFile(junkXml)); | ||
} | ||
} |