You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2020/06/15 13:52:12 UTC

[sling-org-apache-sling-graphql-core] branch master updated (8bb015d -> 21bc400)

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

bdelacretaz pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-graphql-core.git.


    from 8bb015d  Less verbose log
     new 5aaca3c  Don't be an old fart
     new 21bc400  Adapt to stricter InternalRequest behavior

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/sling/graphql/core/it/GraphQLCoreTestSupport.java    | 6 ++++--
 .../apache/sling/graphql/core/schema/RankedSchemaProvidersTest.java | 5 +++++
 2 files changed, 9 insertions(+), 2 deletions(-)


[sling-org-apache-sling-graphql-core] 02/02: Adapt to stricter InternalRequest behavior

Posted by bd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-graphql-core.git

commit 21bc400ba3901c8be58d589ccf191c3c26626ea6
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Jun 15 15:50:46 2020 +0200

    Adapt to stricter InternalRequest behavior
---
 .../apache/sling/graphql/core/schema/RankedSchemaProvidersTest.java  | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/test/java/org/apache/sling/graphql/core/schema/RankedSchemaProvidersTest.java b/src/test/java/org/apache/sling/graphql/core/schema/RankedSchemaProvidersTest.java
index 7fc192b..2e83ae7 100644
--- a/src/test/java/org/apache/sling/graphql/core/schema/RankedSchemaProvidersTest.java
+++ b/src/test/java/org/apache/sling/graphql/core/schema/RankedSchemaProvidersTest.java
@@ -25,6 +25,7 @@ import java.util.Dictionary;
 import java.util.Hashtable;
 
 import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.servlets.ServletResolver;
 import org.apache.sling.graphql.api.SchemaProvider;
 import org.apache.sling.testing.mock.osgi.junit.OsgiContext;
@@ -38,6 +39,7 @@ import org.osgi.framework.ServiceRegistration;
 public class RankedSchemaProvidersTest {
     private final String DEFAULT_SCHEMA_PROVIDER_OUTPUT = "";
     private final int DEFAULT_SERVICE_RANKING = DefaultSchemaProvider.SERVICE_RANKING;
+    private ResourceResolver resourceResolver;
 
     @Rule
     public final OsgiContext context = new OsgiContext();
@@ -49,11 +51,14 @@ public class RankedSchemaProvidersTest {
         context.registerInjectActivateService(new DefaultSchemaProvider(), Constants.SERVICE_RANKING,
                 DefaultSchemaProvider.SERVICE_RANKING);
         context.registerInjectActivateService(new RankedSchemaProviders());
+        resourceResolver = Mockito.mock(ResourceResolver.class);
     }
 
     private void assertProvider(String info, String expected) throws IOException {
         final RankedSchemaProviders sp = context.getService(RankedSchemaProviders.class);
         final Resource r = Mockito.mock(Resource.class);
+        Mockito.when(r.getResourceResolver()).thenReturn(resourceResolver);
+        Mockito.when(r.getPath()).thenReturn("/421");
         assertEquals(info, expected, sp.getSchema(r, null));
     }
 


[sling-org-apache-sling-graphql-core] 01/02: Don't be an old fart

Posted by bd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-graphql-core.git

commit 5aaca3c30190458509d833909c91555263aa1cd1
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Jun 15 15:50:18 2020 +0200

    Don't be an old fart
---
 .../org/apache/sling/graphql/core/it/GraphQLCoreTestSupport.java    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/sling/graphql/core/it/GraphQLCoreTestSupport.java b/src/test/java/org/apache/sling/graphql/core/it/GraphQLCoreTestSupport.java
index e2a2a0b..078c5c6 100644
--- a/src/test/java/org/apache/sling/graphql/core/it/GraphQLCoreTestSupport.java
+++ b/src/test/java/org/apache/sling/graphql/core/it/GraphQLCoreTestSupport.java
@@ -54,6 +54,8 @@ import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
 
 import java.io.Reader;
 import java.io.StringReader;
+import java.time.Duration;
+import java.time.Instant;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -141,9 +143,9 @@ public abstract class GraphQLCoreTestSupport extends TestSupport {
         final int expectedStatus = 200;
         final List<Integer> statuses = new ArrayList<>();
         final String path = "/.json";
-        final long endTime = System.currentTimeMillis() + STARTUP_WAIT_SECONDS * 1000;
+        final Instant endTime = Instant.now().plus(Duration.ofSeconds(STARTUP_WAIT_SECONDS));
 
-        while (System.currentTimeMillis() < endTime) {
+        while(Instant.now().isBefore(endTime)) {
             final int status = executeRequest("GET", path, null, null, null, -1).getStatus();
             statuses.add(status);
             if (status == expectedStatus) {