-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#11303: Get Velocity root folder method created. Classes that had the… (
#11335) * #11303: Get Velocity root folder method created. Classes that had the hardcoded path were modified. * #10370: Final adjustments to Velocity folder capabilities. Use the VELOCITY_ROOT property to override the default path
- Loading branch information
Showing
13 changed files
with
184 additions
and
89 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
dotCMS/src/integration-test/java/com/dotcms/velocity/VelocityUtilTest.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,55 @@ | ||
package com.dotcms.velocity; | ||
|
||
import com.dotcms.util.IntegrationTestInitService; | ||
import com.dotmarketing.util.Config; | ||
import com.dotmarketing.util.VelocityUtil; | ||
|
||
import org.junit.Assert; | ||
import org.junit.BeforeClass; | ||
import org.junit.FixMethodOrder; | ||
import org.junit.Test; | ||
import org.junit.runners.MethodSorters; | ||
import org.mockito.Mockito; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
/** | ||
* VelocityUtilTest | ||
*/ | ||
@FixMethodOrder(MethodSorters.NAME_ASCENDING) | ||
public class VelocityUtilTest { | ||
|
||
@BeforeClass | ||
public static void prepare() throws Exception { | ||
IntegrationTestInitService.getInstance().init(); | ||
Mockito.when(Config.CONTEXT.getRealPath("/WEB-INF/velocity")) | ||
.thenReturn(Config.getStringProperty("VELOCITY_ROOT", "/WEB-INF/velocity")); | ||
} | ||
|
||
/** | ||
* Test the velocity path is the default path | ||
*/ | ||
@Test | ||
public void test01DefaultVelocityPath() throws Exception { | ||
String velocityPath = VelocityUtil.getVelocityRootPath(); | ||
|
||
Assert.assertNotNull(velocityPath); | ||
assertThat("Path ends with /WEB-INF/velocity", velocityPath.endsWith("/WEB-INF/velocity")); | ||
} | ||
|
||
/** | ||
* Test the velocity path is a custom path | ||
*/ | ||
@Test | ||
public void test02CustomVelocityPath() throws Exception { | ||
String velocityPath = Config.getStringProperty("VELOCITY_ROOT", "/WEB-INF/velocity"); | ||
velocityPath = velocityPath.replace("/WEB-INF/velocity", "/WEB-INF/customvelocity"); | ||
Config.setProperty("VELOCITY_ROOT", velocityPath); | ||
|
||
String customVelocityPath = VelocityUtil.getVelocityRootPath(); | ||
|
||
Assert.assertNotNull(customVelocityPath); | ||
assertThat("Path ends with /WEB-INF/customvelocity", customVelocityPath.endsWith("/WEB-INF/customvelocity")); | ||
} | ||
|
||
} |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.