@Test public void testGetResourceId() { final Map<String, String> expectResultsForIds = new LinkedHashMap<>(); expectResultsForIds.put("/test.config", "test.config"); expectResultsForIds.put("http:test.properties", "test.properties"); expectResultsForIds.put("test.jar", "test.jar"); expectResultsForIds.put("test.zip", "test.zip"); for (Map.Entry<String, String> entry : expectResultsForIds.entrySet()) { assertEquals("expect result for id: " + entry.getKey(), entry.getValue(), DefaultSlingSimulator.getResourceId(entry.getKey())); } }
static String getResourceId(final String rawUrl) { final String url = separatorsToUnix(rawUrl); int pos = url.lastIndexOf('/'); if (pos == -1) { pos = url.indexOf(':'); } final String lastIdPart; if (pos != -1) { lastIdPart = url.substring(pos + 1); } else { lastIdPart = url; } return lastIdPart; }
DefaultSlingSimulator implements SlingSimulatorBackend, SlingSimulator { static String getResourceId(final String rawUrl) { final String url = separatorsToUnix(rawUrl); int pos = url.lastIndexOf('/'); if (pos == -1) { pos = url.indexOf(':'); } final String lastIdPart; if (pos != -1) { lastIdPart = url.substring(pos + 1); } else { lastIdPart = url; } return lastIdPart; } }
DefaultSlingSimulator implements SlingSimulatorBackend, SlingSimulator { static String getResourceId(final String rawUrl) { final String url = separatorsToUnix(rawUrl); int pos = url.lastIndexOf('/'); if (pos == -1) { pos = url.indexOf(':'); } final String lastIdPart; if (pos != -1) { lastIdPart = url.substring(pos + 1); } else { lastIdPart = url; } return lastIdPart; }  }
DefaultSlingSimulator implements SlingSimulatorBackend, SlingSimulator { static String getResourceId(final String rawUrl) { final String url = separatorsToUnix(rawUrl); int pos = url.lastIndexOf('/'); if (pos == -1) { pos = url.indexOf(':'); } final String lastIdPart; if (pos != -1) { lastIdPart = url.substring(pos + 1); } else { lastIdPart = url; } return lastIdPart; }  static SlingSimulatorBackend instance(); @Override void startedScan(); @Override void setSession(final Session session); @Override void setPackageManager(final JcrPackageManager packageManager); @Override void setErrorListener(final ErrorListener errorListener); @Override @Nullable SlingInstallable dequeueInstallable(); @SuppressWarnings("unchecked") @Override @NotNull Fun.ThrowingSupplier<ResourceType> open(@NotNull final SlingOpenable<ResourceType> installable); @NotNull JcrPackage openEmbeddedPackage(@NotNull final EmbeddedPackageInstallable installable); @Override @Nullable SlingInstallable addInstallableNode(final @NotNull PackageId parentPackageId,
                                                         final @NotNull Node node); }
DefaultSlingSimulator implements SlingSimulatorBackend, SlingSimulator { static String getResourceId(final String rawUrl) { final String url = separatorsToUnix(rawUrl); int pos = url.lastIndexOf('/'); if (pos == -1) { pos = url.indexOf(':'); } final String lastIdPart; if (pos != -1) { lastIdPart = url.substring(pos + 1); } else { lastIdPart = url; } return lastIdPart; }  static SlingSimulatorBackend instance(); @Override void startedScan(); @Override void setSession(final Session session); @Override void setPackageManager(final JcrPackageManager packageManager); @Override void setErrorListener(final ErrorListener errorListener); @Override @Nullable SlingInstallable dequeueInstallable(); @SuppressWarnings("unchecked") @Override @NotNull Fun.ThrowingSupplier<ResourceType> open(@NotNull final SlingOpenable<ResourceType> installable); @NotNull JcrPackage openEmbeddedPackage(@NotNull final EmbeddedPackageInstallable installable); @Override @Nullable SlingInstallable addInstallableNode(final @NotNull PackageId parentPackageId,
                                                         final @NotNull Node node);  }