org.xmlunit.assertj.XmlAssert Java Examples

The following examples show how to use org.xmlunit.assertj.XmlAssert. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RepositoryMetadataWriterTest.java    From archiva with Apache License 2.0 7 votes vote down vote up
@Test
public void testWriteSimple()
    throws Exception
{
    Path defaultRepoDir = getRepositoryPath( "default-repository" );
    Path expectedFile = defaultRepoDir.resolve( "org/apache/maven/shared/maven-downloader/maven-metadata.xml" );
    String expectedContent = org.apache.archiva.common.utils.FileUtils.readFileToString( expectedFile, Charset.defaultCharset() );

    ArchivaRepositoryMetadata metadata = new ArchivaRepositoryMetadata();

    metadata.setGroupId( "org.apache.maven.shared" );
    metadata.setArtifactId( "maven-downloader" );
    metadata.setVersion( "1.0" );
    metadata.setReleasedVersion( "1.1" );
    metadata.getAvailableVersions().add( "1.0" );
    metadata.getAvailableVersions().add( "1.1" );
    metadata.setLastUpdated( "20061212214311" );

    StringWriter actual = new StringWriter();
    RepositoryMetadataWriter.write( metadata, actual );

    XmlAssert.assertThat( actual.toString() ).and( expectedContent ).areIdentical();
}
 
Example #2
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 6 votes vote down vote up
@Test
public void migration125_shouldRetainTlsAttributeFromMailHostWhenItIsSetToTrue() {
    String configXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"124\">" +
                    "  <server>" +
                    "    <mailhost hostname='smtp.example.com' port='25' tls='true' from='[email protected]' admin='[email protected]' />" +
                    "  </server>" +
                    "</cruise>";

    String expectedConfig =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"125\">" +
                    "  <server>" +
                    "    <mailhost hostname='smtp.example.com' port='25' tls='true' from='[email protected]' admin='[email protected]' />" +
                    "  </server>" +
                    "</cruise>";

    final String migratedXml = ConfigMigrator.migrate(configXml, 124, 125);
    XmlAssert.assertThat(migratedXml).and(expectedConfig).areIdentical();
}
 
Example #3
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 6 votes vote down vote up
@Test
public void migration125_shouldRemoveTlsAttributeFromMailHostWhenItIsSetToFalse() {
    String configXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"124\">" +
                    "  <server>" +
                    "    <mailhost hostname='smtp.example.com' port='25' tls='false' from='[email protected]' admin='[email protected]' />" +
                    "  </server>" +
                    "</cruise>";

    String expectedConfig =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"125\">" +
                    "  <server>" +
                    "    <mailhost hostname='smtp.example.com' port='25' from='[email protected]' admin='[email protected]' />" +
                    "  </server>" +
                    "</cruise>";

    final String migratedXml = ConfigMigrator.migrate(configXml, 124, 125);
    XmlAssert.assertThat(migratedXml).and(expectedConfig).areIdentical();
}
 
Example #4
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldAddADefaultAllowRuleForConfigRepos_Migration135To136() {
    String configXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
            "<cruise schemaVersion=\"135\">" +
            "   <config-repos>" +
            "      <config-repo id=\"json\" pluginId=\"yaml.config.plugin\">" +
            "          <git url=\"/tmp/config\" />" +
            "      </config-repo>" +
            "   </config-repos>" +
            "</cruise>";

    String defaultRuleAdded = "<allow action=\"refer\" type=\"*\">*</allow>";

    final String migratedXml = migrateXmlString(configXml, 135);

    XmlAssert.assertThat(migratedXml).nodesByXPath("/cruise/config-repos/config-repo/rules").exist();
    assertThat(migratedXml).contains(defaultRuleAdded);
}
 
Example #5
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldDefine_allowOnlyKnownUsersToLogin_attributeOnAuthConfigAttributeDoesNotExistOnSecurity_Migration132to133() throws Exception {
    String originalConfig = "<server agentAutoRegisterKey=\"323040d4-f2e4-4b8a-8394-7a2d122054d1\" webhookSecret=\"3d5cd2f5-7fe7-43c0-ba34-7e01678ba8b6\" commandRepositoryLocation=\"default\" serverId=\"60f5f682-5248-4ba9-bb35-72c92841bd75\" tokenGenerationKey=\"8c3c8dc9-08bf-4cd7-ac80-cecb3e7ae86c\">" +
            "<security>\n" +
            "      <authConfigs>\n" +
            "        <authConfig id=\"9cad79b0-4d9e-4a62-829c-eb4d9488062f\" pluginId=\"cd.go.authentication.passwordfile\">\n" +
            "          <property>\n" +
            "            <key>PasswordFilePath</key>\n" +
            "            <value>config/password.properties</value>\n" +
            "          </property>\n" +
            "        </authConfig>\n" +
            "      </authConfigs>\n" +
            "    </security>\n" +
            "  </server>\n";

    String configXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
            "<cruise schemaVersion=\"132\">" + originalConfig + "</cruise>";

    final String migratedXml = migrateXmlString(configXml, 132);

    XmlAssert.assertThat(migratedXml).nodesByXPath("//security").doNotHaveAttribute("allowOnlyKnownUsersToLogin");
    //verify authConfig has no allowOnlyKnownUsersToLogin as the default value is false,
    XmlAssert.assertThat(migratedXml).nodesByXPath("//authConfig").doNotHaveAttribute("allowOnlyKnownUsersToLogin");
}
 
Example #6
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldMigrate_allowOnlyKnownUsersToLogin_attributeFromSecurityToAuthConfig_Migration132To133() throws Exception {
    String originalConfig = "<server agentAutoRegisterKey=\"323040d4-f2e4-4b8a-8394-7a2d122054d1\" webhookSecret=\"3d5cd2f5-7fe7-43c0-ba34-7e01678ba8b6\" commandRepositoryLocation=\"default\" serverId=\"60f5f682-5248-4ba9-bb35-72c92841bd75\" tokenGenerationKey=\"8c3c8dc9-08bf-4cd7-ac80-cecb3e7ae86c\">" +
            "<security allowOnlyKnownUsersToLogin=\"true\" >\n" +
            "      <authConfigs>\n" +
            "        <authConfig id=\"9cad79b0-4d9e-4a62-829c-eb4d9488062f\" pluginId=\"cd.go.authentication.passwordfile\">\n" +
            "          <property>\n" +
            "            <key>PasswordFilePath</key>\n" +
            "            <value>config/password.properties</value>\n" +
            "          </property>\n" +
            "        </authConfig>\n" +
            "      </authConfigs>\n" +
            "    </security>\n" +
            "  </server>\n";

    String configXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
            "<cruise schemaVersion=\"132\">" + originalConfig + "</cruise>";

    final String migratedXml = migrateXmlString(configXml, 132);

    XmlAssert.assertThat(migratedXml).nodesByXPath("//security").doNotHaveAttribute("allowOnlyKnownUsersToLogin");
    XmlAssert.assertThat(migratedXml).nodesByXPath("//authConfig").haveAttribute("allowOnlyKnownUsersToLogin", "true");
}
 
Example #7
Source File: PipelinesXmlRepresenterTest.java    From gocd with Apache License 2.0 6 votes vote down vote up
@Test
void shouldGenerateXmlWithRootElementAndSelfLinkWhenPipelineInstanceModelsIsEmpty() {
    XmlWriterContext context = new XmlWriterContext("https://go-server/go", null, null, null, new SystemEnvironment());
    PipelineInstanceModels models = createPipelineInstanceModels();
    PipelinesXmlRepresenter representer = new PipelinesXmlRepresenter(models);

    Document document = representer.toXml(context);

    String expectedXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
        "<pipelines>\n" +
        "  <link rel=\"self\" href=\"https://go-server/go/api/feed/pipelines.xml\"/>\n" +
        "</pipelines>";

    XmlAssert.assertThat(document.asXML()).and(expectedXML)
        .ignoreWhitespace()
        .areIdentical();
}
 
Example #8
Source File: FeedEntriesRepresenterTest.java    From gocd with Apache License 2.0 6 votes vote down vote up
@ParameterizedTest
@FileSource(files = "/feeds/stages-with-entries.xml")
void shouldGenerateFeedXml(String expectedXML) {
    String pipelineName = "up42";
    StageFeedEntry entryOne = cancelled();
    StageFeedEntry entryTwo = passed();
    entryOne.getAuthors().add(new Author("bob", "[email protected]"));
    entryTwo.getAuthors().add(new Author("joe <[email protected]>", null));
    XmlWriterContext context = new XmlWriterContext("https://go-server/go", null, null, null, new SystemEnvironment());
    FeedEntriesRepresenter representable = new FeedEntriesRepresenter(pipelineName, new FeedEntries(entryOne, entryTwo));

    Document document = representable.toXml(context);

    XmlAssert.assertThat(document.asXML()).and(expectedXML)
        .ignoreWhitespace()
        .areIdentical();
}
 
Example #9
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldAddOnlySecureSiteUrlWhenSiteUrlIsNotSpecified_Migration126To127() {
    String originalConfig = "<server " +
            "secureSiteUrl=\"https://bar.com\" " +
            "artifactsdir=\"artifacts\" " +
            "agentAutoRegisterKey=\"323040d4-f2e4-4b8a-8394-7a2d122054d1\" " +
            "webhookSecret=\"3d5cd2f5-7fe7-43c0-ba34-7e01678ba8b6\" " +
            "commandRepositoryLocation=\"default\" " +
            "serverId=\"60f5f682-5248-4ba9-bb35-72c92841bd75\" " +
            "tokenGenerationKey=\"8c3c8dc9-08bf-4cd7-ac80-cecb3e7ae86c\">" +
            "</server>";

    String configXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"126\">" + originalConfig + "</cruise>";

    String expectedConfig = "<server " +
            "artifactsdir=\"artifacts\" " +
            "agentAutoRegisterKey=\"323040d4-f2e4-4b8a-8394-7a2d122054d1\" " +
            "webhookSecret=\"3d5cd2f5-7fe7-43c0-ba34-7e01678ba8b6\" " +
            "commandRepositoryLocation=\"default\" " +
            "serverId=\"60f5f682-5248-4ba9-bb35-72c92841bd75\" " +
            "tokenGenerationKey=\"8c3c8dc9-08bf-4cd7-ac80-cecb3e7ae86c\">" +
            "<siteUrls>" +
            "<siteUrl/>" +
            "<secureSiteUrl>https://bar.com</secureSiteUrl>" +
            "</siteUrls>" +
            "</server>";

    String expectedXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"127\">" + expectedConfig + "</cruise>";

    final String migratedXml = ConfigMigrator.migrate(configXml, 126, 127);
    XmlAssert.assertThat(migratedXml).and(expectedXml).areIdentical();
}
 
Example #10
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldMigrateEverythingAsItIs_Migration125To126() {
    String originalConfig = "<pipelines group=\"first\">" +
            "    <pipeline name=\"Test\" template=\"test_template\">" +
            "      <materials>" +
            "          <git url=\"http://\" dest=\"dest_dir14\" />" +
            "      </materials>" +
            "     </pipeline>" +
            "  </pipelines>" +
            "  <templates>" +
            "    <pipeline name=\"test_template\">" +
            "      <stage name=\"Functional\">" +
            "        <approval type=\"manual\" />" +
            "        <jobs>" +
            "          <job name=\"Functional\">" +
            "            <tasks>" +
            "              <exec command=\"echo\" args=\"Hello World!!!\" />" +
            "            </tasks>" +
            "           </job>" +
            "        </jobs>" +
            "      </stage>" +
            "    </pipeline>" +
            "  </templates>";

    String configXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"125\">" + originalConfig + "</cruise>";

    String expectedConfig =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"126\">" + originalConfig + "</cruise>";

    final String migratedXml = ConfigMigrator.migrate(configXml, 125, 126);
    XmlAssert.assertThat(migratedXml).and(expectedConfig).areIdentical();
}
 
Example #11
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldDoNothingWhenSiteUrlAndSecureSiteUrlIsNotSpecified_Migration126To127() {
    String originalConfig = "<server " +
            "artifactsdir=\"artifacts\" " +
            "agentAutoRegisterKey=\"323040d4-f2e4-4b8a-8394-7a2d122054d1\" " +
            "webhookSecret=\"3d5cd2f5-7fe7-43c0-ba34-7e01678ba8b6\" " +
            "commandRepositoryLocation=\"default\" " +
            "serverId=\"60f5f682-5248-4ba9-bb35-72c92841bd75\" " +
            "tokenGenerationKey=\"8c3c8dc9-08bf-4cd7-ac80-cecb3e7ae86c\">" +
            "</server>";

    String configXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"126\">" + originalConfig + "</cruise>";

    String expectedConfig = "<server " +
            "artifactsdir=\"artifacts\" " +
            "agentAutoRegisterKey=\"323040d4-f2e4-4b8a-8394-7a2d122054d1\" " +
            "webhookSecret=\"3d5cd2f5-7fe7-43c0-ba34-7e01678ba8b6\" " +
            "commandRepositoryLocation=\"default\" " +
            "serverId=\"60f5f682-5248-4ba9-bb35-72c92841bd75\" " +
            "tokenGenerationKey=\"8c3c8dc9-08bf-4cd7-ac80-cecb3e7ae86c\">" +
            "</server>";

    String expectedXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"127\">" + expectedConfig + "</cruise>";

    final String migratedXml = ConfigMigrator.migrate(configXml, 126, 127);
    XmlAssert.assertThat(migratedXml).and(expectedXml).areIdentical();
}
 
Example #12
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldAddOnlySiteUrlWhenSecureSiteUrlIsNotSpecified_Migration126To127() {
    String originalConfig = "<server siteUrl=\"http://foo.com\" " +
            "artifactsdir=\"artifacts\" " +
            "agentAutoRegisterKey=\"323040d4-f2e4-4b8a-8394-7a2d122054d1\" " +
            "webhookSecret=\"3d5cd2f5-7fe7-43c0-ba34-7e01678ba8b6\" " +
            "commandRepositoryLocation=\"default\" " +
            "serverId=\"60f5f682-5248-4ba9-bb35-72c92841bd75\" " +
            "tokenGenerationKey=\"8c3c8dc9-08bf-4cd7-ac80-cecb3e7ae86c\">" +
            "</server>";

    String configXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"126\">" + originalConfig + "</cruise>";

    String expectedConfig = "<server " +
            "artifactsdir=\"artifacts\" " +
            "agentAutoRegisterKey=\"323040d4-f2e4-4b8a-8394-7a2d122054d1\" " +
            "webhookSecret=\"3d5cd2f5-7fe7-43c0-ba34-7e01678ba8b6\" " +
            "commandRepositoryLocation=\"default\" " +
            "serverId=\"60f5f682-5248-4ba9-bb35-72c92841bd75\" " +
            "tokenGenerationKey=\"8c3c8dc9-08bf-4cd7-ac80-cecb3e7ae86c\">" +
            "<siteUrls>" +
            "<siteUrl>http://foo.com</siteUrl>" +
            "<secureSiteUrl/>" +
            "</siteUrls>" +
            "</server>";

    String expectedXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"127\">" + expectedConfig + "</cruise>";

    final String migratedXml = ConfigMigrator.migrate(configXml, 126, 127);
    XmlAssert.assertThat(migratedXml).and(expectedXml).areIdentical();
}
 
Example #13
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldRemoveSiteUrlsAsAnAttributesAndAddAsAChildElement_Migration126To127() {
    String originalConfig = "<server siteUrl=\"http://foo.com\" " +
            "secureSiteUrl=\"https://bar.com\" " +
            "artifactsdir=\"artifacts\" " +
            "agentAutoRegisterKey=\"323040d4-f2e4-4b8a-8394-7a2d122054d1\" " +
            "webhookSecret=\"3d5cd2f5-7fe7-43c0-ba34-7e01678ba8b6\" " +
            "commandRepositoryLocation=\"default\" " +
            "serverId=\"60f5f682-5248-4ba9-bb35-72c92841bd75\" " +
            "tokenGenerationKey=\"8c3c8dc9-08bf-4cd7-ac80-cecb3e7ae86c\">" +
            "</server>";

    String configXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"126\">" + originalConfig + "</cruise>";

    String expectedConfig = "<server " +
            "artifactsdir=\"artifacts\" " +
            "agentAutoRegisterKey=\"323040d4-f2e4-4b8a-8394-7a2d122054d1\" " +
            "webhookSecret=\"3d5cd2f5-7fe7-43c0-ba34-7e01678ba8b6\" " +
            "commandRepositoryLocation=\"default\" " +
            "serverId=\"60f5f682-5248-4ba9-bb35-72c92841bd75\" " +
            "tokenGenerationKey=\"8c3c8dc9-08bf-4cd7-ac80-cecb3e7ae86c\">" +
            "<siteUrls>" +
            "<siteUrl>http://foo.com</siteUrl>" +
            "<secureSiteUrl>https://bar.com</secureSiteUrl>" +
            "</siteUrls>" +
            "</server>";

    String expectedXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"127\">" + expectedConfig + "</cruise>";

    final String migratedXml = ConfigMigrator.migrate(configXml, 126, 127);
    XmlAssert.assertThat(migratedXml).and(expectedXml).areIdentical();
}
 
Example #14
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldRemoveArtifactRelatedAttributesAndAddAsChildElements_Migration131To132() throws Exception {
    String originalConfig = "<server artifactsdir=\"artifacts\" " +
            "purgeStart=\"50.0\" " +
            "purgeUpto=\"100.0\" " +
            "agentAutoRegisterKey=\"323040d4-f2e4-4b8a-8394-7a2d122054d1\" " +
            "webhookSecret=\"3d5cd2f5-7fe7-43c0-ba34-7e01678ba8b6\" " +
            "commandRepositoryLocation=\"default\" " +
            "serverId=\"60f5f682-5248-4ba9-bb35-72c92841bd75\" " +
            "tokenGenerationKey=\"8c3c8dc9-08bf-4cd7-ac80-cecb3e7ae86c\">" +
            "</server>";

    String configXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"131\">" + originalConfig + "</cruise>";

    String expectedConfig = "<server " +
            "agentAutoRegisterKey=\"323040d4-f2e4-4b8a-8394-7a2d122054d1\" " +
            "webhookSecret=\"3d5cd2f5-7fe7-43c0-ba34-7e01678ba8b6\" " +
            "commandRepositoryLocation=\"default\" " +
            "serverId=\"60f5f682-5248-4ba9-bb35-72c92841bd75\" " +
            "tokenGenerationKey=\"8c3c8dc9-08bf-4cd7-ac80-cecb3e7ae86c\">" +
            "<artifacts>" +
                "<artifactsDir>artifacts</artifactsDir>" +
                "<purgeSettings>" +
                    "<purgeStartDiskSpace>50.0</purgeStartDiskSpace>" +
                    "<purgeUptoDiskSpace>100.0</purgeUptoDiskSpace>" +
                "</purgeSettings>" +
            "</artifacts>" +
            "</server>";

    String expectedXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"" + GoConstants.CONFIG_SCHEMA_VERSION + "\">" + expectedConfig + "</cruise>";

    final String migratedXml = ConfigMigrator.migrate(configXml);

    XmlAssert.assertThat(migratedXml).and(expectedXml).areIdentical();
}
 
Example #15
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotBreakIfPurgeSettingsAreNotPresent_Migration131To132() throws Exception {
    String originalConfig = "<server artifactsdir=\"artifacts\" " +
            "agentAutoRegisterKey=\"323040d4-f2e4-4b8a-8394-7a2d122054d1\" " +
            "webhookSecret=\"3d5cd2f5-7fe7-43c0-ba34-7e01678ba8b6\" " +
            "commandRepositoryLocation=\"default\" " +
            "serverId=\"60f5f682-5248-4ba9-bb35-72c92841bd75\" " +
            "tokenGenerationKey=\"8c3c8dc9-08bf-4cd7-ac80-cecb3e7ae86c\">" +
            "</server>";

    String configXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"131\">" + originalConfig + "</cruise>";

    String expectedConfig = "<server " +
            "agentAutoRegisterKey=\"323040d4-f2e4-4b8a-8394-7a2d122054d1\" " +
            "webhookSecret=\"3d5cd2f5-7fe7-43c0-ba34-7e01678ba8b6\" " +
            "commandRepositoryLocation=\"default\" " +
            "serverId=\"60f5f682-5248-4ba9-bb35-72c92841bd75\" " +
            "tokenGenerationKey=\"8c3c8dc9-08bf-4cd7-ac80-cecb3e7ae86c\">" +
            "<artifacts>" +
                "<artifactsDir>artifacts</artifactsDir>" +
            "</artifacts>" +
            "</server>";

    String expectedXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"" + GoConstants.CONFIG_SCHEMA_VERSION + "\">" + expectedConfig + "</cruise>";

    final String migratedXml = ConfigMigrator.migrate(configXml);

    XmlAssert.assertThat(migratedXml).and(expectedXml).areIdentical();
}
 
Example #16
Source File: MagicalGoConfigXmlWriterTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldWriteServerConfig() throws Exception {
    String xml = ConfigFileFixture.SERVER_WITH_ARTIFACTS_DIR_AND_PURGE_SETTINGS;
    CruiseConfig cruiseConfig = xmlLoader.loadConfigHolder(xml).config;
    xmlWriter.write(cruiseConfig, output, false);
    XmlAssert.assertThat(output.toString()).and(xml).normalizeWhitespace().areIdentical();
}
 
Example #17
Source File: MagicalGoConfigXmlWriterTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldWritePipelines() throws Exception {
    String xml = ConfigFileFixture.TWO_PIPELINES;

    CruiseConfig cruiseConfig = ConfigMigrator.loadWithMigration(xml).config;
    xmlWriter.write(cruiseConfig, output, false);
    XmlAssert.assertThat(output.toString()).and(xml).normalizeWhitespace().areIdentical();
}
 
Example #18
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldMigrateEverythingAsItIs_Migration122To123() {
    String originalConfig = "<pipelines group=\"first\">" +
            "    <pipeline name=\"Test\" template=\"test_template\">" +
            "      <materials>" +
            "          <git url=\"http://\" dest=\"dest_dir14\" />" +
            "      </materials>" +
            "     </pipeline>" +
            "  </pipelines>" +
            "  <templates>" +
            "    <pipeline name=\"test_template\">" +
            "      <stage name=\"Functional\">" +
            "        <jobs>" +
            "          <job name=\"Functional\">" +
            "            <tasks>" +
            "              <exec command=\"echo\" args=\"Hello World!!!\" />" +
            "            </tasks>" +
            "           </job>" +
            "        </jobs>" +
            "      </stage>" +
            "    </pipeline>" +
            "  </templates>";

    String configXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"122\">" + originalConfig + "</cruise>";

    String expectedConfig =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"123\">" + originalConfig + "</cruise>";

    final String migratedXml = ConfigMigrator.migrate(configXml, 122, 123);
    XmlAssert.assertThat(migratedXml).and(expectedConfig).areIdentical();
}
 
Example #19
Source File: XmlAssertUtil.java    From Smack with Apache License 2.0 5 votes vote down vote up
private static CompareAssert normalizedCompare(CharSequence expectedCharSequence, CharSequence actualCharSequence) {
    String expectedString = expectedCharSequence.toString();
    String actualString = actualCharSequence.toString();

    NormalizedSource expected = new NormalizedSource(new StreamSource(new StringReader(expectedString)));
    NormalizedSource actual = new NormalizedSource(new StreamSource(new StringReader(actualString)));
    return XmlAssert.assertThat(actual).and(expected)
                    .ignoreChildNodesOrder()
                    .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndAllAttributes, ElementSelectors.byNameAndText))
                    .normalizeWhitespace();
}
 
Example #20
Source File: PipelineXmlRepresenterTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@Test
void shouldAddPipelineAfterLink() {
    PipelineTimelineEntry entry = mock(PipelineTimelineEntry.class);
    when(entry.getPipelineName()).thenReturn("up42");
    when(entry.getId()).thenReturn(101L);
    model.setPipelineAfter(entry);

    Document document = new PipelineXmlRepresenter(model).toXml(context);

    XmlAssert.assertThat(document.asXML())
        .nodesByXPath("//pipeline/link[@rel=\"insertedBefore\"]")
        .exist()
        .haveAttribute("href", "https://go-server/go/api/feed/pipelines/up42/101.xml");
}
 
Example #21
Source File: PipelineXmlRepresenterTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@Test
void shouldAddPipelineBeforeLink() {
    PipelineTimelineEntry entry = mock(PipelineTimelineEntry.class);
    when(entry.getPipelineName()).thenReturn("up42");
    when(entry.getId()).thenReturn(99L);
    model.setPipelineBefore(entry);

    Document document = new PipelineXmlRepresenter(model).toXml(context);

    XmlAssert.assertThat(document.asXML())
        .nodesByXPath("//pipeline/link[@rel=\"insertedAfter\"]")
        .exist()
        .haveAttribute("href", "https://go-server/go/api/feed/pipelines/up42/99.xml");
}
 
Example #22
Source File: PipelinesXmlRepresenterTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@FileSource(files = "/feeds/pipelines.xml")
void shouldConvertPipelineInstanceModelsToDocument(String expectedXML) {
    XmlWriterContext context = new XmlWriterContext("https://go-server/go", null, null, null, new SystemEnvironment());
    PipelineInstanceModel up42Model = pipelineInstanceModel("up42");
    PipelineInstanceModel up43Model = pipelineInstanceModel("up43");
    PipelineInstanceModels models = createPipelineInstanceModels(up42Model, up43Model);
    PipelinesXmlRepresenter representer = new PipelinesXmlRepresenter(models);

    Document document = representer.toXml(context);

    XmlAssert.assertThat(document.asXML()).and(expectedXML)
        .ignoreWhitespace()
        .areIdentical();
}
 
Example #23
Source File: FeedEntriesRepresenterTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@FileSource(files = "/feeds/stages-with-no-entries.xml")
void shouldGenerateXmlWithoutEntryWhenEmpty(String expectedXML) {
    String pipelineName = "up42";
    XmlWriterContext context = new XmlWriterContext("https://go-server/go", null, null, null, new SystemEnvironment());
    FeedEntries feedEntries = mock(FeedEntries.class);
    when(feedEntries.lastUpdatedDate()).thenReturn(DateUtils.parseISO8601("2019-12-31T07:28:30+05:30"));

    Document document = new FeedEntriesRepresenter(pipelineName, feedEntries).toXml(context);

    XmlAssert.assertThat(document.asXML()).and(expectedXML)
        .ignoreWhitespace()
        .areIdentical();
}
 
Example #24
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldMigrateEverythingAsItIs_Migration120To121() {
    String originalConfig = "<pipelines group=\"first\">" +
            "    <pipeline name=\"Test\" template=\"test_template\">" +
            "      <materials>" +
            "          <git url=\"http://\" dest=\"dest_dir14\" />" +
            "      </materials>" +
            "     </pipeline>" +
            "  </pipelines>" +
            "  <templates>" +
            "    <pipeline name=\"test_template\">" +
            "      <stage name=\"Functional\">" +
            "        <jobs>" +
            "          <job name=\"Functional\">" +
            "            <tasks>" +
            "              <exec command=\"echo\" args=\"Hello World!!!\" />" +
            "            </tasks>" +
            "           </job>" +
            "        </jobs>" +
            "      </stage>" +
            "    </pipeline>" +
            "  </templates>";

    String configXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"120\">" + originalConfig + "</cruise>";

    String expectedConfig =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"121\">" + originalConfig + "</cruise>";

    final String migratedXml = ConfigMigrator.migrate(configXml, 120, 121);
    XmlAssert.assertThat(migratedXml).and(expectedConfig).areIdentical();
}
 
Example #25
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldMigrateEverythingAsItIs_Migration123To124() {
    String originalConfig = "<pipelines group=\"first\">" +
            "    <pipeline name=\"Test\" template=\"test_template\">" +
            "      <materials>" +
            "          <git url=\"http://\" dest=\"dest_dir14\" />" +
            "      </materials>" +
            "     </pipeline>" +
            "  </pipelines>" +
            "  <templates>" +
            "    <pipeline name=\"test_template\">" +
            "      <stage name=\"Functional\">" +
            "        <jobs>" +
            "          <job name=\"Functional\">" +
            "            <tasks>" +
            "              <exec command=\"echo\" args=\"Hello World!!!\" />" +
            "            </tasks>" +
            "           </job>" +
            "        </jobs>" +
            "      </stage>" +
            "    </pipeline>" +
            "  </templates>";

    String configXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"123\">" + originalConfig + "</cruise>";

    String expectedConfig =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"124\">" + originalConfig + "</cruise>";

    final String migratedXml = ConfigMigrator.migrate(configXml, 123, 124);
    XmlAssert.assertThat(migratedXml).and(expectedConfig).areIdentical();
}
 
Example #26
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Test
public void migration130_shouldRemovePropertiesFromJobsUnderPipelinesAndTemplates() {
    String configXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                    + "<cruise schemaVersion=\"129\">"
                    + "    <pipelines>"
                    + "      <pipeline name=\"in_env\">"
                    + "         <materials>"
                    + "           <hg url=\"blah\"/>"
                    + "         </materials>  "
                    + "         <stage name=\"some_stage\">"
                    + "             <jobs>"
                    + "             <job name=\"some_job\">"
                    + "                 <tasks>"
                    + "                     <ant target=\"emma\" />"
                    + "                 </tasks>"
                    + "                 <properties>\n"
                    + "                     <property name=\"coverage.class\" src=\"target/emma/coverage.xml\" xpath=\"substring-before(//report/data/all/coverage[starts-with(@type,'class')]/@value, '%')\" />\n"
                    + "                 </properties>"
                    + "             </job>"
                    + "             </jobs>"
                    + "         </stage>"
                    + "      </pipeline>"
                    + "    </pipelines>"
                    + "    <templates>\n"
                    + "        <pipeline name=\"project-template\">\n"
                    + "            <authorization>\n"
                    + "                <admins>\n"
                    + "                    <user>jez</user>\n"
                    + "                </admins>\n"
                    + "            </authorization>\n"
                    + "            <stage name=\"ut\">\n"
                    + "                <jobs>\n"
                    + "                <job name=\"linux\">\n"
                    + "                    <tasks>"
                    + "                        <ant target=\"emma\" />"
                    + "                    </tasks>"
                    + "                    <properties>\n"
                    + "                        <property name=\"coverage.class\" src=\"target/emma/coverage.xml\" xpath=\"substring-before(//report/data/all/coverage[starts-with(@type,'class')]/@value, '%')\" />\n"
                    + "                    </properties>"
                    + "                </job>\n"
                    + "                </jobs>\n"
                    + "            </stage>\n"
                    + "        </pipeline>\n"
                    + "    </templates>"
                    + "</cruise>";

    String expectedConfig =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                    + "<cruise schemaVersion=\"130\">"
                    + "    <pipelines>"
                    + "      <pipeline name=\"in_env\">"
                    + "         <materials>"
                    + "           <hg url=\"blah\"/>"
                    + "         </materials>  "
                    + "         <stage name=\"some_stage\">"
                    + "             <jobs>"
                    + "             <job name=\"some_job\">"
                    + "                 <tasks>"
                    + "                     <ant target=\"emma\" />"
                    + "                 </tasks>"
                    + "                              </job>"
                    + "             </jobs>"
                    + "         </stage>"
                    + "      </pipeline>"
                    + "    </pipelines>"
                    + "    <templates>\n"
                    + "        <pipeline name=\"project-template\">\n"
                    + "            <authorization>\n"
                    + "                <admins>\n"
                    + "                    <user>jez</user>\n"
                    + "                </admins>\n"
                    + "            </authorization>\n"
                    + "            <stage name=\"ut\">\n"
                    + "                <jobs>\n"
                    + "                <job name=\"linux\">\n"
                    + "                    <tasks>"
                    + "                        <ant target=\"emma\" />"
                    + "                    </tasks>"
                    + "                                    </job>\n"
                    + "                </jobs>\n"
                    + "            </stage>\n"
                    + "        </pipeline>\n"
                    + "    </templates>"
                    + "</cruise>";

    final String migratedXml = ConfigMigrator.migrate(configXml, 129, 130);
    XmlAssert.assertThat(migratedXml).and(expectedConfig).areIdentical();

}
 
Example #27
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Test
public void migration131_shouldRemoveMingleTagFromPipelineTag() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
    String configXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                    + "<cruise schemaVersion=\"130\">"
                    + "    <pipelines>"
                    + "      <pipeline name=\"in_env\">"
                    + "         <mingle"
                    + "             baseUrl='http://mingle.example.com'"
                    + "             projectIdentifier='my_project'>"
                    + "             <mqlGroupingConditions>status > 'In Dev'</mqlGroupingConditions>"
                    + "         </mingle>"
                    + "         <materials>"
                    + "           <hg url=\"blah\"/>"
                    + "         </materials>"
                    + "         <stage name=\"some_stage\">"
                    + "             <jobs>"
                    + "             <job name=\"some_job\">"
                    + "                 <tasks>"
                    + "                    <exec command=\"ls\"/>"
                    + "                 </tasks>"
                    + "             </job>"
                    + "             </jobs>"
                    + "         </stage>"
                    + "      </pipeline>"
                    + "    </pipelines>"
                    + "</cruise>";

    String expectedConfig =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                    + "<cruise schemaVersion=\"131\">"
                    + "    <pipelines>"
                    + "      <pipeline name=\"in_env\">"
                    + "                  <materials>"
                    + "           <hg url=\"blah\"/>"
                    + "         </materials>"
                    + "         <stage name=\"some_stage\">"
                    + "             <jobs>"
                    + "             <job name=\"some_job\">"
                    + "                 <tasks>"
                    + "                    <exec command=\"ls\"/>"
                    + "                 </tasks>"
                    + "             </job>"
                    + "             </jobs>"
                    + "         </stage>"
                    + "      </pipeline>"
                    + "    </pipelines>"
                    + "</cruise>";

    final String migratedXml = ConfigMigrator.migrate(configXml, 130, 131);
    XmlAssert.assertThat(migratedXml).and(expectedConfig).areIdentical();
}
 
Example #28
Source File: RepositoryPurgeConsumerTest.java    From archiva with Apache License 2.0 4 votes vote down vote up
@Test
public void testReleasedSnapshotsWereCleaned()
    throws Exception
{
    RepositoryPurgeConsumer repoPurgeConsumer =
        applicationContext.getBean( "knownRepositoryContentConsumer#repo-purge-consumer-by-days-old",
                                    RepositoryPurgeConsumer.class );
    repoPurgeConsumer.setRepositorySessionFactory( sessionFactory );
    org.apache.archiva.repository.ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME );
    ArtifactCleanupFeature acf = repoConfiguration.getFeature( ArtifactCleanupFeature.class ).get();
    acf.setDeleteReleasedSnapshots( true );
    addRepoToConfiguration( "days-old", repoConfiguration );

    sessionControl.reset();
    sessionFactoryControl.reset();
    EasyMock.expect( sessionFactory.createSession( ) ).andStubReturn( repositorySession );
    EasyMock.expect( repositorySession.getRepository()).andStubReturn( metadataRepository );
    repositorySession.save();
    EasyMock.expectLastCall().anyTimes();
    sessionFactoryControl.replay();
    sessionControl.replay();
    repoPurgeConsumer.beginScan( repoConfiguration, null );

    String repoRoot = prepareTestRepos();
    String projectNs = "org.apache.maven.plugins";
    String projectPath = projectNs.replaceAll("\\.","/");
    String projectName = "maven-plugin-plugin";
    String projectVersion = "2.3-SNAPSHOT";
    String projectRoot = repoRoot + "/" + projectPath+"/"+projectName;
    Path repo = getTestRepoRootPath();
    Path vDir = repo.resolve(projectPath).resolve(projectName).resolve(projectVersion);

    // Provide the metadata list
    List<ArtifactMetadata> ml = getArtifactMetadataFromDir(TEST_REPO_ID , projectName, repo.getParent(), vDir );
    when(metadataRepository.getArtifacts( repositorySession, TEST_REPO_ID,
        projectNs, projectName, projectVersion )).thenReturn(ml);

    repoPurgeConsumer.processFile(
        CleanupReleasedSnapshotsRepositoryPurgeTest.PATH_TO_RELEASED_SNAPSHOT_IN_SAME_REPO );

    verify(metadataRepository, times(1)).removeProjectVersion( eq(repositorySession), eq(TEST_REPO_ID), eq(projectNs), eq(projectName), eq(projectVersion) );
    ArgumentCaptor<ArtifactMetadata> metadataArg = ArgumentCaptor.forClass(ArtifactMetadata.class);
    verify(metadataRepository, never()).removeTimestampedArtifact( eq(repositorySession), any(), any() );

    // check if the snapshot was removed
    assertDeleted( projectRoot + "/2.3-SNAPSHOT" );
    assertDeleted( projectRoot + "/2.3-SNAPSHOT/maven-plugin-plugin-2.3-SNAPSHOT.jar" );
    assertDeleted( projectRoot + "/2.3-SNAPSHOT/maven-plugin-plugin-2.3-SNAPSHOT.jar.md5" );
    assertDeleted( projectRoot + "/2.3-SNAPSHOT/maven-plugin-plugin-2.3-SNAPSHOT.jar.sha1" );
    assertDeleted( projectRoot + "/2.3-SNAPSHOT/maven-plugin-plugin-2.3-SNAPSHOT.pom" );
    assertDeleted( projectRoot + "/2.3-SNAPSHOT/maven-plugin-plugin-2.3-SNAPSHOT.pom.md5" );
    assertDeleted( projectRoot + "/2.3-SNAPSHOT/maven-plugin-plugin-2.3-SNAPSHOT.pom.sha1" );

    // check if metadata file was updated
    Path artifactMetadataFile = Paths.get( projectRoot + "/maven-metadata.xml" );

    String metadataXml = org.apache.archiva.common.utils.FileUtils.readFileToString( artifactMetadataFile, Charset.defaultCharset() );

    String expectedVersions =
        "<expected><versions><version>2.2</version>" + "<version>2.3</version></versions></expected>";

    XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/latest" ).isEqualTo( "2.3" );
    // XMLAssert.assertXpathEvaluatesTo( "2.3", "//metadata/versioning/latest", metadataXml );
    XmlAssert.assertThat( metadataXml ).nodesByXPath( "//metadata/versioning/versions/version" ).hasSize( 2 );
    XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/versions/version[1]" ).isEqualTo( "2.2" );
    XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/versions/version[2]" ).isEqualTo( "2.3" );
    // XMLAssert.assertXpathsEqual( "//expected/versions/version", expectedVersions,
    //                             "//metadata/versioning/versions/version", metadataXml );

    XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/lastUpdated" ).isEqualTo( "20070315032817" );
    //XMLAssert.assertXpathEvaluatesTo( "20070315032817", "//metadata/versioning/lastUpdated", metadataXml );

    removeRepoFromConfiguration( "days-old", repoConfiguration );
}
 
Example #29
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Test
public void shouldMigrateEverythingAsItIs_Migration133To134() {
    String originalConfig = "<server>"
            + "   <security>"
            + "      <roles>"
            + "         <role name='luau-role'><users><user>some-user</user></users></role>"
            + "      </roles>"
            + "   </security>"
            + "</server>"
            + "<pipelines group=\"first\">"
            + "    <pipeline name=\"Test\" template=\"test_template\">"
            + "      <materials>"
            + "          <git url=\"http://\" dest=\"dest_dir14\" />"
            + "      </materials>"
            + "     </pipeline>"
            + "  </pipelines>"
            + "  <templates>"
            + "    <pipeline name=\"test_template\">"
            + "      <stage name=\"Functional\">"
            + "        <approval type=\"manual\" />"
            + "        <jobs>"
            + "          <job name=\"Functional\">"
            + "            <tasks>"
            + "              <exec command=\"echo\" args=\"Hello World!!!\" />"
            + "            </tasks>"
            + "           </job>"
            + "        </jobs>"
            + "      </stage>"
            + "    </pipeline>"
            + "  </templates>";

    String configXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"133\">" + originalConfig + "</cruise>";

    String expectedConfig =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"134\">" + originalConfig + "</cruise>";

    final String migratedXml = ConfigMigrator.migrate(configXml, 133, 134);
    XmlAssert.assertThat(migratedXml).and(expectedConfig).areIdentical();
}
 
Example #30
Source File: GoConfigMigrationIntegrationTest.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Test
public void shouldMigratePipelineLabelTemplateColonToUnderscore_Migration134To135() {
    String originalConfig = "<repositories>\n" +
            "    <repository id=\"0c24bd20-2b24-4fba-9410-aea494d29bf5\" name=\"npm\">\n" +
            "      <pluginConfiguration id=\"npm\" version=\"1\" />\n" +
            "      <configuration>\n" +
            "        <property>\n" +
            "          <key>REPO_URL</key>\n" +
            "          <value>http://npmjs.com/</value>\n" +
            "        </property>\n" +
            "      </configuration>\n" +
            "      <packages>\n" +
            "        <package id=\"07951410-c70e-4a91-be53-8968cf0c07bc\" name=\"my-package\">\n" +
            "          <configuration>\n" +
            "            <property>\n" +
            "              <key>PACKAGE_ID</key>\n" +
            "              <value>v1.0.0</value>\n" +
            "            </property>\n" +
            "          </configuration>\n" +
            "        </package>\n" +
            "      </packages>\n" +
            "    </repository>\n" +
            "  </repositories>" +
            "<pipelines group=\"first\">"
            + "    <pipeline name=\"Test\" template=\"test_template\" labeltemplate=\"${npm:my-package}\">"
            + "      <materials>"
            + "          <git url=\"http://\" dest=\"dest_dir14\" />"
            + "      </materials>"
            + "     </pipeline>"
            + "  </pipelines>"
            + "  <templates>"
            + "    <pipeline name=\"test_template\">"
            + "      <stage name=\"Functional\">"
            + "        <approval type=\"manual\" />"
            + "        <jobs>"
            + "          <job name=\"Functional\">"
            + "            <tasks>"
            + "              <exec command=\"echo\" args=\"Hello World!!!\" />"
            + "            </tasks>"
            + "           </job>"
            + "        </jobs>"
            + "      </stage>"
            + "    </pipeline>"
            + "  </templates>";

    String configXml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<cruise schemaVersion=\"134\">" + originalConfig + "</cruise>";

    String expectedConfig = configXml.replace("134", "135").replace("npm:my-package", "npm_my-package");

    final String migratedXml = ConfigMigrator.migrate(configXml, 134, 135);
    XmlAssert.assertThat(migratedXml).and(expectedConfig).areIdentical();
}