datahub-sample.gradle

This template is an example of a Data Hub and SAP Commerce Cloud recipe. They can be started/stopped together or independently, but the essence is that this recipe gives a quick way to start testing Data Hub integration with SAP Commerce Cloud.

apply plugin: 'installer-platform-plugin'
apply plugin: 'installer-datahub-plugin'

description = 'A sample recipe to demonstrate how the Data Hub plugin can be used with the hybris platform installer.\
		To execute the sample recipe change current directory to the project root directory,\
		then set SUITE_HOME environment variable to point to the hybris commerce suite directory\
        (5.5 or higher required), set PLATFORM_HOME environment varable to $SUITE_HOME/hybris/bin/platform,\
        then execute the sample gradle recipe:\
			\'gradle -b datahub-sample.gradle start\''


def ecp = platform {
	localProperties {
		property 'datahubadapter.datahuboutbound.url', 'http://localhost:9797/datahub-webapp/v1'
	}

	extensions {
		/* DataHub Related Extensions */
		extensionNames  'datahubadapter', 'datahubbackoffice'
		/* Required Extensions and Data */
		extDir "${System.env.HOME}/Work/datahub-adapter-test-data/datahubadaptertestdata"
	}
}

def datahubServerId = 'datahub-webapp'
def datahubCfg = {
	resources {
		propertyFile "local", {
			property 'datahub.extension.exportURL', 'http://localhost:9001/datahubadapter'
			property 'datahub.extension.userName', 'datahubimporterusername'
			property 'datahub.extension.password', 'datahubimporterpassword'
			property 'datahub.encryption.key.path', 'encryption-key.txt'
			property 'datahub.server.url', "http://localhost:9797/datahub-webapp/v1"

			property 'datahub.security.basic.admin.user', 'datahubadmin'
			property 'datahub.security.basic.admin.password', 'yourpassword'
			property 'datahub.security.basic.read_only.user', 'readonly'
			property 'datahub.security.basic.read_only.password', 'onlyread'
		}
		resource 'encryption-key.txt', content: "8fae27b02e4e64dfb79f18947743b6f9"
	}

	// define path to the directory to which datahub-suite-*.zip was unzipped
	def dataHubSuiteHome = "$System.env.HOME/datahub"
	webappDir "${dataHubSuiteHome}/hybris/bin/ext-integration/datahub/web-app"

	ports {
		http 9797
		ssl 9793
	}
}

task setupDatahub << {
	datahub(datahubServerId).setup datahubCfg
}

task startDatahub << {
	def CATALINA_OPTS = "-Xms4096m -Xmx4096m -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+AlwaysPreTouch -XX:+DisableExplicitGC -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing"
	datahub(datahubServerId).start CATALINA_OPTS
}

task stopDatahub << {
	datahub(datahubServerId).stop()
}

task setupPlatform << {
	ecp.setup()
}

task build(dependsOn: [setupPlatform]) << {
	ecp.build()
}

task init(dependsOn: [build]) << {
	ecp.executeAntTarget "initialize -DconfigFile=${installerHome}/recipes/datahub_platform/platform_init_config.json"
//	ecp.initialize()
}

task startPlatform << {
	ecp.startInBackground()
}

task stopPlatform << {
	ecp.stopInBackground()
}

task setup(dependsOn: [setupPlatform, setupDatahub])

task start(dependsOn: [startPlatform, startDatahub])