Agent-TCLI

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

transport with users, packages and other pertinent information.
The Agent will log in, join chatrooms if in the user list,
and wait for further commands from authorized users or in a chatroom.

Test script:
A test script is written, Agent::TCLI::Testee, that loads up a Test Transport,
other necessary transports, necessary local packages, and testees.

Using testees, one creates tests ala Test::More with Agent controlling
versions of ok, is_ , and like_ tests.
These will run asynchronously after the testing starts. One must be conscious
of the asynchronous nature of the test flow.

It is necessary to call the test_master->run at the end of the test to ensure
that all tests have completed.

COPYRIGHT AND LICENCE

Copyright (C) 2007, Alcatel-Lucent

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

lib/Agent/TCLI/Package/Tail.pm  view on Meta::CPAN

  type: Param
---
Agent::TCLI::Parameter:
  name: line_max_cache
  alaises: max_cache
  constraints:
    - UINT
  help: The maximum number of lines to keep in the line_cache.
  manual: >
    The line_max_cache parameter sets how many lines to keep in the line cache.
    Since actions are asynchronous, it is a good idea to have at least some
    line cache so that a tail test will work when the action to generate the
    log ocurred before the test was in place.
  type: Param
---
Agent::TCLI::Parameter:
  name: line_hold_time
  alaises: hold_time
  constraints:
    - UINT
  help: The time, in seconds, to keep lines in the cache.

lib/Agent/TCLI/Transport/Test.pm  view on Meta::CPAN

	);

=head1 DESCRIPTION

The Agent::TCLI::Transport::Test module is a bridge between the rest of the TCLI
system and Perl's TAP based testing system. This module uses Test::Builder
underneath and should be compatible with all other Test modules that use
Test::Builder.

The one cautionary note is that Agent::TCLI::Transport::Test runs on top of POE
which is an asynchronous, event based system. Typically, tests will not
complete in the order that they are written. There are various means to
establish control over the completion of prior tests which should be
sufficient for most cases. However, one should not write a test script
without some thought to the ordering needs of the tests and whether extra
tests need to be in place to ensure those needs are met.

=head1 GETTING STARTED

If you are unfamiliar with Perl's Test:: modules, then please see
L<Test::Tutorial> for background information.

lib/Agent/TCLI/Transport/Test.pm  view on Meta::CPAN


=cut

sub run {
	my $self = shift;
	$self->Verbose($self->alias.":run: running (".$self->depth_requests.") requests " );

	# requests still left in queue (How could there not be?)
	if ( $self->depth_requests > 0 )
	{
		# Whatever's left in the queue is bigger than us little synchronous
		# calls. Send it over to the big Dispatch.
		$poe_kernel->post($self->alias, 'Dispatch', 1 );
	}

	# set running state for Timeout.
	$self->running(1);

	$poe_kernel->run;
}

lib/Agent/TCLI/Transport/Test.pm  view on Meta::CPAN

B<asynch> - This dispatches a test as soon as it is ready to go. Sometimes
this may allow a local test to complete before a prior remote test has
been acknowledged, so it is not the default.

=cut

sub post_it{
	my ($self, $style) = @_;
	my $post_it = 0;

	# Currently running partially synchronous by default.
	$style = 'default' unless defined( $style );

	# TODO Option to set default for all runs.
	if ( $dispatch_counter[$$self] == $dispatch_retries[$$self] )
	{
		# if we stalled on something, then skip it
		$post_it = 1;
	}
	elsif ( !defined($style) || $style =~ /default|syncsend/ )  # partially synchronous / ordered
		# make sure we got some response to the previously sent request before sending
	{
		# Have we seen a response yet for the last request?
		$self->Verbose($self->alias.":post_it:$style: sent(".$requests_sent[$$self].") ",1);
		if ( $requests_sent[$$self] == 0 ||
			exists( $responses[$$self]{ $self->make_id($requests_sent[$$self]) } )
		)
		{
			$post_it = 1;
		}
	}
	elsif ( $style =~ /syncresp|done|ordered/ )  # completely synchronous / ordered
		#make sure all created requests have responses before sending another
	{
		my $rmc = $self->responses_contiguous;
		if ( $request_count[$$self] == $rmc )
		{
			$post_it = 1;
		}
		$self->Verbose($self->alias.":post_it:$style: count(".
			$request_count[$$self].") contiguous(".$rmc.")",);
	}
	elsif ( $style =~ /async/  )  # asynchrounous, no other checks necessary
		# who cares, send it now.
	{
			$post_it = 1;
	}
	$self->Verbose($self->alias.":post_it: ($post_it)");
	return($post_it);
}

=item responses_contiguous (   )



( run in 0.407 second using v1.01-cache-2.11-cpan-0d8aa00de5b )