def TestNotEqualsResetPeriod(self):
     actions = [ FailureActionTypeFactory.CreateNoAction(long(1))]
     resetPeriod = FailureActionConfigurationResetPeriodType(1)
     resetPeriod2 = FailureActionConfigurationResetPeriodType(2)
     rebootMsg = FailureActionConfigurationRebootMessageType('MyRebootMessage')
     commandLine = FailureActionConfigurationCommandLineType('MyCommandLine')
     failureActions1 = FailureActionConfigurationType(actions, resetPeriod, rebootMsg, commandLine)
     failureActions2 = FailureActionConfigurationType(actions, resetPeriod2, rebootMsg, commandLine)
     self.assertNotEquals(failureActions1, failureActions2)
Exemplo n.º 2
0
    def GetNewConfig2Params(self):

        failureActionList = []
        failureActionList.append(
            FailureActionTypeFactory.CreateRestartAction(300))
        failureActionList.append(
            FailureActionTypeFactory.CreateRunCommandAction(0))
        rebootMessage = FailureActionConfigurationRebootMessageType(
            'rebootMessage')
        command = FailureActionConfigurationCommandLineType('command')
        resetPeriod = FailureActionConfigurationResetPeriodType(300)
        FailureActions = FailureActionConfigurationType(
            failureActionList, resetPeriod, rebootMessage, command)

        newServiceDefinition = NewServiceDefinition(
            serviceName="TestService",
            displayName="TestService",
            binaryPathName="C:\\Windows\\System32\\cmd.exe /c echo hello",
            delayedAutoStartInfo=False,
            failureFlag=False,
            preShutdownInfo=long(18000),
            serviceSIDInfo='SID_TYPE_UNRESTRICTED',
            description='TestService',
            failureActions=FailureActions)
        return newServiceDefinition
 def TestInitWithListOfFailureActions(self):
     actions = [ FailureActionTypeFactory.CreateNoAction(long(1))]
     resetPeriod = FailureActionConfigurationResetPeriodType(1)
     rebootMsg = FailureActionConfigurationRebootMessageType('MyRebootMessage')
     commandLine = FailureActionConfigurationCommandLineType('MyCommandLine')
     failureActions = FailureActionConfigurationType(actions, resetPeriod, rebootMsg, commandLine)
     t = failureActions.StringValue()
     self.assertEquals(failureActions.StringValue(), failureActions.StringValue())
     self.assertEquals(failureActions.Win32Value(), failureActions.Win32Value())
 def TestInitWithUnBoxedCommandLine(self):
     actions = [ FailureActionTypeFactory.CreateNoAction(long(1))]
     resetPeriod = FailureActionConfigurationResetPeriodType(1)
     rebootMsg = FailureActionConfigurationRebootMessageType('MyRebootMessage')
     commandLine = 'MyCommandLine'
     commandLine1 = FailureActionConfigurationCommandLineType('MyCommandLine')
     config1 = FailureActionConfigurationType(actions, resetPeriod, rebootMsg, commandLine)
     config2 = FailureActionConfigurationType(actions, resetPeriod, rebootMsg, commandLine1)
     self.assertEquals(config1.StringValue(), config2.StringValue())
     self.assertEquals(config1.Win32Value(), config2.Win32Value())
Exemplo n.º 5
0
 def TestNotEquals(self):
     value1 = int(1)
     value2 = int(2)
     t = FailureActionConfigurationResetPeriodType(value1)
     t2 = FailureActionConfigurationResetPeriodType(value2)
     self.assertNotEquals(t, t2)
Exemplo n.º 6
0
 def TestEquals(self):
     value = int(1)
     t = FailureActionConfigurationResetPeriodType(value)
     t2 = FailureActionConfigurationResetPeriodType(value)
     self.assertEquals(t, t2)
Exemplo n.º 7
0
 def TestInitWithCorrectParameters(self):
     value = int(1)
     t = FailureActionConfigurationResetPeriodType(value)
     self.assertEquals(t.StringValue(), value)
     self.assertEquals(t.Win32Value(), value)
Exemplo n.º 8
0
 def TestInitWithParametersNone(self):
     value = None
     t = FailureActionConfigurationResetPeriodType(value)
     self.assertEquals(t.StringValue(), value)
     self.assertEquals(t.Win32Value(), value)
 def TestInitWithNonListOfFailureActions(self):
     action = FailureActionTypeFactory.CreateNoAction(long(1))
     resetPeriod = FailureActionConfigurationResetPeriodType(1)
     rebootMsg = FailureActionConfigurationRebootMessageType('MyRebootMessage')
     commandLine = FailureActionConfigurationCommandLineType('MyCommandLine')
     self.assertRaises(ValueError, FailureActionConfigurationType, action, resetPeriod, rebootMsg, commandLine)