diff --git a/.github/workflows/atr-release-test.yml b/.github/workflows/atr-release-test.yml index cfe4882..94f2484 100644 --- a/.github/workflows/atr-release-test.yml +++ b/.github/workflows/atr-release-test.yml @@ -220,9 +220,10 @@ 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 @@ -230,7 +231,7 @@ jobs: 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/ @@ -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 }} @@ -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 diff --git a/src/test/java/org/apache/solr/mcp/server/config/SolrConfigTest.java b/src/test/java/org/apache/solr/mcp/server/config/SolrConfigTest.java index 342ddd0..e4dfe36 100644 --- a/src/test/java/org/apache/solr/mcp/server/config/SolrConfigTest.java +++ b/src/test/java/org/apache/solr/mcp/server/config/SolrConfigTest.java @@ -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 } } @@ -109,7 +109,7 @@ void testUrlWithoutTrailingSlash() { try { client.close(); - } catch (Exception e) { + } catch (Exception _) { // Ignore close errors in test } } @@ -128,7 +128,7 @@ void testUrlWithTrailingSlashButNoSolrPath() { try { client.close(); - } catch (Exception e) { + } catch (Exception _) { // Ignore close errors in test } } @@ -147,7 +147,7 @@ void testUrlWithSolrPathButNoTrailingSlash() { try { client.close(); - } catch (Exception e) { + } catch (Exception _) { // Ignore close errors in test } } @@ -166,7 +166,7 @@ void testUrlAlreadyProperlyFormatted() { try { client.close(); - } catch (Exception e) { + } catch (Exception _) { // Ignore close errors in test } } diff --git a/src/test/java/org/apache/solr/mcp/server/indexing/IndexingServiceTest.java b/src/test/java/org/apache/solr/mcp/server/indexing/IndexingServiceTest.java index c0bec69..ea6dc80 100644 --- a/src/test/java/org/apache/solr/mcp/server/indexing/IndexingServiceTest.java +++ b/src/test/java/org/apache/solr/mcp/server/indexing/IndexingServiceTest.java @@ -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()); } @@ -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()); } @@ -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()); } @@ -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()); } @@ -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"); } diff --git a/src/test/java/org/apache/solr/mcp/server/metadata/SchemaServiceIntegrationTest.java b/src/test/java/org/apache/solr/mcp/server/metadata/SchemaServiceIntegrationTest.java index 020162f..f3a8c06 100644 --- a/src/test/java/org/apache/solr/mcp/server/metadata/SchemaServiceIntegrationTest.java +++ b/src/test/java/org/apache/solr/mcp/server/metadata/SchemaServiceIntegrationTest.java @@ -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