Skip to content

Commit

Permalink
add loadtest phrase; fix a bug in bootstrap for test env
Browse files Browse the repository at this point in the history
  • Loading branch information
PZhao committed Dec 6, 2012
1 parent 89e585f commit 4555dbf
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
3 changes: 2 additions & 1 deletion grails-app/conf/BootStrap.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,9 @@ class BootStrap {
}

private def addProductAndInventoryItemIfNotExist(Map<String, Object> inventoryItemInfo) {
def productGroup = null
if(inventoryItemInfo.productGroup){
def productGroup = ProductGroup.findByDescription(inventoryItemInfo.productGroup)
productGroup = ProductGroup.findByDescription(inventoryItemInfo.productGroup)
if(!productGroup){
productGroup = new ProductGroup(description: inventoryItemInfo.productGroup)
productGroup.category = inventoryItemInfo.product.category
Expand Down
24 changes: 22 additions & 2 deletions scripts/_Events.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,29 @@
**/

import org.apache.log4j.Logger
import org.codehaus.groovy.grails.test.junit4.JUnit4GrailsTestType
import org.codehaus.groovy.grails.test.support.GrailsTestMode

Logger log = Logger.getLogger("org.pih.warehouse._Events")

/*loadtest setup*/
def testTypeName = "loadtest"
def testDirectory = "loadtest"
def testMode = new GrailsTestMode(autowire: true, wrapInTransaction: true, wrapInRequestEnvironment: true)
def loadtestTestType = new JUnit4GrailsTestType(testTypeName, testDirectory, testMode)

loadtestTests = [loadtestTestType]

loadtestTestPhasePreparation = {
integrationTestPhasePreparation()
}
loadtestTestPhaseCleanUp = {
integrationTestPhaseCleanUp()
}
eventAllTestsStart = {
phasesToRun << "loadtest"
}

private determineGitRevisionNumber = {
String revisionNumber = 'dev'
try {
Expand All @@ -31,7 +51,7 @@ eventWarStart = {
}

eventRunAppStart = {
log.info "Setting build date, build number, and revision number ..."
log.info "Setting build date, build number, and revision number ..."
String revisionNumber = determineGitRevisionNumber()

def buildNumber = metadata.'app.buildNumber'
Expand All @@ -41,7 +61,7 @@ eventRunAppStart = {
metadata.'app.revisionNumber' = revisionNumber
metadata.'app.buildDate' = new java.text.SimpleDateFormat("dd MMM yyyy hh:mm:ss a").format(new java.util.Date());
metadata.'app.buildNumber' = buildNumber.toString()
//metadata.persist()
//metadata.persist()
}

eventCreateWarStart = { warName, stagingDir ->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.pih.warehouse.inventory


import org.pih.warehouse.product.Product
import org.pih.warehouse.core.Constants
import org.pih.warehouse.core.Location
import org.pih.warehouse.core.LocationType
import org.pih.warehouse.core.Tag;
import org.pih.warehouse.core.User;

class InventoryServiceTests extends GroovyTestCase {
void test_something() {
def inventoryService = new InventoryService()
assert inventoryService
}

}

0 comments on commit 4555dbf

Please sign in to comment.