Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1078] use DittoDuration format for AzSaslRequestSigning's ttl param…
…eter. Signed-off-by: Yufei Cai <yufei.cai@bosch.io>
- Loading branch information
Showing
2 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...clipse/ditto/connectivity/service/messaging/httppush/AzSaslRequestSigningFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright (c) 2021 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.eclipse.ditto.connectivity.service.messaging.httppush; | ||
|
||
import java.util.Base64; | ||
|
||
import org.eclipse.ditto.connectivity.model.HmacCredentials; | ||
import org.eclipse.ditto.json.JsonObject; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import akka.actor.ActorSystem; | ||
import akka.testkit.javadsl.TestKit; | ||
|
||
/** | ||
* Tests {@link org.eclipse.ditto.connectivity.service.messaging.httppush.AzSaslRequestSigningFactory}. | ||
*/ | ||
public final class AzSaslRequestSigningFactoryTest { | ||
|
||
private ActorSystem actorSystem; | ||
|
||
@Before | ||
public void start() { | ||
actorSystem = ActorSystem.create(); | ||
} | ||
|
||
@After | ||
public void stop() { | ||
if (actorSystem != null) { | ||
TestKit.shutdownActorSystem(actorSystem); | ||
} | ||
} | ||
|
||
@Test | ||
public void create() { | ||
final AzSaslRequestSigningFactory underTest = new AzSaslRequestSigningFactory(); | ||
final HmacCredentials credentials = HmacCredentials.of("az-sasl", JsonObject.newBuilder() | ||
.set("sharedKeyName", "name") | ||
.set("sharedKey", Base64.getEncoder().encodeToString("shared key".getBytes())) | ||
.set("endpoint", "example.com") | ||
.set("ttl", "15m") | ||
.build()); | ||
|
||
underTest.create(actorSystem, credentials); | ||
} | ||
} |