lumis.lptf.portal.structure
Class StructureHelper

Package class diagram package StructureHelper
java.lang.Object
  extended by lumis.lptf.portal.structure.StructureHelper

@StableMinor(version="6.2",
             sinceVersion="5.6")
public class StructureHelper
extends Object

Helper class that provides common functionalities needed to perform tests with Service Interfaces.

Possible operations:

All the methods use the current session and the current transaction. The exception to this rule is the cleanup method that starts and ends its own transaction and session. So, if the client code needs to commit the current transaction during the test it is not a problem, since the cleanup will run using a new transaction.

The recommended way to use the StructureHelper is instantiate a new helper, create and start a new transaction and session and create the needed structure to the tests using the helper (since it uses the current transaction and session). When the created structure is no longer necessary, the client code should ends the transaction and the session and call the cleanup() method.

When using JUnit, the StructureHelper instance may be stored as an attribute, initialized during the setUp (or @Before), and the cleanup method may be called from the tearDown (or @After).

Since:
5.6.0

Constructor Summary
StructureHelper()
           
 
Method Summary
 void cleanup()
          Deletes structure elements created by this StructureHelper, such as channels, pages and service interface instances.
 ChannelConfig createChannel()
          Creates a channel.
 ChannelConfig createChannel(ChannelConfig parent)
          Creates a channel within the given parent channel.
 PageConfig createPage()
          Creates a page.
 PageConfig createPage(ChannelConfig channelConfig)
          Creates a page.
 ServiceInstanceConfig createServiceInstance(ChannelConfig channelConfig, String serviceId)
          Creates a service instance.
 ServiceInstanceConfig createServiceInstance(String serviceId)
          Creates a service instance.
 ServiceInterfaceInstanceConfig createServiceInterfaceInstance(PageConfig pageConfig, ServiceInstanceConfig serviceInstanceConfig, String serviceInterfaceId)
          Creates a service interface instance.
 ServiceInterfaceInstanceConfig createServiceInterfaceInstance(ServiceInstanceConfig serviceInstanceConfig, String serviceInterfaceId)
          Creates a service interface instance.
 ServiceInterfaceInstanceConfig createServiceInterfaceInstance(String serviceId, String serviceInterfaceId)
          Creates a service interface instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StructureHelper

public StructureHelper()
Method Detail

createChannel

public ChannelConfig createChannel()
                            throws PortalException
Creates a channel. cleanup() will delete the created channel.

Returns:
the created channel.
Throws:
PortalException - if the channel could not be created.

createChannel

public ChannelConfig createChannel(ChannelConfig parent)
                            throws PortalException
Creates a channel within the given parent channel. cleanup() will delete the created channel.

Parameters:
parent - the parent channel where the newly created one will be placed.
Returns:
the created channel.
Throws:
PortalException - if the channel could not be created.

createPage

public PageConfig createPage(ChannelConfig channelConfig)
                      throws PortalException
Creates a page. cleanup() will delete the created page.

Parameters:
channelConfig - the channel where the page will be created in.
Returns:
the created page.
Throws:
PortalException - if the page could not be created.

createPage

public PageConfig createPage()
                      throws PortalException
Creates a page. cleanup() will delete the created page.

Returns:
the created page.
Throws:
PortalException - if the page could not be created.

createServiceInstance

public ServiceInstanceConfig createServiceInstance(ChannelConfig channelConfig,
                                                   String serviceId)
                                            throws PortalException
Creates a service instance. cleanup() will delete the created service instance.

Parameters:
channelConfig - the channel where the service instance will be created in.
serviceId - the identifier of the service the service instance is of.
Returns:
the created service instance.
Throws:
PortalException - if the service instance could not be created.

createServiceInstance

public ServiceInstanceConfig createServiceInstance(String serviceId)
                                            throws PortalException
Creates a service instance. cleanup() will delete the created service instance.

Parameters:
serviceId - the identifier of the service the service instance is of.
Returns:
the created service instance.
Throws:
PortalException - if the service instance could not be created.

createServiceInterfaceInstance

public ServiceInterfaceInstanceConfig createServiceInterfaceInstance(String serviceId,
                                                                     String serviceInterfaceId)
                                                              throws PortalException
Creates a service interface instance. cleanup() will delete the created service interface instance.

Parameters:
serviceId - the identifier of the service the service interface instance is of.
serviceInterfaceId - the identifier of the interface the service interface instance is of. Does not include the service identifier in it.
Returns:
the created service interface instance.
Throws:
PortalException - if the service interface instance could not be created.
Since:
5.6.0

createServiceInterfaceInstance

public ServiceInterfaceInstanceConfig createServiceInterfaceInstance(ServiceInstanceConfig serviceInstanceConfig,
                                                                     String serviceInterfaceId)
                                                              throws PortalException
Creates a service interface instance. cleanup() will delete the created service interface instance.

Parameters:
serviceInstanceConfig - the service instance the service interface instance is to belong to.
serviceInterfaceId - the identifier of the interface the service interface instance is of. Does not include the service identifier in it.
Returns:
the created service interface instance.
Throws:
PortalException - if the service interface instance could not be created.
Since:
5.6.0

createServiceInterfaceInstance

public ServiceInterfaceInstanceConfig createServiceInterfaceInstance(PageConfig pageConfig,
                                                                     ServiceInstanceConfig serviceInstanceConfig,
                                                                     String serviceInterfaceId)
                                                              throws PortalException
Creates a service interface instance. cleanup() will delete the created service interface instance.

Parameters:
pageConfig - the page the service interface is to belong to.
serviceInstanceConfig - the service instance the service interface instance is to belong to.
serviceInterfaceId - the identifier of the interface the service interface instance is of. Does not include the service identifier in it.
Returns:
the created service interface instance.
Throws:
PortalException - if the service interface instance could not be created.
Since:
5.6.0

cleanup

public void cleanup()
Deletes structure elements created by this StructureHelper, such as channels, pages and service interface instances.

The objects are deleted in the inverse order which they were created by this helper. This have to be taken into account if your test has some dependencies in its structure.

Since:
5.6.0


Lumisportal  6.2.0.120405 - Copyright © 2006–2012 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.