All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.opentelemetry.javaagent.muzzle.MuzzleExtension.kt Maven / Gradle / Ivy

There is a newer version: 2.11.0-alpha
Show newest version
/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package io.opentelemetry.javaagent.muzzle

import org.gradle.api.Action
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.ListProperty
import javax.inject.Inject

abstract class MuzzleExtension @Inject constructor(private val objectFactory: ObjectFactory) {

  internal abstract val directives: ListProperty

  fun pass(action: Action) {
    val pass = objectFactory.newInstance(MuzzleDirective::class.java)
    action.execute(pass)
    pass.assertPass.set(true)
    directives.add(pass)
  }

  fun fail(action: Action) {
    val fail = objectFactory.newInstance(MuzzleDirective::class.java)
    action.execute(fail)
    fail.assertPass.set(false)
    directives.add(fail)
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy