Search in sources :

Example 1 with Promise

use of com.b2international.snowowl.core.events.util.Promise in project snow-owl by b2ihealthcare.

the class SnomedExportApiTest method executeMultipleExportsAtTheSameTime.

@Test
public void executeMultipleExportsAtTheSameTime() throws Exception {
    Promise<Attachment> first = SnomedRequests.rf2().prepareExport().setReleaseType(Rf2ReleaseType.FULL).setCountryNamespaceElement("INT").setRefSetExportLayout(Rf2RefSetExportLayout.COMBINED).setLocales(LOCALES).build(branchPath.getPath()).execute(getBus());
    Promise<Attachment> second = SnomedRequests.rf2().prepareExport().setCountryNamespaceElement("INT").setRefSetExportLayout(Rf2RefSetExportLayout.COMBINED).setReleaseType(Rf2ReleaseType.SNAPSHOT).setLocales(LOCALES).build(branchPath.getPath()).execute(getBus());
    String message = Promise.all(first, second).then(input -> {
        Attachment firstResult = (Attachment) input.get(0);
        Attachment secondResult = (Attachment) input.get(1);
        InternalAttachmentRegistry fileRegistry = (InternalAttachmentRegistry) ApplicationContext.getServiceForClass(AttachmentRegistry.class);
        File firstArchive = fileRegistry.getAttachment(firstResult.getAttachmentId());
        File secondArchive = fileRegistry.getAttachment(secondResult.getAttachmentId());
        final Map<String, Boolean> firstArchiveMap = ImmutableMap.<String, Boolean>builder().put("sct2_Concept_Full", true).build();
        final Map<String, Boolean> secondArchiveMap = ImmutableMap.<String, Boolean>builder().put("sct2_Concept_Snapshot", true).build();
        try {
            assertArchiveContainsFiles(firstArchive, firstArchiveMap);
            assertArchiveContainsFiles(secondArchive, secondArchiveMap);
        } catch (Exception e) {
            return e.getMessage();
        }
        fileRegistry.delete(firstResult.getAttachmentId());
        fileRegistry.delete(secondResult.getAttachmentId());
        return null;
    }).fail(input -> input.getMessage()).getSync(2, TimeUnit.MINUTES);
    assertNull(message, message);
}
Also used : InternalAttachmentRegistry(com.b2international.snowowl.core.attachments.InternalAttachmentRegistry) SnomedExportRestRequests.export(com.b2international.snowowl.snomed.core.rest.SnomedExportRestRequests.export) ArrayListMultimap(com.google.common.collect.ArrayListMultimap) RestExtensions.assertCreated(com.b2international.snowowl.test.commons.rest.RestExtensions.assertCreated) RestExtensions(com.b2international.snowowl.test.commons.rest.RestExtensions) Json(com.b2international.commons.json.Json) SnomedRestFixtures(com.b2international.snowowl.snomed.core.rest.SnomedRestFixtures) java.nio.file(java.nio.file) Pair(com.b2international.commons.Pair) SnomedComponentType(com.b2international.snowowl.snomed.core.rest.SnomedComponentType) SnomedComponentRestRequests.getComponent(com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.getComponent) Map(java.util.Map) RevisionIndex(com.b2international.index.revision.RevisionIndex) SnomedComponentRestRequests.updateComponent(com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.updateComponent) Sets.newHashSet(com.google.common.collect.Sets.newHashSet) AttachmentRegistry(com.b2international.snowowl.core.attachments.AttachmentRegistry) MODULE_SCT_CORE(com.b2international.snowowl.snomed.common.SnomedConstants.Concepts.MODULE_SCT_CORE) UK_ACCEPTABLE_MAP(com.b2international.snowowl.snomed.core.rest.SnomedApiTestConstants.UK_ACCEPTABLE_MAP) ResourceURI(com.b2international.snowowl.core.ResourceURI) CodeSystemRestRequests(com.b2international.snowowl.test.commons.codesystem.CodeSystemRestRequests) ImmutableMap(com.google.common.collect.ImmutableMap) Collection(java.util.Collection) Set(java.util.Set) ROOT_CONCEPT(com.b2international.snowowl.snomed.common.SnomedConstants.Concepts.ROOT_CONCEPT) Sets(com.google.common.collect.Sets) List(java.util.List) SnomedRefSetRestRequests.updateRefSetMemberEffectiveTime(com.b2international.snowowl.snomed.core.rest.SnomedRefSetRestRequests.updateRefSetMemberEffectiveTime) Entry(java.util.Map.Entry) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest) Joiner(com.google.common.base.Joiner) CodeSystem(com.b2international.snowowl.core.codesystem.CodeSystem) EffectiveTimes(com.b2international.snowowl.core.date.EffectiveTimes) CodeSystemVersionRestRequests.createVersion(com.b2international.snowowl.test.commons.codesystem.CodeSystemVersionRestRequests.createVersion) CoreMatchers.equalTo(org.hamcrest.CoreMatchers.equalTo) SnomedRefSetRestRequests.updateRefSetComponent(com.b2international.snowowl.snomed.core.rest.SnomedRefSetRestRequests.updateRefSetComponent) Promise(com.b2international.snowowl.core.events.util.Promise) com.b2international.snowowl.snomed.core.domain(com.b2international.snowowl.snomed.core.domain) Multimap(com.google.common.collect.Multimap) Concepts(com.b2international.snowowl.snomed.common.SnomedConstants.Concepts) ExtendedLocale(com.b2international.commons.http.ExtendedLocale) SnomedRequests(com.b2international.snowowl.snomed.datastore.request.SnomedRequests) InternalAttachmentRegistry(com.b2international.snowowl.core.attachments.InternalAttachmentRegistry) Attachment(com.b2international.snowowl.core.attachments.Attachment) SnomedComponentRestRequests.createComponent(com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.createComponent) SnomedReferenceSetMembers(com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMembers) UK_PREFERRED_MAP(com.b2international.snowowl.snomed.core.rest.SnomedApiTestConstants.UK_PREFERRED_MAP) BranchPathUtils(com.b2international.snowowl.core.branch.BranchPathUtils) SnomedApiTestConstants(com.b2international.snowowl.snomed.core.rest.SnomedApiTestConstants) DateFormats(com.b2international.snowowl.core.date.DateFormats) CommitResult(com.b2international.snowowl.core.request.CommitResult) SnomedExportRestRequests.doExport(com.b2international.snowowl.snomed.core.rest.SnomedExportRestRequests.doExport) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) Test(org.junit.Test) BasicFileAttributes(java.nio.file.attribute.BasicFileAttributes) File(java.io.File) CodeSystemRestRequests.createCodeSystem(com.b2international.snowowl.test.commons.codesystem.CodeSystemRestRequests.createCodeSystem) TimeUnit(java.util.concurrent.TimeUnit) Assert.assertNull(org.junit.Assert.assertNull) Ignore(org.junit.Ignore) SnomedRf2Headers(com.b2international.snowowl.snomed.common.SnomedRf2Headers) IBranchPath(com.b2international.snowowl.core.api.IBranchPath) Assert.assertEquals(org.junit.Assert.assertEquals) ApplicationContext(com.b2international.snowowl.core.ApplicationContext) SnomedRefSetType(com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType) AttachmentRegistry(com.b2international.snowowl.core.attachments.AttachmentRegistry) InternalAttachmentRegistry(com.b2international.snowowl.core.attachments.InternalAttachmentRegistry) Attachment(com.b2international.snowowl.core.attachments.Attachment) File(java.io.File) IOException(java.io.IOException) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest) Test(org.junit.Test)

Example 2 with Promise

use of com.b2international.snowowl.core.events.util.Promise in project snow-owl by b2ihealthcare.

the class SnomedBranchRequestTest method createTwoBranchesSameTimeWithSameName.

@Test
public void createTwoBranchesSameTimeWithSameName() throws Exception {
    final Branching branches = RepositoryRequests.branching();
    // try to create two branches at the same time
    final String branchName = UUID.randomUUID().toString();
    final Promise<String> first = branches.prepareCreate().setParent(branchPath).setName(branchName).build(REPOSITORY_ID).execute(bus);
    final Promise<String> second = branches.prepareCreate().setParent(branchPath).setName(branchName).build(REPOSITORY_ID).execute(bus);
    final boolean sameBaseTimestamp = Promise.all(first, second).then(input -> {
        final Branch first1 = branches.prepareGet((String) input.get(0)).build(REPOSITORY_ID).execute(bus).getSync();
        final Branch second1 = branches.prepareGet((String) input.get(1)).build(REPOSITORY_ID).execute(bus).getSync();
        return first1.baseTimestamp() == second1.baseTimestamp();
    }).fail(e -> {
        if (e instanceof AlreadyExistsException) {
            return true;
        } else {
            throw new RuntimeException(e);
        }
    }).getSync();
    // fail the test only when the API managed to create two branches with different base timestamp which should not happen
    if (!sameBaseTimestamp) {
        fail("Two branches created with the same name but different baseTimestamp");
    }
}
Also used : BaseRevisionBranching(com.b2international.index.revision.BaseRevisionBranching) Branching(com.b2international.snowowl.core.branch.Branching) BaseRevisionBranching(com.b2international.index.revision.BaseRevisionBranching) Acceptability(com.b2international.snowowl.snomed.core.domain.Acceptability) SortedSet(java.util.SortedSet) RestExtensions(com.b2international.snowowl.test.commons.rest.RestExtensions) RevisionBranch(com.b2international.index.revision.RevisionBranch) Promise(com.b2international.snowowl.core.events.util.Promise) Branch(com.b2international.snowowl.core.branch.Branch) Merging(com.b2international.snowowl.core.branch.Merging) RepositoryRequests(com.b2international.snowowl.core.repository.RepositoryRequests) Concepts(com.b2international.snowowl.snomed.common.SnomedConstants.Concepts) SnomedRequests(com.b2international.snowowl.snomed.datastore.request.SnomedRequests) AlreadyExistsException(com.b2international.commons.exceptions.AlreadyExistsException) Assert.fail(org.junit.Assert.fail) SnomedDescriptionCreateRequestBuilder(com.b2international.snowowl.snomed.datastore.request.SnomedDescriptionCreateRequestBuilder) Branching(com.b2international.snowowl.core.branch.Branching) TestMethodNameRule(com.b2international.snowowl.test.commons.TestMethodNameRule) Before(org.junit.Before) BranchPathUtils(com.b2international.snowowl.core.branch.BranchPathUtils) CommitResult(com.b2international.snowowl.core.request.CommitResult) RepositoryManager(com.b2international.snowowl.core.RepositoryManager) ImmutableMap(com.google.common.collect.ImmutableMap) Request(com.b2international.snowowl.core.events.Request) Merge(com.b2international.snowowl.core.merge.Merge) JsonSupport(com.b2international.snowowl.core.repository.JsonSupport) Test(org.junit.Test) RevisionSegment(com.b2international.index.revision.RevisionSegment) RemoteJobEntry(com.b2international.snowowl.core.jobs.RemoteJobEntry) IEventBus(com.b2international.snowowl.eventbus.IEventBus) UUID(java.util.UUID) SnomedTerminologyComponentConstants(com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants) Assert.assertNotEquals(org.junit.Assert.assertNotEquals) Services(com.b2international.snowowl.test.commons.Services) Rule(org.junit.Rule) JobRequests(com.b2international.snowowl.core.jobs.JobRequests) ServiceProvider(com.b2international.snowowl.core.ServiceProvider) AsyncRequest(com.b2international.snowowl.core.events.AsyncRequest) User(com.b2international.snowowl.core.identity.User) SnomedIdentifiers(com.b2international.snowowl.snomed.cis.SnomedIdentifiers) Assert.assertEquals(org.junit.Assert.assertEquals) ApplicationContext(com.b2international.snowowl.core.ApplicationContext) AlreadyExistsException(com.b2international.commons.exceptions.AlreadyExistsException) RevisionBranch(com.b2international.index.revision.RevisionBranch) Branch(com.b2international.snowowl.core.branch.Branch) Test(org.junit.Test)

Example 3 with Promise

use of com.b2international.snowowl.core.events.util.Promise in project snow-owl by b2ihealthcare.

the class SnomedBranchRequestTest method createTwoBranchesSameTimeWithDifferentName.

@Test
public void createTwoBranchesSameTimeWithDifferentName() throws Exception {
    final Branching branches = RepositoryRequests.branching();
    // try to create two branches at the same time
    final String branchA = UUID.randomUUID().toString();
    final String branchB = UUID.randomUUID().toString();
    final Promise<String> first = branches.prepareCreate().setParent(branchPath).setName(branchA).build(REPOSITORY_ID).execute(bus);
    final Promise<String> second = branches.prepareCreate().setParent(branchPath).setName(branchB).build(REPOSITORY_ID).execute(bus);
    Promise.all(first, second).then(input -> {
        final Branch firstBranch = branches.prepareGet((String) input.get(0)).build(REPOSITORY_ID).execute(bus).getSync();
        final Branch secondBranch = branches.prepareGet((String) input.get(1)).build(REPOSITORY_ID).execute(bus).getSync();
        assertBranchesCreated(branchA, branchB, firstBranch, secondBranch);
        assertBranchSegmentsValid(branchPath, firstBranch.path(), secondBranch.path());
        return null;
    }).getSync();
}
Also used : BaseRevisionBranching(com.b2international.index.revision.BaseRevisionBranching) Branching(com.b2international.snowowl.core.branch.Branching) BaseRevisionBranching(com.b2international.index.revision.BaseRevisionBranching) Acceptability(com.b2international.snowowl.snomed.core.domain.Acceptability) SortedSet(java.util.SortedSet) RestExtensions(com.b2international.snowowl.test.commons.rest.RestExtensions) RevisionBranch(com.b2international.index.revision.RevisionBranch) Promise(com.b2international.snowowl.core.events.util.Promise) Branch(com.b2international.snowowl.core.branch.Branch) Merging(com.b2international.snowowl.core.branch.Merging) RepositoryRequests(com.b2international.snowowl.core.repository.RepositoryRequests) Concepts(com.b2international.snowowl.snomed.common.SnomedConstants.Concepts) SnomedRequests(com.b2international.snowowl.snomed.datastore.request.SnomedRequests) AlreadyExistsException(com.b2international.commons.exceptions.AlreadyExistsException) Assert.fail(org.junit.Assert.fail) SnomedDescriptionCreateRequestBuilder(com.b2international.snowowl.snomed.datastore.request.SnomedDescriptionCreateRequestBuilder) Branching(com.b2international.snowowl.core.branch.Branching) TestMethodNameRule(com.b2international.snowowl.test.commons.TestMethodNameRule) Before(org.junit.Before) BranchPathUtils(com.b2international.snowowl.core.branch.BranchPathUtils) CommitResult(com.b2international.snowowl.core.request.CommitResult) RepositoryManager(com.b2international.snowowl.core.RepositoryManager) ImmutableMap(com.google.common.collect.ImmutableMap) Request(com.b2international.snowowl.core.events.Request) Merge(com.b2international.snowowl.core.merge.Merge) JsonSupport(com.b2international.snowowl.core.repository.JsonSupport) Test(org.junit.Test) RevisionSegment(com.b2international.index.revision.RevisionSegment) RemoteJobEntry(com.b2international.snowowl.core.jobs.RemoteJobEntry) IEventBus(com.b2international.snowowl.eventbus.IEventBus) UUID(java.util.UUID) SnomedTerminologyComponentConstants(com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants) Assert.assertNotEquals(org.junit.Assert.assertNotEquals) Services(com.b2international.snowowl.test.commons.Services) Rule(org.junit.Rule) JobRequests(com.b2international.snowowl.core.jobs.JobRequests) ServiceProvider(com.b2international.snowowl.core.ServiceProvider) AsyncRequest(com.b2international.snowowl.core.events.AsyncRequest) User(com.b2international.snowowl.core.identity.User) SnomedIdentifiers(com.b2international.snowowl.snomed.cis.SnomedIdentifiers) Assert.assertEquals(org.junit.Assert.assertEquals) ApplicationContext(com.b2international.snowowl.core.ApplicationContext) RevisionBranch(com.b2international.index.revision.RevisionBranch) Branch(com.b2international.snowowl.core.branch.Branch) Test(org.junit.Test)

Example 4 with Promise

use of com.b2international.snowowl.core.events.util.Promise in project snow-owl by b2ihealthcare.

the class ValidationThreadPool method submit.

public Promise<Object> submit(CheckType checkType, Runnable runnable) {
    final Job job = new ValidationJob(checkType.getName(), runnable);
    final String uniqueRuleId = UUID.randomUUID().toString();
    final ISchedulingRule schedulingRule = new ValidationRuleSchedulingRule(checkType, maxValidationThreadCount, maxConcurrentExpensiveJobs, maxConcurrentNormalJobs, uniqueRuleId);
    final Promise<Object> promise = new Promise<>();
    job.setSystem(true);
    job.setRule(schedulingRule);
    job.addJobChangeListener(new JobChangeAdapter() {

        @Override
        public void done(IJobChangeEvent event) {
            if (event.getResult().isOK()) {
                promise.resolve(Boolean.TRUE);
            } else {
                promise.reject(new ValidationException(String.format("Validation job failed with status %s.", event.getResult())));
            }
        }
    });
    job.schedule();
    return promise;
}
Also used : Promise(com.b2international.snowowl.core.events.util.Promise) ValidationException(javax.validation.ValidationException) JobChangeAdapter(org.eclipse.core.runtime.jobs.JobChangeAdapter) IJobChangeEvent(org.eclipse.core.runtime.jobs.IJobChangeEvent) Job(org.eclipse.core.runtime.jobs.Job) ISchedulingRule(org.eclipse.core.runtime.jobs.ISchedulingRule)

Example 5 with Promise

use of com.b2international.snowowl.core.events.util.Promise in project snow-owl by b2ihealthcare.

the class ValidateRequest method doValidate.

private ValidationResult doValidate(BranchContext context, Writer index) throws IOException {
    final String branchPath = context.path();
    ValidationRuleSearchRequestBuilder req = ValidationRequests.rules().prepareSearch();
    TerminologyResource resource = context.service(TerminologyResource.class);
    ResourceURI resourceURI = resource.getResourceURI(branchPath);
    if (!CompareUtils.isEmpty(ruleIds)) {
        req.filterByIds(ruleIds);
    }
    final ValidationRules rules = req.all().build().execute(context);
    final ValidationThreadPool pool = context.service(ValidationThreadPool.class);
    final BlockingQueue<IssuesToPersist> issuesToPersistQueue = Queues.newLinkedBlockingDeque();
    final List<Promise<Object>> validationPromises = Lists.newArrayList();
    // evaluate selected rules
    for (ValidationRule rule : rules) {
        checkArgument(rule.getCheckType() != null, "CheckType is missing for rule " + rule.getId());
        final ValidationRuleEvaluator evaluator = ValidationRuleEvaluator.Registry.get(rule.getType());
        if (evaluator != null) {
            validationPromises.add(pool.submit(rule.getCheckType(), () -> {
                Stopwatch w = Stopwatch.createStarted();
                try {
                    LOG.info("Executing rule '{}'...", rule.getId());
                    final List<?> evaluationResponse = evaluator.eval(context, rule, ruleParameters);
                    issuesToPersistQueue.offer(new IssuesToPersist(rule.getId(), evaluationResponse));
                    LOG.info("Execution of rule '{}' successfully completed in '{}'.", rule.getId(), w);
                // TODO report successfully executed validation rule
                } catch (Exception e) {
                    // TODO report failed validation rule
                    LOG.error("Execution of rule '{}' failed after '{}'.", rule.getId(), w, e);
                }
            }));
        }
    }
    final Set<String> ruleIds = rules.stream().map(ValidationRule::getId).collect(Collectors.toSet());
    final Multimap<String, ComponentIdentifier> whiteListedEntries = fetchWhiteListEntries(context, ruleIds);
    final Promise<List<Object>> promise = Promise.all(validationPromises);
    while (!promise.isDone() || !issuesToPersistQueue.isEmpty()) {
        if (!issuesToPersistQueue.isEmpty()) {
            final Collection<IssuesToPersist> issuesToPersist = newArrayList();
            issuesToPersistQueue.drainTo(issuesToPersist);
            if (!issuesToPersist.isEmpty()) {
                final List<String> rulesToPersist = issuesToPersist.stream().map(itp -> itp.ruleId).collect(Collectors.toList());
                LOG.info("Persisting issues generated by rules '{}'...", rulesToPersist);
                // persist new issues generated by rules so far, extending them using the Issue Extension API
                int persistedIssues = 0;
                final Multimap<String, ValidationIssue> issuesToExtendWithDetailsByToolingId = HashMultimap.create();
                for (IssuesToPersist ruleIssues : Iterables.consumingIterable(issuesToPersist)) {
                    final String ruleId = ruleIssues.ruleId;
                    final List<ValidationIssue> existingRuleIssues = ValidationRequests.issues().prepareSearch().all().filterByResourceUri(resourceURI).filterByRule(ruleId).build().execute(context).getItems();
                    final Set<String> issueIdsToDelete = Sets.newHashSet();
                    final Map<ComponentIdentifier, ValidationIssue> existingIsssuesByComponentIdentifier = new HashMap<>();
                    for (ValidationIssue issue : existingRuleIssues) {
                        if (existingIsssuesByComponentIdentifier.containsKey(issue.getAffectedComponent())) {
                            issueIdsToDelete.add(issue.getId());
                        } else {
                            existingIsssuesByComponentIdentifier.put(issue.getAffectedComponent(), issue);
                        }
                    }
                    // remove all processed whitelist entries
                    final Collection<ComponentIdentifier> ruleWhiteListEntries = whiteListedEntries.removeAll(ruleId);
                    final String toolingId = rules.stream().filter(rule -> ruleId.equals(rule.getId())).findFirst().get().getToolingId();
                    for (ValidationIssueDetails issueDetails : ruleIssues.issueDetails) {
                        final ValidationIssue validationIssue;
                        ComponentIdentifier componentIdentifier = issueDetails.affectedComponentId;
                        if (!existingIsssuesByComponentIdentifier.containsKey(componentIdentifier)) {
                            validationIssue = new ValidationIssue(UUID.randomUUID().toString(), ruleId, ComponentURI.of(resourceURI, componentIdentifier), ruleWhiteListEntries.contains(componentIdentifier));
                        } else {
                            final ValidationIssue issueToCopy = existingIsssuesByComponentIdentifier.get(componentIdentifier);
                            validationIssue = new ValidationIssue(issueToCopy.getId(), issueToCopy.getRuleId(), ComponentURI.of(resourceURI, issueToCopy.getAffectedComponent()), ruleWhiteListEntries.contains(issueToCopy.getAffectedComponent()));
                            existingIsssuesByComponentIdentifier.remove(componentIdentifier);
                        }
                        validationIssue.setDetails(ValidationIssueDetails.HIGHLIGHT_DETAILS, issueDetails.stylingDetails);
                        issuesToExtendWithDetailsByToolingId.put(toolingId, validationIssue);
                        persistedIssues++;
                    }
                    existingRuleIssues.stream().filter(issue -> existingIsssuesByComponentIdentifier.containsKey(issue.getAffectedComponent())).forEach(issue -> issueIdsToDelete.add(issue.getId()));
                    if (!issueIdsToDelete.isEmpty()) {
                        index.removeAll(Collections.singletonMap(ValidationIssue.class, issueIdsToDelete));
                    }
                }
                for (String toolingId : issuesToExtendWithDetailsByToolingId.keySet()) {
                    final ValidationIssueDetailExtension extensions = context.service(ValidationIssueDetailExtensionProvider.class).getExtensions(toolingId);
                    final Collection<ValidationIssue> issues = issuesToExtendWithDetailsByToolingId.removeAll(toolingId);
                    extensions.extendIssues(context, issues, ruleParameters);
                    for (ValidationIssue issue : issues) {
                        index.put(issue);
                    }
                }
                index.commit();
                LOG.info("Persisted '{}' issues generated by rules '{}'.", persistedIssues, rulesToPersist);
            }
        } else {
            try {
                // wait at least number of rules * 50ms for the next responses
                Thread.sleep(Math.min(((long) ruleIds.size()) * 100, POLL_INTERVAL_MAX));
            } catch (InterruptedException e) {
                throw new SnowowlRuntimeException(e);
            }
        }
    }
    // TODO return ValidationResult object with status and new issue IDs as set
    return new ValidationResult(context.info().id(), context.path());
}
Also used : ValidationIssueDetailExtensionProvider(com.b2international.snowowl.core.validation.issue.ValidationIssueDetailExtensionProvider) java.util(java.util) TerminologyResource(com.b2international.snowowl.core.TerminologyResource) Stopwatch(com.google.common.base.Stopwatch) Promise(com.b2international.snowowl.core.events.util.Promise) LoggerFactory(org.slf4j.LoggerFactory) ValidationIssue(com.b2international.snowowl.core.validation.issue.ValidationIssue) ValidationIssueDetailExtension(com.b2international.snowowl.core.validation.issue.ValidationIssueDetailExtension) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) AccessControl(com.b2international.snowowl.core.authorization.AccessControl) Permission(com.b2international.snowowl.core.identity.Permission) CompareUtils(com.b2international.commons.CompareUtils) ValidationRuleSearchRequestBuilder(com.b2international.snowowl.core.validation.rule.ValidationRuleSearchRequestBuilder) com.google.common.collect(com.google.common.collect) ValidationRepository(com.b2international.snowowl.core.internal.validation.ValidationRepository) ResourceURI(com.b2international.snowowl.core.ResourceURI) ValidationRule(com.b2international.snowowl.core.validation.rule.ValidationRule) ValidationWhiteListSearchRequestBuilder(com.b2international.snowowl.core.validation.whitelist.ValidationWhiteListSearchRequestBuilder) ValidationThreadPool(com.b2international.snowowl.core.internal.validation.ValidationThreadPool) Logger(org.slf4j.Logger) SnowowlRuntimeException(com.b2international.snowowl.core.api.SnowowlRuntimeException) Request(com.b2international.snowowl.core.events.Request) ComponentURI(com.b2international.snowowl.core.uri.ComponentURI) IOException(java.io.IOException) BlockingQueue(java.util.concurrent.BlockingQueue) Collectors(java.util.stream.Collectors) Writer(com.b2international.index.Writer) ValidationRuleEvaluator(com.b2international.snowowl.core.validation.eval.ValidationRuleEvaluator) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ComponentIdentifier(com.b2international.snowowl.core.ComponentIdentifier) ValidationRules(com.b2international.snowowl.core.validation.rule.ValidationRules) BranchContext(com.b2international.snowowl.core.domain.BranchContext) ValidationRuleSearchRequestBuilder(com.b2international.snowowl.core.validation.rule.ValidationRuleSearchRequestBuilder) ValidationThreadPool(com.b2international.snowowl.core.internal.validation.ValidationThreadPool) Stopwatch(com.google.common.base.Stopwatch) ComponentIdentifier(com.b2international.snowowl.core.ComponentIdentifier) ValidationIssueDetailExtension(com.b2international.snowowl.core.validation.issue.ValidationIssueDetailExtension) TerminologyResource(com.b2international.snowowl.core.TerminologyResource) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ResourceURI(com.b2international.snowowl.core.ResourceURI) ValidationIssue(com.b2international.snowowl.core.validation.issue.ValidationIssue) SnowowlRuntimeException(com.b2international.snowowl.core.api.SnowowlRuntimeException) IOException(java.io.IOException) SnowowlRuntimeException(com.b2international.snowowl.core.api.SnowowlRuntimeException) ValidationRule(com.b2international.snowowl.core.validation.rule.ValidationRule) Promise(com.b2international.snowowl.core.events.util.Promise) ValidationRules(com.b2international.snowowl.core.validation.rule.ValidationRules) ValidationRuleEvaluator(com.b2international.snowowl.core.validation.eval.ValidationRuleEvaluator) ValidationIssueDetailExtensionProvider(com.b2international.snowowl.core.validation.issue.ValidationIssueDetailExtensionProvider)

Aggregations

Promise (com.b2international.snowowl.core.events.util.Promise)22 ResourceURI (com.b2international.snowowl.core.ResourceURI)10 TimeUnit (java.util.concurrent.TimeUnit)10 SnowowlRuntimeException (com.b2international.snowowl.core.api.SnowowlRuntimeException)9 SnomedRequests (com.b2international.snowowl.snomed.datastore.request.SnomedRequests)9 IOException (java.io.IOException)9 List (java.util.List)9 Test (org.junit.Test)9 BranchContext (com.b2international.snowowl.core.domain.BranchContext)8 Sets.newHashSet (com.google.common.collect.Sets.newHashSet)8 Set (java.util.Set)8 Collectors (java.util.stream.Collectors)8 RevisionSearcher (com.b2international.index.revision.RevisionSearcher)7 IEventBus (com.b2international.snowowl.eventbus.IEventBus)7 Concepts (com.b2international.snowowl.snomed.common.SnomedConstants.Concepts)7 SnomedRf2Headers (com.b2international.snowowl.snomed.common.SnomedRf2Headers)7 SnomedRefSetType (com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType)7 Trees (com.b2international.snowowl.snomed.core.tree.Trees)7 Function (com.google.common.base.Function)7 Collection (java.util.Collection)7