@StableMinor(version="12.0", sinceVersion="5.6") public class StructureHelper extends Object
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
).
Constructor and Description |
---|
StructureHelper() |
Modifier and Type | Method and Description |
---|---|
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.
|
ChannelConfig |
createChannelTemplate()
Creates a channel template.
|
ChannelConfig |
createChannelTemplate(ChannelConfig parent)
Creates a channel template within the given parent channel.
|
PageConfig |
createPage()
Creates a page.
|
PageConfig |
createPage(ChannelConfig channelConfig)
Creates a page.
|
PageConfig |
createPageTemplate()
Creates a page template.
|
PageConfig |
createPageTemplate(ChannelConfig channelConfig)
Creates a page template.
|
ServiceInstanceConfig |
createServiceInstance(ChannelConfig channelConfig,
String serviceId)
Creates a service instance.
|
ServiceInstanceConfig |
createServiceInstance(ChannelConfig channelConfig,
String serviceId,
String serviceInstanceName)
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.
|
ServiceInstanceDependencyConfig |
makeDependency(ServiceInstanceConfig serviceInstance,
ServiceInstanceConfig dependentServiceInstance,
String dependencyType)
Creates a dependency between the given service instances and returns the dependency configuration.
Uses the given dependencyType parameter to set the dependency type. |
public ChannelConfig createChannel() throws PortalException
cleanup()
will delete the created channel.PortalException
- if the channel could not be created.public ChannelConfig createChannelTemplate() throws PortalException
cleanup()
will delete the created channel template.PortalException
- if the channel template could not be created.public ChannelConfig createChannel(ChannelConfig parent) throws PortalException
cleanup()
will delete the created channel.parent
- the parent channel where the newly created one will be placed.PortalException
- if the channel could not be created.public ChannelConfig createChannelTemplate(ChannelConfig parent) throws PortalException
cleanup()
will delete the created channel template.parent
- the parent channel where the newly created channel template will be placed.PortalException
- if the channel template could not be created.public PageConfig createPage(ChannelConfig channelConfig) throws PortalException
cleanup()
will delete the created page.channelConfig
- the channel where the page will be created in.PortalException
- if the page could not be created.public PageConfig createPageTemplate(ChannelConfig channelConfig) throws PortalException
cleanup()
will delete the created page template.channelConfig
- the channel where the page template will be created in.PortalException
- if the page template could not be created.public PageConfig createPage() throws PortalException
cleanup()
will delete the created page.PortalException
- if the page could not be created.public PageConfig createPageTemplate() throws PortalException
cleanup()
will delete the created page templates.PortalException
- if the page template could not be created.public ServiceInstanceConfig createServiceInstance(ChannelConfig channelConfig, String serviceId) throws PortalException
cleanup()
will delete the created
service instance.channelConfig
- the channel where the service instance will be created in.serviceId
- the identifier of the service the service instance is of.PortalException
- if the service instance could not be created.public ServiceInstanceConfig createServiceInstance(ChannelConfig channelConfig, String serviceId, String serviceInstanceName) throws PortalException
cleanup()
will delete the created
service instance.channelConfig
- the channel where the service instance will be created in.serviceId
- the identifier of the service the service instance is of.serviceInstanceName
- the name of the service the service instance, or null
to be auto-generated.PortalException
- if the service instance could not be created.public ServiceInstanceConfig createServiceInstance(String serviceId) throws PortalException
cleanup()
will delete the created
service instance.serviceId
- the identifier of the service the service instance is of.PortalException
- if the service instance could not be created.public ServiceInterfaceInstanceConfig createServiceInterfaceInstance(String serviceId, String serviceInterfaceId) throws PortalException
cleanup()
will delete the
created service interface instance.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.PortalException
- if the service interface instance could not be created.public ServiceInterfaceInstanceConfig createServiceInterfaceInstance(ServiceInstanceConfig serviceInstanceConfig, String serviceInterfaceId) throws PortalException
cleanup()
will delete the
created service interface instance.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.PortalException
- if the service interface instance could not be created.public ServiceInterfaceInstanceConfig createServiceInterfaceInstance(PageConfig pageConfig, ServiceInstanceConfig serviceInstanceConfig, String serviceInterfaceId) throws PortalException
cleanup()
will delete the
created service interface instance.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.PortalException
- if the service interface instance could not be created.public ServiceInstanceDependencyConfig makeDependency(ServiceInstanceConfig serviceInstance, ServiceInstanceConfig dependentServiceInstance, String dependencyType) throws PortalException
dependencyType
parameter to set the dependency type.serviceInstance
- the service instance.dependentServiceInstance
- the dependent service instance.dependencyType
- the dependency type.PortalException
- if the dependency couldn't be created.public void cleanup()
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.
LumisXP 12.0.0.190809 - Copyright © 2006–2019 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.