com.silverpeas.web.mock
Class TokenServiceMockWrapper

java.lang.Object
  extended by com.silverpeas.web.mock.TokenServiceMockWrapper
All Implemented Interfaces:
PersistentResourceTokenService

@Named(value="persistentResourceTokenService")
public class TokenServiceMockWrapper
extends Object
implements PersistentResourceTokenService

Author:
Yohann Chastagnier

Constructor Summary
TokenServiceMockWrapper()
          Default constructor into which mock is initialized
 
Method Summary
 PersistentResourceToken get(EntityReference ref)
          Gets the token of the resource referred by the specified EntityReference.
 PersistentResourceToken get(String tokenValue)
          Gets the token with the specified value from the data source.
 PersistentResourceTokenService getTokenServiceMock()
          Gets the mock
 PersistentResourceToken initialize(EntityReference ref)
          Initializes the token of the resource referred by the specified EntityReference.
 void remove(EntityReference ref)
          Removes quietly the token of the resource referred by the specified entity reference.
 void remove(String tokenValue)
          Removes quietly the specified token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TokenServiceMockWrapper

public TokenServiceMockWrapper()
Default constructor into which mock is initialized

Method Detail

getTokenServiceMock

public PersistentResourceTokenService getTokenServiceMock()
Gets the mock

Returns:

initialize

public PersistentResourceToken initialize(EntityReference ref)
                                   throws TokenException
Description copied from interface: PersistentResourceTokenService
Initializes the token of the resource referred by the specified EntityReference. If the resource has already a token, this token is then renewed.

Specified by:
initialize in interface PersistentResourceTokenService
Parameters:
ref - a reference to the resource for which a token will be initialized.
Returns:
a token persisted for the specified resource.
Throws:
TokenException - if an unexpected error occurs while initializing a token.

get

public PersistentResourceToken get(EntityReference ref)
Description copied from interface: PersistentResourceTokenService
Gets the token of the resource referred by the specified EntityReference. If no token exists for the resource, then PersistentResourceToken.NoneToken is returned.

Specified by:
get in interface PersistentResourceTokenService
Parameters:
ref - a reference to the resource for which a token will be initialized.
Returns:
either the token associated with the specified resource or NoneToken if no such token exists.

get

public PersistentResourceToken get(String tokenValue)
Description copied from interface: PersistentResourceTokenService
Gets the token with the specified value from the data source. If no token exists with a such value, then PersistentResourceToken.NoneToken is returned.

Specified by:
get in interface PersistentResourceTokenService
Parameters:
tokenValue - the value of the token to get.
Returns:
either the token with the specified value or NoneToken if no such token exists.

remove

public void remove(EntityReference ref)
Description copied from interface: PersistentResourceTokenService
Removes quietly the token of the resource referred by the specified entity reference.

Specified by:
remove in interface PersistentResourceTokenService
Parameters:
ref - the resource for which the token has to be removed.

remove

public void remove(String tokenValue)
Description copied from interface: PersistentResourceTokenService
Removes quietly the specified token.

Specified by:
remove in interface PersistentResourceTokenService
Parameters:
tokenValue - the String representation of the token to remove.


Copyright © 2016 Silverpeas. All Rights Reserved.