package org.drools.testcoverage.kieci.withoutdomain;

import org.assertj.core.api.Assertions;
import org.drools.testcoverage.kieci.withoutdomain.util.KJarLoadUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.ReleaseId;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;

/**
 * Tests loading a KJAR with non-trivial pom.xml (dependencies, parent pom, ...).
 *
 * Tests must NOT have access to domain classes in test-domain module (BZ 1305798).
 */
public class KJarLoadingTest {

    private static final KieServices KS = KieServices.Factory.get();

    private static final ReleaseId KJAR_RELEASE_ID = KJarLoadUtils.loadKJarGAV("testKJarGAV.properties", KJarLoadingTest.class);

    private KieSession kieSession;

    @Before
    public void init() {
        final KieContainer container = KS.newKieContainer(KJAR_RELEASE_ID, this.getClass().getClassLoader());
        this.kieSession = container.newKieSession();
    }

    @After
    public void dispose() {
        if (this.kieSession != null) {
            this.kieSession.dispose();
        }
    }

    @Test
    @Ignore("BZ 1305798")
    public void testLoadingKJarWithDeps() {
        // BZ 1305798
        Assertions.assertThat(this.kieSession).as("Failed to create KieSession.").isNotNull();
        Assertions.assertThat(this.kieSession.getKieBase().getKiePackages()).as("No rules compiled.").isNotEmpty();
    }
}

@@ -211,33 +211,8 @@
 re;%0A
-import org.junit.Ignore;%0A
 impo
@@ -940,42 +940,8 @@
 E_ID
-, this.getClass().getClassLoader()
 );%0A 
@@ -1147,34 +1147,8 @@
 est%0A
-    @Ignore(%22BZ 1305798%22)%0A
     

fix test for kjar using dependencies with version declared in parent pom