Skip to content

Commit e3dc1c9

Browse files
committed
fix emulated tests
1 parent cc13be7 commit e3dc1c9

File tree

8 files changed

+62
-40
lines changed

8 files changed

+62
-40
lines changed

emulatedtests/Azure.Functions.Java.Tests.E2E/Azure.Functions.Java.Tests.E2E/StorageEndToEndTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public async Task BlobTriggerToBlob_BlobClient_Succeeds()
126126
await StorageHelpers.UpdloadFileToContainer(Constants.TriggerInputBindingBlobClientSdk, fileName);
127127

128128
//Verify
129-
string result = await StorageHelpers.DownloadFileFromContainer(Constants.OutputBindingBlobContainer, fileName);
129+
string result = await StorageHelpers.DownloadFileFromContainer(Constants.OutputBindingBlobContainer, "testfile");
130130
Assert.Equal("Hello World", result);
131131
}
132132

@@ -145,7 +145,7 @@ public async Task BlobTriggerToBlob_BlobContainerClient_Succeeds()
145145
await StorageHelpers.UpdloadFileToContainer(Constants.TriggerInputBindingBlobContainerClientSdk, fileName);
146146

147147
//Verify
148-
string result = await StorageHelpers.DownloadFileFromContainer(Constants.OutputBindingBlobContainer, fileName);
148+
string result = await StorageHelpers.DownloadFileFromContainer(Constants.OutputBindingBlobContainer, "testfile");
149149
Assert.Equal("Hello World", result);
150150
}
151151
}

emulatedtests/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<properties>
2222
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2323
<java.version>1.8</java.version>
24-
<azure.functions.maven.plugin.version>1.18.0</azure.functions.maven.plugin.version>
24+
<azure.functions.maven.plugin.version>1.37.1</azure.functions.maven.plugin.version>
2525
<azure.functions.java.library.version>3.1.0</azure.functions.java.library.version>
2626
<azure.functions.java.library.sql.version>2.1.0</azure.functions.java.library.sql.version>
2727
<durabletask.azure.functions>1.0.0-beta.1</durabletask.azure.functions>

emulatedtests/src/main/java/com/microsoft/azure/functions/endtoend/BlobTriggerTests.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import com.microsoft.azure.functions.annotation.*;
44

55
import java.io.ByteArrayOutputStream;
6-
import java.util.List;
7-
import java.util.Optional;
86

97
import com.microsoft.azure.functions.*;
108

@@ -69,7 +67,7 @@ public void BlobTriggerStringTest(
6967
public void BlobTriggerToBlobTest_BlobClient(
7068
@BlobTrigger(name = "triggerBlob", path = "test-triggerinput-blobclient/{name}", dataType = "binary") BlobClient triggerBlobClient,
7169
@BindingName("name") String fileName,
72-
@BlobOutput(name = "outputBlob", path = "test-output-java-new/{name}", dataType = "binary") OutputBinding<byte[]> outputBlob,
70+
@BlobOutput(name = "outputBlob", path = "test-output-java-new/testfile.txt", dataType = "binary") OutputBinding<byte[]> outputBlob,
7371
final ExecutionContext context
7472
) {
7573
context.getLogger().info("BlobTriggerUsingBlobClient triggered for blob: " + fileName);
@@ -80,7 +78,7 @@ public void BlobTriggerToBlobTest_BlobClient(
8078

8179
// Set the downloaded content as output
8280
outputBlob.setValue(outputStream.toByteArray());
83-
context.getLogger().info("Blob content copied successfully from trigger blob to output blob.");
81+
context.getLogger().info("Uploaded blob " + fileName + " to container test-output-java-new/testfile.txt");
8482
}
8583

8684
/**
@@ -91,7 +89,7 @@ public void BlobTriggerToBlobTest_BlobClient(
9189
public void BlobTriggerToBlobTest_BlobContainerClient(
9290
@BlobTrigger(name = "triggerBlob", path = "test-triggerinput-blobcontclient/{name}", dataType = "binary") BlobContainerClient triggerBlobContainerClient,
9391
@BindingName("name") String fileName,
94-
@BlobOutput(name = "outputBlob", path = "test-output-java-new/{name}", dataType = "binary") OutputBinding<byte[]> outputBlob,
92+
@BlobOutput(name = "outputBlob", path = "test-output-java-new/testfile.txt", dataType = "binary") OutputBinding<byte[]> outputBlob,
9593
final ExecutionContext context
9694
) {
9795
context.getLogger().info("BlobTriggerUsingBlobContainerClient triggered for blob: " + fileName);
@@ -103,7 +101,7 @@ public void BlobTriggerToBlobTest_BlobContainerClient(
103101

104102
// Set the downloaded content as output
105103
outputBlob.setValue(outputStream.toByteArray());
106-
context.getLogger().info("Blob content copied successfully from trigger blob to output blob.");
104+
context.getLogger().info("Uploaded blob " + fileName + " to container test-output-java-new/testfile.txt");
107105
}
108106

109107
public static class TestBlobData {

eng/ci/templates/jobs/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
java -version
1616
displayName: 'Check default java version'
1717
- pwsh: |
18-
.\installJavaAdditions.ps1
18+
.\installLibsLocally.ps1
1919
displayName: 'Install java-additions locally'
2020
- pwsh: |
2121
mvn clean package

eng/ci/templates/jobs/run-emulated-tests-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
java -version
5959
displayName: 'Check default java version'
6060
- pwsh: |
61-
.\installJavaAdditions.ps1
61+
.\installLibsLocally.ps1
6262
displayName: 'Install java-additions locally'
6363
- pwsh: |
6464
if ("$(isTag)"){

eng/ci/templates/jobs/run-emulated-tests-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
java -version
4949
displayName: 'Check default java version'
5050
- pwsh: |
51-
.\installJavaAdditions.ps1
51+
.\installLibsLocally.ps1
5252
displayName: 'Install java-additions locally'
5353
- pwsh: |
5454
if ("$(isTag)"){

installJavaAdditions.ps1

Lines changed: 0 additions & 28 deletions
This file was deleted.

installLibsLocally.ps1

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Variables for first repository
2+
$repoUrl1 = 'https://github.com/ahmedmuhsin/azure-functions-java-additions.git'
3+
$branchName1 = 'sdk-types'
4+
$repoName1 = 'azure-functions-java-additions'
5+
6+
# Clone the first repository
7+
git clone $repoUrl1
8+
9+
# Change directory to the cloned repository
10+
Set-Location $repoName1
11+
12+
# Checkout the desired branch
13+
git checkout $branchName1
14+
15+
# Detect OS and execute build accordingly
16+
if ($IsWindows) {
17+
# Run the batch script (mvnBuild.bat)
18+
& ".\mvnBuild.bat"
19+
} else {
20+
# Extract and explicitly invoke the mvn command from mvnBuild.bat
21+
$mvnCommand = Get-Content "./mvnBuild.bat" | Where-Object { $_ -match '^mvn\s+' }
22+
if ($null -ne $mvnCommand) {
23+
# Execute the extracted mvn command explicitly as a single line
24+
bash -c "$mvnCommand"
25+
} else {
26+
Write-Error "No mvn command found in mvnBuild.bat."
27+
}
28+
}
29+
30+
# Return to the parent directory before working on the second repository
31+
Set-Location ..
32+
33+
# Variables for second repository
34+
$repoUrl2 = 'https://github.com/ahmedmuhsin/azure-maven-plugins.git'
35+
$branchName2 = 'sdk-types'
36+
$repoName2 = 'azure-maven-plugins'
37+
38+
# Clone the second repository
39+
git clone $repoUrl2
40+
41+
# Change directory to the cloned repository
42+
Set-Location $repoName2
43+
44+
# Checkout the desired branch
45+
git checkout $branchName2
46+
47+
# Run Maven command to build/install, skipping tests and javadoc
48+
if ($IsWindows) {
49+
& "mvn" "clean" "install" "-DskipTests" "-Dmaven.javadoc.skip=true"
50+
} else {
51+
bash -c "mvn clean install -DskipTests -Dmaven.javadoc.skip=true"
52+
}

0 commit comments

Comments
 (0)