Skip to main content

Posts

Liferay - Adding role subtype

By default liferay provides three types of role's  Site Oraganization Regular To derive a custom role type out of the existing types, use below property in protal-ext.properties roles.regular.subtypes=mysubtype1, mysubtype2 After creating a role using control panel, click on edit to select the subtype

Testing Restful API with Spock - groovy

Spock is a testing and specification framework for Java and Groovy applications. Here we will use groovy RestClient along with Spock to test Restful Services. import groovyx.net.http.RESTClient import spock.lang.Specification import spock.lang.Shared class MyApiSpec extends Specification { @Shared RESTClient restClient def setupSpec() {                 restClient = new RESTClient('hostnamewithport') restClient.handler.failure  = restClient.handler.success }  def 'test get method'(){  given:  restClient.headers.Accept = 'application/json'  when:  def resp = restClient .get(path: 'path(ex:/api/list/'), query:[param1:'param1value',param2:'param2value'] )  then:  resp.status == 200  resp.data.somejsonobject == 'expectedjson'  }  def 'test post method'(){  given:  restClient .headers.Accept = 'appli...