Skip to content
8 changes: 5 additions & 3 deletions .github/workflows/atr-release-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,18 @@ jobs:
echo "Total size: $(du -sh build/distributions | cut -f1)"

- name: Upload artifacts to ATR (Real)
if: ${{ !inputs.dry_run }}
if: ${{ !inputs.dry_run && secrets.ASF_USERNAME != '' }}
uses: apache/tooling-actions/upload-to-atr@main
with:
asf-uid: ${{ secrets.ASF_USERNAME }}
project: ${{ env.ATR_PROJECT_NAME }}
version: ${{ inputs.release_version }}-${{ inputs.release_candidate }}
src: build/distributions
atr-host: release-test.apache.org
ssh-port: 2222

- name: Upload artifacts for review
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # 6.0.0
uses: actions/upload-artifact@v3
with:
name: test-release-artifacts-${{ inputs.release_version }}-${{ inputs.release_candidate }}
path: build/distributions/
Expand Down Expand Up @@ -342,7 +343,7 @@ jobs:
echo "----------------------------------------"

- name: Resolve vote and announce on ATR (Real)
if: ${{ !inputs.dry_run }}
if: ${{ !inputs.dry_run && secrets.ASF_USERNAME != '' }}
uses: apache/tooling-actions/release-on-atr@main
with:
version: ${{ inputs.release_version }}
Expand All @@ -362,6 +363,7 @@ jobs:
echo "✅ Dry run completed successfully" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "To test with real ATR (requires onboarding):" >> $GITHUB_STEP_SUMMARY
echo "1. Add ASF_USERNAME secret" >> $GITHUB_STEP_SUMMARY
echo "2. Run workflow with dry_run=false" >> $GITHUB_STEP_SUMMARY
else
echo "✅ ATR test completed" >> $GITHUB_STEP_SUMMARY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void testUrlNormalization(String inputUrl, String expectedUrl) {
// Clean up
try {
client.close();
} catch (Exception e) {
} catch (Exception _) {
// Ignore close errors in test
}
}
Expand All @@ -109,7 +109,7 @@ void testUrlWithoutTrailingSlash() {

try {
client.close();
} catch (Exception e) {
} catch (Exception _) {
// Ignore close errors in test
}
}
Expand All @@ -128,7 +128,7 @@ void testUrlWithTrailingSlashButNoSolrPath() {

try {
client.close();
} catch (Exception e) {
} catch (Exception _) {
// Ignore close errors in test
}
}
Expand All @@ -147,7 +147,7 @@ void testUrlWithSolrPathButNoTrailingSlash() {

try {
client.close();
} catch (Exception e) {
} catch (Exception _) {
// Ignore close errors in test
}
}
Expand All @@ -166,7 +166,7 @@ void testUrlAlreadyProperlyFormatted() {

try {
client.close();
} catch (Exception e) {
} catch (Exception _) {
// Ignore close errors in test
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -802,9 +802,8 @@ void indexJsonDocuments_WhenDocumentCreatorThrowsException_ShouldPropagateExcept
when(indexingDocumentCreator.createSchemalessDocumentsFromJson(invalidJson)).thenThrow(
new org.apache.solr.mcp.server.indexing.documentcreator.DocumentProcessingException("Invalid JSON"));

assertThrows(org.apache.solr.mcp.server.indexing.documentcreator.DocumentProcessingException.class, () -> {
indexingService.indexJsonDocuments("test_collection", invalidJson);
});
assertThrows(org.apache.solr.mcp.server.indexing.documentcreator.DocumentProcessingException.class,
() -> indexingService.indexJsonDocuments("test_collection", invalidJson));
verify(solrClient, never()).add(anyString(), any(Collection.class));
verify(solrClient, never()).commit(anyString());
}
Expand All @@ -830,9 +829,8 @@ void indexCsvDocuments_WhenDocumentCreatorThrowsException_ShouldPropagateExcepti
when(indexingDocumentCreator.createSchemalessDocumentsFromCsv(invalidCsv)).thenThrow(
new org.apache.solr.mcp.server.indexing.documentcreator.DocumentProcessingException("Invalid CSV"));

assertThrows(org.apache.solr.mcp.server.indexing.documentcreator.DocumentProcessingException.class, () -> {
indexingService.indexCsvDocuments("test_collection", invalidCsv);
});
assertThrows(org.apache.solr.mcp.server.indexing.documentcreator.DocumentProcessingException.class,
() -> indexingService.indexCsvDocuments("test_collection", invalidCsv));
verify(solrClient, never()).add(anyString(), any(Collection.class));
verify(solrClient, never()).commit(anyString());
}
Expand All @@ -858,9 +856,8 @@ void indexXmlDocuments_WhenParserConfigurationFails_ShouldPropagateException() t
when(indexingDocumentCreator.createSchemalessDocumentsFromXml(xml)).thenThrow(
new org.apache.solr.mcp.server.indexing.documentcreator.DocumentProcessingException("Parser error"));

assertThrows(org.apache.solr.mcp.server.indexing.documentcreator.DocumentProcessingException.class, () -> {
indexingService.indexXmlDocuments("test_collection", xml);
});
assertThrows(org.apache.solr.mcp.server.indexing.documentcreator.DocumentProcessingException.class,
() -> indexingService.indexXmlDocuments("test_collection", xml));
verify(solrClient, never()).add(anyString(), any(Collection.class));
verify(solrClient, never()).commit(anyString());
}
Expand All @@ -872,9 +869,8 @@ void indexXmlDocuments_WhenSaxExceptionOccurs_ShouldPropagateException() throws
.thenThrow(new org.apache.solr.mcp.server.indexing.documentcreator.DocumentProcessingException(
"SAX parsing error"));

assertThrows(org.apache.solr.mcp.server.indexing.documentcreator.DocumentProcessingException.class, () -> {
indexingService.indexXmlDocuments("test_collection", xml);
});
assertThrows(org.apache.solr.mcp.server.indexing.documentcreator.DocumentProcessingException.class,
() -> indexingService.indexXmlDocuments("test_collection", xml));
verify(solrClient, never()).add(anyString(), any(Collection.class));
verify(solrClient, never()).commit(anyString());
}
Expand Down Expand Up @@ -959,9 +955,7 @@ void indexDocuments_WhenCommitFails_ShouldPropagateException() throws Exception
when(solrClient.add(eq("test_collection"), any(Collection.class))).thenReturn(null);
when(solrClient.commit("test_collection")).thenThrow(new IOException("Commit failed"));

assertThrows(IOException.class, () -> {
indexingService.indexDocuments("test_collection", docs);
});
assertThrows(IOException.class, () -> indexingService.indexDocuments("test_collection", docs));
verify(solrClient).add(eq("test_collection"), any(Collection.class));
verify(solrClient).commit("test_collection");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,22 @@ void testGetSchema_ValidCollection() throws Exception {
@Test
void testGetSchema_InvalidCollection() {
// When/Then
assertThrows(Exception.class, () -> {
schemaService.getSchema("non_existent_collection_12345");
}, "Getting schema for non-existent collection should throw exception");
assertThrows(Exception.class, () -> schemaService.getSchema("non_existent_collection_12345"),
"Getting schema for non-existent collection should throw exception");
}

@Test
void testGetSchema_NullCollection() {
// When/Then
assertThrows(Exception.class, () -> {
schemaService.getSchema(null);
}, "Getting schema with null collection should throw exception");
assertThrows(Exception.class, () -> schemaService.getSchema(null),
"Getting schema with null collection should throw exception");
}

@Test
void testGetSchema_EmptyCollection() {
// When/Then
assertThrows(Exception.class, () -> {
schemaService.getSchema("");
}, "Getting schema with empty collection should throw exception");
assertThrows(Exception.class, () -> schemaService.getSchema(""),
"Getting schema with empty collection should throw exception");
}

@Test
Expand Down