You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2010/02/19 17:26:40 UTC
svn commit: r911859 - in
/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl:
JobEventHandlerTest.java RepositoryTestUtil.java
Author: cziegeler
Date: Fri Feb 19 16:26:40 2010
New Revision: 911859
URL: http://svn.apache.org/viewvc?rev=911859&view=rev
Log:
Add some comments.
Modified:
sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/JobEventHandlerTest.java
sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/RepositoryTestUtil.java
Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/JobEventHandlerTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/JobEventHandlerTest.java?rev=911859&r1=911858&r2=911859&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/JobEventHandlerTest.java (original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/JobEventHandlerTest.java Fri Feb 19 16:26:40 2010
@@ -52,6 +52,10 @@
return this.context;
}
+ /**
+ * Simple setup test which checks if the session and the session listener
+ * is registered.
+ */
@org.junit.Test public void testSetup() throws RepositoryException {
assertEquals(this.handler.applicationId, SLING_ID);
assertEquals(this.handler.repositoryPath, REPO_PATH);
@@ -65,6 +69,9 @@
assertTrue("Handler is not registered as event listener.", found);
}
+ /**
+ * Helper method to create a job event.
+ */
private Event getJobEvent() {
final Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(EventUtil.PROPERTY_JOB_TOPIC, "sling/test");
@@ -73,6 +80,10 @@
return new Event(EventUtil.TOPIC_JOB, props);
}
+ /**
+ * Test simple job execution.
+ * The job is executed once and finished successfully.
+ */
@org.junit.Test public void testSimpleJobExecution() throws Exception {
final JobEventHandler jeh = (JobEventHandler)this.handler;
jeh.handleEvent(getJobEvent());
@@ -92,6 +103,10 @@
assertFalse("Unexpected event received in the given time.", cb.block(5));
}
+ /**
+ * Reschedule test.
+ * The job is rescheduled two times before it fails.
+ */
@org.junit.Test public void testStartJobAndReschedule() throws Exception {
final JobEventHandler jeh = (JobEventHandler)this.handler;
jeh.handleEvent(getJobEvent());
@@ -103,7 +118,6 @@
EventUtil.rescheduleJob(event);
cb.block();
}
-
}
});
assertTrue("No event received in the given time.", cb.block(5));
Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/RepositoryTestUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/RepositoryTestUtil.java?rev=911859&r1=911858&r2=911859&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/RepositoryTestUtil.java (original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/RepositoryTestUtil.java Fri Feb 19 16:26:40 2010
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.sling.event.impl;
import java.io.File;