// Metadata created by nebel
// ParentAssemblies: assemblies/getting-started/as_installing-the-registry.adoc

[id="testing-artifacts-using-maven-plugin"]
= Testing schema and API artifacts using the Maven plug-in

[role="_abstract"]
You might want to verify that an artifact can be registered without actually making any changes. This is often useful when rules are configured in {registry}. Testing the artifact results in a failure if the artifact content violates any of the configured rules.

NOTE: Even if the artifact passes the test, no content is added to {registry}.

.Procedure
* Update your Maven `pom.xml` file to use the `apicurio-registry-maven-plugin` to test an artifact. The following example shows testing an Apache Avro schema:
+
[source,xml]
----
<plugin>     
  <groupId>io.apicurio</groupId>
  <artifactId>apicurio-registry-maven-plugin</artifactId>
  <version>${apicurio.version}</version>
  <executions>
      <execution>
        <phase>generate-sources</phase>
        <goals>
            <goal>test-update</goal>  <1>
        </goals>
        <configuration>
            <registryUrl>http://REGISTRY-URL/apis/registry/v2</registryUrl> <2>
            <artifacts>
                <artifact>
                    <groupId>TestGroup</groupId> <3>
                    <artifactId>FullNameRecord</artifactId>
                    <file>${project.basedir}/src/main/resources/schemas/record.avsc</file> <4>
                </artifact>
                <artifact>
                    <groupId>TestGroup</groupId>
                    <artifactId>ExampleAPI</artifactId>
                    <type>GRAPHQL</type>
                    <file>${project.basedir}/src/main/resources/apis/example.graphql</file>
                </artifact>
            </artifacts>
        </configuration>
    </execution>
  </executions>
 </plugin>
----
<1> Specify `test-update` as the execution goal to test the schema artifact.
<2> Specify the {registry} URL with the `../apis/registry/v2` endpoint.
<3> Specify the {registry} artifact group ID. You can specify the `default` group if you do not want to use a unique group.
<4> You can test multiple artifacts from specified directory using the artifact ID. 

[role="_additional-resources"]
.Additional resources
 * For more details on the {registry} Maven plug-in, see the link:https://github.com/Apicurio/apicurio-registry-demo[Registry demonstration example]
