Skip to content

Instantly share code, notes, and snippets.

View rupzme's full-sized avatar

Rupert Anderson rupzme

View GitHub Profile
------ solr index issue -------
<target name="setupSolr" description="Creates the SOLR standalone setup by copying the SOLR setup from Pangaea2 source code.">
<copy todir="${local.solr.setup.dir.path}">
<fileset dir="${source.pangaea2.solr.base.dir.path}"/>
</copy>
</target>
https://wiki.hybris.com/pages/viewpage.action?pageId=308361467
import java.net.URLEncoder;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
/**
* Sign an unsigned URL.
* @param path The URL-encoded path including the leading slash. E.g. "/1.0/account/1/2".
* @param key The access key id of the secret access key to use for creating the
* signature.
* @param expires The time in seconds from the Epoch when the signature expires.
package com.company;
/*
Simple TLS1.2 HTTP client for use in java 1.7
Uses Apache libraries:
httpclient-4.5.2.jar
httpcore-4.4.5.jar
commons-codec-1.10.jar
/*
* For a chosen REST Service POST request:
*
* -> Manually specify a new request body
* -> Update the request of ALL (POST) REST TestRequest TestSteps contained in ALL TestCases of a chosen TestSuite
*/
//Set TestSuite to update here:
def testSuiteNameToUpdate = "TestSuite 2"
@rupzme
rupzme / SoapUI Groovy Script JSONPath Example
Created October 19, 2015 14:25
SoapUI JSONPath Groovy Script Example Example
import static com.jayway.jsonpath.JsonPath.parse
def json = '''{"quote": {
"id": 12345,
"am ount": 100,
"links": [
{
"rel": "self",
"href": "http://localhost:8080/quote/777"
},
@rupzme
rupzme / SoapUI Properties
Created October 19, 2015 12:11
Random SoapUI Groovy Script Examples involving properties
Project, TestSuite & TestCase properties are actually of type String, but you can still increment them in a variety of ways e.g. by parsing the property value into a int type in a Groovy TestStep:
def ratingsDown = Integer.parseInt(context.expand('${#TestCase#ratings_down}'))
log.info ratingsDown+1
(if ratings_down was 2, this would log 3 - note without the Integer.parseInt(...), this would output 21)
(assumes the propety ratings_down is against a TestCase object, hence the #TestCase# before the property)
To add on insert into a request:
sudo -u root -s
(switch to root user, don't prompt for password)
[Good way to handle linux java packaging and assignment]
Check versions
update-java-alternatives -l
this updates & sets the sym links for all java commands:
sudo update-java-alternatives -s java-7-oracle
@rupzme
rupzme / Hybris Felixible Search Snippets
Last active May 31, 2018 14:47
Hybris Felixible Search Snippets
#Select only products which have at least 1 variant with stock >0
SELECT {p.PK} FROM {Product AS p} WHERE {p.varianttype} IS NOT NULL and
exists ({{SELECT {v.PK} FROM {VariantProduct AS v JOIN stocklevel AS s ON {v.code}={s.productCode}} WHERE {v.baseProduct} = {p.PK} AND {s.available} > 0}})
#Select available stock for a product or variant
select {sl.available} from {stocklevel as sl} where {sl.productCode}="000001"
SELECT count({pk}) FROM {Customer} where {uid} not LIKE '%anonymous%' and {type}='8796099280987'
@rupzme
rupzme / Hybris IMPEX Snippets
Last active October 22, 2020 08:03
Hybris IMPEX Snippets
Exporting:
insert_update ServicePlan; code[unique=true]; subscriptionTerm(id);supercategories[code]
"#% impex.exportItems( ""ServicePlan"" , true );"
insert_update ServicePlan; code[unique=true]; subscriptionTerm(id);supercategories[code]
"#% impex.exportItemsFlexibleSearch(""select {pk} from {ServicePlan} where {catalog}=8796093088344"");"
Remove all items of a type: