<commit_before>/*
 * Copyright 2012 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.gradle.integtests.tooling.r11rc1

import org.gradle.integtests.tooling.fixture.MinTargetGradleVersion
import org.gradle.integtests.tooling.fixture.MinToolingApiVersion
import org.gradle.integtests.tooling.fixture.ToolingApiSpecification
import org.gradle.integtests.fixtures.TestResources
import org.gradle.tooling.model.internal.migration.ProjectOutput
import org.gradle.tooling.model.internal.migration.TestResult
import org.gradle.tooling.model.internal.migration.Archive

import org.junit.Rule

@MinToolingApiVersion("current")
@MinTargetGradleVersion("current")
class MigrationModelCrossVersionSpec extends ToolingApiSpecification {
    @Rule TestResources resources = new TestResources()

    def "modelContainsAllArchivesOnTheArchivesConfiguration"() {
        when:
        def output = withConnection { it.getModel(ProjectOutput.class) }

        then:
        output instanceof ProjectOutput
        def archives = output.taskOutputs.findAll { it instanceof Archive } as List
        archives.size() == 2
        archives.any { it.file.name.endsWith(".jar") }
        archives.any { it.file.name.endsWith(".zip") }
    }

    def "modelContainsAllTestResults"() {
        when:
        def output = withConnection { it.getModel(ProjectOutput.class) }

        then:
        output instanceof ProjectOutput
        def testResults = output.taskOutputs.findAll { it instanceof TestResult } as List
        testResults.size() == 2
        testResults.any { it.xmlReportDir == resources.dir.file("build", "test-results") }
        testResults.any { it.xmlReportDir == resources.dir.file("build", "other-results") }
    }

    def "modelContainsAllProjects"() {
        when:
        def output = withConnection { it.getModel(ProjectOutput.class) }

        then:
        output instanceof ProjectOutput
        output.children.size() == 2
        output.children.name as Set == ["project1", "project2"] as Set
        output.children[0].children.empty
        output.children[1].children.empty
    }
}<commit_msg>adapted tests to recent build migration model change<commit_after>/*
 * Copyright 2012 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.gradle.integtests.tooling.r11rc1

import org.gradle.integtests.tooling.fixture.MinTargetGradleVersion
import org.gradle.integtests.tooling.fixture.MinToolingApiVersion
import org.gradle.integtests.tooling.fixture.ToolingApiSpecification
import org.gradle.integtests.fixtures.TestResources
import org.gradle.tooling.model.internal.migration.ProjectOutput

import org.junit.Rule

@MinToolingApiVersion("current")
@MinTargetGradleVersion("current")
class MigrationModelCrossVersionSpec extends ToolingApiSpecification {
    @Rule TestResources resources = new TestResources()

    def "modelContainsAllArchivesOnTheArchivesConfiguration"() {
        when:
        def output = withConnection { it.getModel(ProjectOutput.class) }

        then:
        output instanceof ProjectOutput
        def archives = output.archives
        archives.size() == 2
        archives.any { it.file.name.endsWith(".jar") }
        archives.any { it.file.name.endsWith(".zip") }
    }

    def "modelContainsAllTestResults"() {
        when:
        def output = withConnection { it.getModel(ProjectOutput.class) }

        then:
        output instanceof ProjectOutput
        def testResults = output.testResults
        testResults.size() == 2
        testResults.any { it.xmlReportDir == resources.dir.file("build", "test-results") }
        testResults.any { it.xmlReportDir == resources.dir.file("build", "other-results") }
    }

    def "modelContainsAllProjects"() {
        when:
        def output = withConnection { it.getModel(ProjectOutput.class) }

        then:
        output instanceof ProjectOutput
        output.children.size() == 2
        output.children.name as Set == ["project1", "project2"] as Set
        output.children[0].children.empty
        output.children[1].children.empty
    }
}
{'fraction_non_alphanumeric': 0.09351959642995732, 'fraction_numerical': 0.006984866123399301, 'mean_word_length': 3.4516407599309153, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5147931', 'n_tokens_mistral': 1426, 'n_tokens_neox': 1373, 'n_words': 375}