Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from Azure:main #338

Merged
merged 8 commits into from
Dec 20, 2022
Merged
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,13 @@ com.azure.resourcemanager:azure-resourcemanager-hdinsight;1.0.0;1.1.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-sqlvirtualmachine;1.0.0-beta.3;1.0.0-beta.4
com.azure.resourcemanager:azure-resourcemanager-relay;1.0.0-beta.2;1.0.0-beta.3
com.azure.resourcemanager:azure-resourcemanager-costmanagement;1.0.0-beta.3;1.0.0-beta.4
com.azure.resourcemanager:azure-resourcemanager-recoveryservices;1.0.0-beta.3;1.0.0-beta.4
com.azure.resourcemanager:azure-resourcemanager-recoveryservices;1.0.0-beta.4;1.0.0-beta.5
com.azure.resourcemanager:azure-resourcemanager-kusto;1.0.0-beta.5;1.0.0-beta.6
com.azure.resourcemanager:azure-resourcemanager-loganalytics;1.0.0-beta.3;1.0.0-beta.4
com.azure.resourcemanager:azure-resourcemanager-eventgrid;1.1.0;1.2.0-beta.4
com.azure.resourcemanager:azure-resourcemanager-healthbot;1.0.0-beta.2;1.0.0-beta.3
com.azure.resourcemanager:azure-resourcemanager-confluent;1.0.0-beta.3;1.0.0-beta.4
com.azure.resourcemanager:azure-resourcemanager-digitaltwins;1.0.0;1.1.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-digitaltwins;1.0.0;1.1.0-beta.2
com.azure.resourcemanager:azure-resourcemanager-netapp;1.0.0-beta.11;1.0.0-beta.12
com.azure.resourcemanager:azure-resourcemanager-storagecache;1.0.0-beta.6;1.0.0-beta.7
com.azure.resourcemanager:azure-resourcemanager-redisenterprise;1.0.0;1.1.0-beta.2
Expand Down
101 changes: 101 additions & 0 deletions sdk/cosmos/azure-cosmos/docs/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
This document currently details Maven commands for building Azure Cosmos SDK.

### Fork and clone the repository
To build and develop locally, it is strongly recommended to fork and clone the repository: https://github.com/Azure/azure-sdk-for-java

<u>**NOTE:**</u> If running on Windows please ensure that you have enabled LFS-support in Git - see the installation instructions [here](https://git-lfs.com/).

**<u>NOTE:</u>** All of the below commands need to be run from home directory of azure-sdk-for-java repository.

### JDK 8 vs JDK 11
The build system is configured to support JDK, as well as the current long-term support version of the JDK (currently JDK 11). The commands presented below will work on both JDKs.

### Installing the build tools
Building azure-cosmos SDK locally depends on the availability of the build tooling. This can be installed by running the following:

```shell
mvn install -f eng/code-quality-reports/pom.xml
```

### Building and Testing

To build azure-cosmos library using maven command line, run the following command

```shell
mvn -e -Dgpg.skip -DskipTests -Dmaven.javadoc.skip=true -Dcodesnippet.skip=true -Dspotbugs.skip=true -Dcheckstyle.skip=true -Drevapi.skip=true -pl com.azure:azure-cosmos -am clean verify
```

Tips: if you're using powershell on windows, you may run into this error`[ERROR] Unknown lifecycle phase ".skip". You must specify a valid lifecycle phase or a goal in the format`, this can be fixed by telling powershell to stop parsing this command with [stop-parsing parameter "--%"](https://technet.microsoft.com/library/hh847892.aspx)

```shell
mvn --% -e -Dgpg.skip -DskipTests -Dmaven.javadoc.skip=true -Dcodesnippet.skip=true -Dspotbugs.skip=true -Dcheckstyle.skip=true -Drevapi.skip=true -pl com.azure:azure-cosmos -am clean verify
```

To run unit tests, simply remove `-DskipTests` option from above commands.

### Testing for SpotBugs, CheckStyle, and JavaDoc issues
SpotBugs, CheckStyle, and JavaDoc plugins are configured to break the build if there are any issues discovered by them. It is therefore strongly recommended to run the following maven options locally before submitting a pull request:

```shell
-Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true
```

### Testing for breaking API changes
The build is configured with [Revapi](https://revapi.org) plugin to check builds against the latest GA release in Maven. Build will fail when a breaking change is detected. To check for breaking changes, run the following maven options locally before submitting a pull request:

```shell
-Drevapi.skip=true
```

### Skipping analysis for local build

The default mvn build/install command executes the code quality tools that run analysis for check-style violations, bugs and breaking changes. The build takes more time to complete with these analyses enabled. For intermediate build/install during local development, they can be skipped by adding the following mvn options:

```
-Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -Drevapi.skip=true -Dcodesnippet.skip=true
```

Note: It is strongly recommended to run the analysis locally before submitting a pull request.

### Setting IntelliJ IDE for Java SDK

Open azure-sdk-for-java/sdk/cosmos/azure-cosmos/pom.xml in IntelliJ IDE as project to import it as a maven project:
![Screenshot 2022-12-19 at 1 51 17 PM](https://user-images.githubusercontent.com/14034156/208549832-9edf00d6-613a-4efd-a410-eaeb7abe86cd.png)


### Defining Project Structure

Open project structure through project settings for azure-cosmos project and set the SDK and Language Level to JDK 11 under Project tab:
![Screenshot 2022-12-19 at 1 54 08 PM](https://user-images.githubusercontent.com/14034156/208549843-4824a467-9d21-4ffa-bc56-7f14da9d573c.png)

Open Modules tab in the same settings and set the Language level to match project default, which should be JDK 11:
![Screenshot 2022-12-19 at 1 58 27 PM](https://user-images.githubusercontent.com/14034156/208549863-d541c174-c7a3-48d6-b186-e19b78153cff.png)


Set target bytecode version for the project azure-cosmos in IntelliJ Preferences for Java Compiler as JDK 11:
![Screenshot 2022-12-19 at 2 23 22 PM](https://user-images.githubusercontent.com/14034156/208549894-39804c35-9f4c-4b74-b076-aeaf24edd847.png)

### Installing the Cosmos DB emulator

Setup Azure Cosmos DB Emulator by following [this instruction](https://docs.microsoft.com/azure/cosmos-db/local-emulator). Then please export the emulator's SSL certificates and install them in the JVM trust stores on your development machine following [this instruction](https://learn.microsoft.com/azure/cosmos-db/local-emulator-export-ssl-certificates).

### Running Unit Tests

Unit tests are tests with group "unit" and can be run from IntelliJ directly without needing any Azure Cosmos DB Account or Emulator support. To run them, right click on any unit test class and run them. To test this, run `ClientConfigDiagnosticsTest` from IntelliJ IDE directly.

### Running Integration Tests

Azure Cosmos Java SDK has different Integration tests which can be run with Azure Cosmos Emulator or Azure Cosmos DB production Account.

Emulator Integration tests are with test group `emulator`, labeled in the code as `groups = { "emulator" }` and can be run from IntelliJ after starting Azure Cosmos DB Emulator on the local development machine. For example, `DocumentCrudTest` is of group emulator.

Latest version of Azure Cosmos DB Emulator can be downloaded and installed from [here](https://learn.microsoft.com/azure/cosmos-db/local-emulator)
Our CI pipelines start Azure Cosmos DB Emulator with these parameters. It is highly recommended to use these for local development and testing.
```shell
/enablepreview /EnableSqlComputeEndpoint /disableratelimiting /enableaadauthentication /partitioncount=50 /consistency=Strong
```

Other test groups are meant to be tested against Azure Cosmos DB production account, but can also be tested against Emulator. There are multiple different test groups like `groups = {"simple", "long", "direct", "multi-region", "multi-master"}`. For example, `CosmosItemTest` is a simple group test which can be run against Azure Cosmos DB production account, as well as against emulator.

To run any test against Azure Cosmos DB production account, it is required to update `TestConfigurations.java` class with account host and key.
NOTE: When creating a PR, make sure to remove any account key and account host information from the PR. To avoid security breaches, never commit and push any keys and host information related to Azure Cosmos DB Account.
49 changes: 48 additions & 1 deletion sdk/digitaltwins/azure-resourcemanager-digitaltwins/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release History

## 1.1.0-beta.1 (Unreleased)
## 1.1.0-beta.2 (Unreleased)

### Features Added

Expand All @@ -10,6 +10,53 @@

### Other Changes

## 1.1.0-beta.1 (2022-12-20)

- Azure Resource Manager AzureDigitalTwins client library for Java. This package contains Microsoft Azure SDK for AzureDigitalTwins Management SDK. Azure Digital Twins Client for managing DigitalTwinsInstance. Package tag package-2022-10. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

### Features Added

* `models.IdentityType` was added

* `models.UserAssignedIdentity` was added

* `models.ManagedIdentityReference` was added

#### `models.DigitalTwinsIdentity` was modified

* `withUserAssignedIdentities(java.util.Map)` was added
* `userAssignedIdentities()` was added

#### `models.EventGrid` was modified

* `withIdentity(models.ManagedIdentityReference)` was added
* `withIdentity(models.ManagedIdentityReference)` was added

#### `models.DigitalTwinsEndpointResourceProperties` was modified

* `withIdentity(models.ManagedIdentityReference)` was added
* `identity()` was added

#### `models.TimeSeriesDatabaseConnectionProperties` was modified

* `identity()` was added
* `withIdentity(models.ManagedIdentityReference)` was added

#### `models.AzureDataExplorerConnectionProperties` was modified

* `withIdentity(models.ManagedIdentityReference)` was added
* `withIdentity(models.ManagedIdentityReference)` was added

#### `models.EventHub` was modified

* `withIdentity(models.ManagedIdentityReference)` was added
* `withIdentity(models.ManagedIdentityReference)` was added

#### `models.ServiceBus` was modified

* `withIdentity(models.ManagedIdentityReference)` was added
* `withIdentity(models.ManagedIdentityReference)` was added

## 1.0.0 (2022-06-30)

- Azure Resource Manager AzureDigitalTwins client library for Java. This package contains Microsoft Azure SDK for AzureDigitalTwins Management SDK. Azure Digital Twins Client for managing DigitalTwinsInstance. Package tag package-2022-05. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
Expand Down
27 changes: 15 additions & 12 deletions sdk/digitaltwins/azure-resourcemanager-digitaltwins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Azure Resource Manager AzureDigitalTwins client library for Java.

This package contains Microsoft Azure SDK for AzureDigitalTwins Management SDK. Azure Digital Twins Client for managing DigitalTwinsInstance. Package tag package-2022-05. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
This package contains Microsoft Azure SDK for AzureDigitalTwins Management SDK. Azure Digital Twins Client for managing DigitalTwinsInstance. Package tag package-2022-10. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

## We'd love to hear your feedback

Expand Down Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-digitaltwins</artifactId>
<version>1.0.0</version>
<version>1.1.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -41,19 +41,19 @@ Various documentation is available to help you get started

Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client.

[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation.
[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation.

### Authentication

By default, Azure Active Directory token authentication depends on correct configure of following environment variables.
By default, Azure Active Directory token authentication depends on correct configuration of the following environment variables.

- `AZURE_CLIENT_ID` for Azure client ID.
- `AZURE_TENANT_ID` for Azure tenant ID.
- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate.

In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`.
In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable.

With above configuration, `azure` client can be authenticated by following code:
With above configuration, `azure` client can be authenticated using the following code:

```java
AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
Expand Down Expand Up @@ -83,13 +83,13 @@ See [API design][design] for general introduction on design and key concepts on

## Contributing

For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md).
For details on contributing to this repository, see the [contributing guide][cg].

1. Fork it
1. Create your feature branch (`git checkout -b my-new-feature`)
1. Commit your changes (`git commit -am 'Add some feature'`)
1. Push to the branch (`git push origin my-new-feature`)
1. Create new Pull Request
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit <https://cla.microsoft.com>.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact <[email protected]> with any additional questions or comments.

<!-- LINKS -->
[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS
Expand All @@ -100,3 +100,6 @@ For details on contributing to this repository, see the [contributing guide](htt
[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty
[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md
[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md
[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md
[coc]: https://opensource.microsoft.com/codeofconduct/
[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
Loading