Skip to content

Commit

Permalink
checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
paullatzelsperger committed Jan 30, 2024
1 parent dc479a7 commit 4b02a34
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import io.restassured.http.Header;
import org.eclipse.edc.identityhub.spi.events.diddocument.DidDocumentPublished;
import org.eclipse.edc.identityhub.spi.events.diddocument.DidDocumentUnpublished;
import org.eclipse.edc.identityhub.spi.events.keypair.KeyPairAdded;
import org.eclipse.edc.identityhub.spi.model.participant.ParticipantContext;
import org.eclipse.edc.junit.annotations.EndToEndTest;
import org.eclipse.edc.spi.event.EventRouter;
Expand All @@ -26,7 +25,12 @@
import org.junit.jupiter.api.Test;

import static io.restassured.http.ContentType.JSON;
import static org.mockito.Mockito.*;
import static org.mockito.Mockito.argThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;

@EndToEndTest
public class DidManagementApiEndToEndTest extends ManagementApiEndToEndTest {
Expand Down Expand Up @@ -93,12 +97,13 @@ void publishDid() {

// verify that the publish event was fired twice
verify(subscriber, times(2)).on(argThat(env -> {
if(env.getPayload() instanceof DidDocumentPublished event){
if (env.getPayload() instanceof DidDocumentPublished event) {
return event.getDid().equals("did:web:test-user");
}
return false;
}));
}

@Test
void unpublishDid_notOwner_expect403() {
var subscriber = mock(EventSubscriber.class);
Expand Down Expand Up @@ -136,6 +141,7 @@ void unpublishDid_notOwner_expect403() {

verifyNoInteractions(subscriber);
}

@Test
void unpublishDid() {

Expand All @@ -160,12 +166,13 @@ void unpublishDid() {

// verify that the publish event was fired twice
verify(subscriber).on(argThat(env -> {
if(env.getPayload() instanceof DidDocumentUnpublished event){
if (env.getPayload() instanceof DidDocumentUnpublished event) {
return event.getDid().equals("did:web:test-user");
}
return false;
}));
}

@Test
void getState_nowOwner_expect403() {
var user1 = "user1";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright (c) 2024 Metaform Systems, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Metaform Systems, Inc. - initial API and implementation
*
*/

package org.eclipse.edc.identityhub.publisher.did.local;

import org.eclipse.edc.iam.did.spi.document.DidDocument;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright (c) 2024 Metaform Systems, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Metaform Systems, Inc. - initial API and implementation
*
*/

package org.eclipse.edc.identityhub.publisher.did.local;

import org.eclipse.edc.identityhub.spi.events.diddocument.DidDocumentListener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public Result<Void> unpublish(String did) {
return didResourceStore.update(existingDocument)
.map(v -> success())
.orElse(f -> failure(f.getFailureDetail()))
.onSuccess(v -> observable.invokeForEach(l -> l.unpublished(existingDocument.getDocument(), existingDocument.getParticipantId() )));
.onSuccess(v -> observable.invokeForEach(l -> l.unpublished(existingDocument.getDocument(), existingDocument.getParticipantId())));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,14 @@ public void initialize(ServiceExtensionContext context) {
}

@Provider
public DidDocumentObservable didDocumentObservable(){
if(observable == null){
public DidDocumentObservable didDocumentObservable() {
if (observable == null) {
observable = new DidDocumentObservableImpl();
observable.registerListener(new DidDocumentListenerImpl(clock, eventRouter));
}
return observable;
}

private DidWebParser getDidParser() {
return didWebParser != null ? didWebParser : new DidWebParser();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright (c) 2024 Metaform Systems, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Metaform Systems, Inc. - initial API and implementation
*
*/

package org.eclipse.edc.identityhub.spi.events.diddocument;

import org.eclipse.edc.spi.event.Event;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright (c) 2024 Metaform Systems, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Metaform Systems, Inc. - initial API and implementation
*
*/

package org.eclipse.edc.identityhub.spi.events.diddocument;

import org.eclipse.edc.spi.observe.Observable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright (c) 2024 Metaform Systems, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Metaform Systems, Inc. - initial API and implementation
*
*/

package org.eclipse.edc.identityhub.spi.events.diddocument;

import com.fasterxml.jackson.annotation.JsonCreator;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright (c) 2024 Metaform Systems, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Metaform Systems, Inc. - initial API and implementation
*
*/

package org.eclipse.edc.identityhub.spi.events.diddocument;

import com.fasterxml.jackson.annotation.JsonCreator;
Expand Down

0 comments on commit 4b02a34

Please sign in to comment.