@Test public void shouldOrderLinks() throws Exception { when(repository.getUrl()).thenReturn("http: when(component1.name()).thenReturn("z"); when(component2.name()).thenReturn("a"); when(component3.name()).thenReturn("0"); when(tx.browseComponents(any())).thenReturn(Arrays.asList( component1, component2, component3 )); underTest.attach(repository); List<PyPiLink> links = underTest.findAllLinks(); String[] result = links.stream().map(PyPiLink::getFile).distinct().toArray(String[]::new); assertThat(result[0], is("0")); assertThat(result[1], is("a")); assertThat(result[2], is("z")); }
@Transactional protected List<PyPiLink> findAllLinks() { StorageTx tx = UnitOfWork.currentTx(); Map<String, PyPiLink> links = new TreeMap<>(); Iterable<Component> components = tx.browseComponents(tx.findBucket(getRepository())); components.forEach(c -> links.put(c.name(), new PyPiLink(c.name(), c.name() + "/"))); return new ArrayList<>(links.values()); }
OrientPyPiHostedFacetImpl extends FacetSupport implements OrientPyPiHostedFacet { @Transactional protected List<PyPiLink> findAllLinks() { StorageTx tx = UnitOfWork.currentTx(); Map<String, PyPiLink> links = new TreeMap<>(); Iterable<Component> components = tx.browseComponents(tx.findBucket(getRepository())); components.forEach(c -> links.put(c.name(), new PyPiLink(c.name(), c.name() + "/"))); return new ArrayList<>(links.values()); } }
OrientPyPiHostedFacetImpl extends FacetSupport implements OrientPyPiHostedFacet { @Transactional protected List<PyPiLink> findAllLinks() { StorageTx tx = UnitOfWork.currentTx(); Map<String, PyPiLink> links = new TreeMap<>(); Iterable<Component> components = tx.browseComponents(tx.findBucket(getRepository())); components.forEach(c -> links.put(c.name(), new PyPiLink(c.name(), c.name() + "/"))); return new ArrayList<>(links.values()); } @Inject  OrientPyPiHostedFacetImpl(final TemplateHelper templateHelper); }
OrientPyPiHostedFacetImpl extends FacetSupport implements OrientPyPiHostedFacet { @Transactional protected List<PyPiLink> findAllLinks() { StorageTx tx = UnitOfWork.currentTx(); Map<String, PyPiLink> links = new TreeMap<>(); Iterable<Component> components = tx.browseComponents(tx.findBucket(getRepository())); components.forEach(c -> links.put(c.name(), new PyPiLink(c.name(), c.name() + "/"))); return new ArrayList<>(links.values()); } @Inject  OrientPyPiHostedFacetImpl(final TemplateHelper templateHelper); @Override @TransactionalStoreBlob @Nullable Content getRootIndex(); @Override @TransactionalStoreBlob Content getIndex(final String name); @Override @TransactionalTouchBlob Content getPackage(final String packagePath); @TransactionalStoreBlob @Override Asset upload(final String filename, final Map<String, String> attributes, final TempBlobPartPayload payload); @TransactionalStoreBlob @Override Content uploadSignature(
      final String name,
      final String version,
      final TempBlobPartPayload payload); @Override Asset upload(final SignablePyPiPackage pyPiPackage); @Override String createPackagePath(final String name, final String version, final String filename); @Override Map<String, String> extractMetadata(final TempBlob tempBlob); }
OrientPyPiHostedFacetImpl extends FacetSupport implements OrientPyPiHostedFacet { @Transactional protected List<PyPiLink> findAllLinks() { StorageTx tx = UnitOfWork.currentTx(); Map<String, PyPiLink> links = new TreeMap<>(); Iterable<Component> components = tx.browseComponents(tx.findBucket(getRepository())); components.forEach(c -> links.put(c.name(), new PyPiLink(c.name(), c.name() + "/"))); return new ArrayList<>(links.values()); } @Inject  OrientPyPiHostedFacetImpl(final TemplateHelper templateHelper); @Override @TransactionalStoreBlob @Nullable Content getRootIndex(); @Override @TransactionalStoreBlob Content getIndex(final String name); @Override @TransactionalTouchBlob Content getPackage(final String packagePath); @TransactionalStoreBlob @Override Asset upload(final String filename, final Map<String, String> attributes, final TempBlobPartPayload payload); @TransactionalStoreBlob @Override Content uploadSignature(
      final String name,
      final String version,
      final TempBlobPartPayload payload); @Override Asset upload(final SignablePyPiPackage pyPiPackage); @Override String createPackagePath(final String name, final String version, final String filename); @Override Map<String, String> extractMetadata(final TempBlob tempBlob);  }