Friday 25 May 2012

Variable transformation



Problem: When you try to perform a transformation between two variables that are declared like simpleType the you will receive a message:

"Enable to get schema information for source"

Solution: Define an element of the type that you want on the XSD and then declare the variable of that defined type. i.e:

On XSD add these elements:

        <element name="var1" type="string"/>
        <element name="var2" type="string"/>

Create the variables with correspondent Element Type..

try to do the transformation and should work.

Friday 4 May 2012

Webcenter automated deployment using ant

Problem
Webcenter automated deployment is not compatible yet with ojdeploy.

So it will be necessary to use WLST deploy. For that we can use an ant script to call a wlst script file (py) to prepare the mds application
(http://download.oracle.com/docs/cd/E17904_01/webcenter.1111/e12405/wcadm_deploy.htm#BABCCBEB)

Solution

1. Create a deploy.py file as below:


adminUser=sys.argv[6]
adminPassword=sys.argv[7]
adminUrl=sys.argv[8]
connect(adminUser,adminPassword,adminUrl)
domainRuntime()


def deployAll():
     print 'TESTING!'
     archive = getMDSArchiveConfig(='C:/wcportal-1.0.ear')
     archive.setAppMetadataRepository(repository=sys.argv[2],partition=sys.argv[3],type=sys.argv[4],
     jndi=sys.argv[5])
    archive.save()


# Deploy script init
     try:
     deployAll()


except:
    print "Unexpected error: ", sys.exc_info()[0]
    dumpStack()
    raise


2. Change the build.xml file as below:


<target name="deploy" description="deploy" >
<exec executable="${ofm.home}/oracle_common/common/bin/wlst.sh" spawn="false" failonerror="true">
<arg value="/refresh/oracle/testcases/ant_test/deploy.py"/>
<arg value="${earlocation}"/>
<arg value="${wc.mds.repository}"/>
<arg value="${project.build.finalName}"/>
<arg value="${wc.mds.repository.type}"/>
<arg value="${wc.mds.repository.jndi}"/>
<arg value="${wls.username}"/>
<arg value="${wls.password}"/>
<arg value="${wls.server}"/>
</exec>
</target>

Thursday 3 May 2012

Setting up Active Directory Lightweight Directory Service as a Weblogic Authentication Provider


One more fantastic white-papper, now about how to configure BPM to use multiple identity providers. The BPM's libOVD its used as a lightweight directory service.


https://blogs.oracle.com/bpmbestpractice/entry/setting_up_active_directory_lightweight


Functional Testing and Loop Request

To archive such needs use test soapUI capabilities.

In that project there’s included a test case that can be configured to insert n users defined in a properties file.

The script will then create n user joining n to user id (i.e. j.doe23).

To be able to execute this step perform  the following steps:

1.       Edit service endpoint
2.       Expand testsuite existant inside testcase SoapUI project
3.       Expand Test Steps
4.       Double-Click CreateUserProperties
5.       Change the properties according to your needs and saves to the selected properties target file
6.       Double-clicktest-case
7.       Select Run this Test Case (Green play button on left top corner of click test-case)

NOTE: To implement WSSecurity Header on request please change CreateUserRequest test step on test-case.

Groovy code snipped to perform a loop request

// run ten random requests
log.info("In the BC2 Create User Setup Script")

def userIdInStep = testRunner.testCase.getTestStepByName( "CreateUserProperties" )
def firstName = userIdInStep.getPropertyValue( "FirstName" )
def lastName = userIdInStep.getPropertyValue( "LastName" )
def userId = userIdInStep.getPropertyValue( "userId" )
def nTests = userIdInStep.getPropertyValue( "UsersToCreate" )

log.info("Number total of tests: " + nTests)
log.info("Company Mkey: " + nTests)
log.info("Company Address MKey: " + nTests)

def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)

for( i in 1..nTests.toInteger())
{
  def holder = groovyUtils.getXmlHolder( "CreateUserRequest#Request" )
  holder.setNodeValue( "//urn:userId", userId + i)
  holder.setNodeValue( "//urn:lastName", lastName + i)
  
  testRunner.runTestStepByName("CreateUserRequest")
  
  node = holder.getNodeValue("//urn:userId")
  log.info ("Created user: " + node)
  node = holder.getNodeValue("//urn:lastName")
  log.info ("Created user last name: " + node)
}

To use properties directely on request xml

...
               <urn:firstName>${Properties#FirstName}</urn:firstName>
               <urn:lastName>lastName</urn:lastName>
               <urn:language>en</urn:language>
...