issrg.test.environmentalAttributes
Class GetAttributesTest

java.lang.Object
  extended by issrg.pba.rbac.Time
      extended by issrg.pba.rbac.Clock
          extended by issrg.test.environmentalAttributes.GetAttributesTest
All Implemented Interfaces:
java.lang.Comparable, java.util.Comparator

public class GetAttributesTest
extends Clock
implements java.util.Comparator

This class defines a regression test, which tests the function of getting environmental attribute specifications from the current policy.

Author:
Linying Su

Field Summary
 
Fields inherited from class issrg.pba.rbac.Time
log, s_defaultTimeZone, TIME_TYPE
 
Constructor Summary
GetAttributesTest()
          Creates a new instance of GetAttributesTest
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
           
 org.w3c.dom.Element getAttributes()
           
 java.util.Date getTime()
          This method returns the time returned by the last call to latch, so all calculations will be consistent.
 void initialise(java.lang.String name)
          this is used to initialise a PERMIS instance.
 java.util.Date latch()
          The time is stopped forever, so the latch returns the same as getTime()
static void main(java.lang.String[] args)
           
 void setTime(java.util.Date time)
          This method sets the current time.
 java.util.Date toTime(java.lang.String timeString)
          This method returns the time encoded as a string.
 
Methods inherited from class issrg.pba.rbac.Clock
getEvaluationTime
 
Methods inherited from class issrg.pba.rbac.Time
calendarToTime, calendarToTime, compareTo, equals, getDefaultTimeZone, parse, register, setDefaultTimeZone, setDefaultTimeZone, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

GetAttributesTest

public GetAttributesTest()
                  throws HandlerServiceException
Creates a new instance of GetAttributesTest

Throws:
HandlerServiceException
Method Detail

main

public static void main(java.lang.String[] args)

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Specified by:
compare in interface java.util.Comparator

initialise

public void initialise(java.lang.String name)
                throws HandlerServiceException
this is used to initialise a PERMIS instance.

Parameters:
name, - which is a configuration file name
Throws:
HandlerServiceException

latch

public java.util.Date latch()
The time is stopped forever, so the latch returns the same as getTime()

Specified by:
latch in class Clock
Returns:
the current time

getTime

public java.util.Date getTime()
Description copied from class: Clock
This method returns the time returned by the last call to latch, so all calculations will be consistent.

Specified by:
getTime in class Clock
Returns:
the time returned by the last call to latch

toTime

public java.util.Date toTime(java.lang.String timeString)
                      throws java.lang.IllegalArgumentException
This method returns the time encoded as a string.

Parameters:
timeString - - the time to set; the format is the same as the string representation of time in the policy, e.g. "2005-09-25T23:59:59"
Returns:
the Date representing the specified time.
Throws:
java.lang.IllegalArgumentException

setTime

public void setTime(java.util.Date time)
This method sets the current time. Initially the time is set to the time of the application startup.

Parameters:
time - - the time to set.

getAttributes

public org.w3c.dom.Element getAttributes()
                                  throws HandlerServiceException
Throws:
HandlerServiceException