You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:19:23 UTC

[sling-org-apache-sling-testing-osgi-mock] 12/17: SLING-4780 - Implement MockBundle.getLastModified

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.testing.osgi-mock-1.4.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-osgi-mock.git

commit 4d21da07e1375ef3f38bb54a38d1011798e40300
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Jun 9 15:30:08 2015 +0000

    SLING-4780 - Implement MockBundle.getLastModified
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/testing/mocks/osgi-mock@1684448 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/testing/mock/osgi/MockBundle.java  | 21 +++++++++++++++------
 .../sling/testing/mock/osgi/MockBundleTest.java     |  5 +++++
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/sling/testing/mock/osgi/MockBundle.java b/src/main/java/org/apache/sling/testing/mock/osgi/MockBundle.java
index 9159f6a..523a12e 100644
--- a/src/main/java/org/apache/sling/testing/mock/osgi/MockBundle.java
+++ b/src/main/java/org/apache/sling/testing/mock/osgi/MockBundle.java
@@ -45,6 +45,7 @@ public final class MockBundle implements Bundle {
     private final BundleContext bundleContext;
     private Map<String, String> headers = ImmutableMap.<String, String>of();
     private String symbolicName = "mock-bundle";
+    private long lastModified;
 
     /**
      * Constructor
@@ -106,20 +107,28 @@ public final class MockBundle implements Bundle {
     public void setSymbolicName(String value) {
         this.symbolicName = value;
     }
-    
-    // --- unsupported operations ---
+
     @Override
-    public Enumeration<URL> findEntries(final String path, final String filePattern, final boolean recurse) {
-        throw new UnsupportedOperationException();
+    public long getLastModified() {
+        return lastModified;
     }
 
+    /**
+     * Set the last modified value for the mock bundle 
+     * @param lastModified last modified
+     */
+    public void setLastModified(long lastModified) {
+        this.lastModified = lastModified;
+    }
+
+    // --- unsupported operations ---
     @Override
-    public Enumeration<String> getEntryPaths(final String path) {
+    public Enumeration<URL> findEntries(final String path, final String filePattern, final boolean recurse) {
         throw new UnsupportedOperationException();
     }
 
     @Override
-    public long getLastModified() {
+    public Enumeration<String> getEntryPaths(final String path) {
         throw new UnsupportedOperationException();
     }
 
diff --git a/src/test/java/org/apache/sling/testing/mock/osgi/MockBundleTest.java b/src/test/java/org/apache/sling/testing/mock/osgi/MockBundleTest.java
index 929f9da..e699b5c 100644
--- a/src/test/java/org/apache/sling/testing/mock/osgi/MockBundleTest.java
+++ b/src/test/java/org/apache/sling/testing/mock/osgi/MockBundleTest.java
@@ -72,4 +72,9 @@ public class MockBundleTest {
         assertEquals("name-1", bundle.getSymbolicName());
     }
 
+    @Test
+    public void testGetLastModified() {
+        bundle.setLastModified(42);
+        assertEquals(42, bundle.getLastModified());
+    }
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.