@Test public void testProbe() { @SuppressWarnings("deprecation") TagService relationTagService = new RelationTagService(); TagService facetedTagService = new FacetedTagService(); DocumentModel doc1 = session.createDocumentModel("/", "doc1", "File"); doc1 = session.createDocument(doc1); DocumentModel doc2 = session.createDocumentModel("/", "doc2", "File"); doc2 = session.createDocument(doc2); session.save(); Migrator migrator = new TagsMigrator(); assertEquals(MIGRATION_STATE_FACETS, migrator.probeState()); relationTagService.tag(session, doc1.getId(), "foo"); assertEquals(MIGRATION_STATE_RELATIONS, migrator.probeState()); facetedTagService.tag(session, doc2.getId(), "bar"); assertEquals(MIGRATION_STATE_RELATIONS, migrator.probeState()); relationTagService.untag(session, doc1.getId(), "foo"); assertEquals(MIGRATION_STATE_FACETS, migrator.probeState()); }
@Override public String probeState() { List<String> repositoryNames = Framework.getService(RepositoryService.class).getRepositoryNames(); if (repositoryNames.stream().map(this::probeRepository).anyMatch(isEqual(MIGRATION_STATE_RELATIONS))) { return MIGRATION_STATE_RELATIONS; } return MIGRATION_STATE_FACETS; }
TagsMigrator extends AbstractRepositoryMigrator { @Override public String probeState() { List<String> repositoryNames = Framework.getService(RepositoryService.class).getRepositoryNames(); if (repositoryNames.stream().map(this::probeRepository).anyMatch(isEqual(MIGRATION_STATE_RELATIONS))) { return MIGRATION_STATE_RELATIONS; } return MIGRATION_STATE_FACETS; } }
TagsMigrator extends AbstractRepositoryMigrator { @Override public String probeState() { List<String> repositoryNames = Framework.getService(RepositoryService.class).getRepositoryNames(); if (repositoryNames.stream().map(this::probeRepository).anyMatch(isEqual(MIGRATION_STATE_RELATIONS))) { return MIGRATION_STATE_RELATIONS; } return MIGRATION_STATE_FACETS; }  }
TagsMigrator extends AbstractRepositoryMigrator { @Override public String probeState() { List<String> repositoryNames = Framework.getService(RepositoryService.class).getRepositoryNames(); if (repositoryNames.stream().map(this::probeRepository).anyMatch(isEqual(MIGRATION_STATE_RELATIONS))) { return MIGRATION_STATE_RELATIONS; } return MIGRATION_STATE_FACETS; }  @Override void notifyStatusChange(); @Override String probeState(); @Override void run(String step, MigrationContext migrationContext); }
TagsMigrator extends AbstractRepositoryMigrator { @Override public String probeState() { List<String> repositoryNames = Framework.getService(RepositoryService.class).getRepositoryNames(); if (repositoryNames.stream().map(this::probeRepository).anyMatch(isEqual(MIGRATION_STATE_RELATIONS))) { return MIGRATION_STATE_RELATIONS; } return MIGRATION_STATE_FACETS; }  @Override void notifyStatusChange(); @Override String probeState(); @Override void run(String step, MigrationContext migrationContext);  }