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

feat: servicedefinition tests #13731

Merged
merged 3 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions hedera-node/hedera-consensus-service/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ description = "Hedera Consensus Service API"
// Remove the following line to enable all 'javac' lint checks that we have turned on by default
// and then fix the reported issues.
tasks.withType<JavaCompile>().configureEach { options.compilerArgs.add("-Xlint:-exports") }

testModuleInfo {
requires("org.assertj.core")
requires("org.junit.jupiter.api")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.hedera.node.app.service.consensus;

import com.hedera.hapi.node.base.Transaction;
import com.hedera.hapi.node.transaction.Query;
import com.hedera.hapi.node.transaction.Response;
import com.hedera.hapi.node.transaction.TransactionResponse;
import com.hedera.pbj.runtime.RpcMethodDefinition;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

class ConsensusServiceDefinitionTest {

@Test
void checkBasePath() {
Assertions.assertThat(ConsensusServiceDefinition.INSTANCE.basePath()).isEqualTo("proto.ConsensusService");
}

@Test
void methodsDefined() {
final var methods = ConsensusServiceDefinition.INSTANCE.methods();
Assertions.assertThat(methods)
.containsExactlyInAnyOrder(
new RpcMethodDefinition<>("createTopic", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("updateTopic", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("deleteTopic", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("getTopicInfo", Query.class, Response.class),
new RpcMethodDefinition<>("submitMessage", Transaction.class, TransactionResponse.class));
}
}
5 changes: 5 additions & 0 deletions hedera-node/hedera-file-service/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ description = "Hedera File Service API"
// Remove the following line to enable all 'javac' lint checks that we have turned on by default
// and then fix the reported issues.
tasks.withType<JavaCompile>().configureEach { options.compilerArgs.add("-Xlint:-exports") }

testModuleInfo {
requires("org.assertj.core")
requires("org.junit.jupiter.api")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.hedera.node.app.service.file;

import com.hedera.hapi.node.base.Transaction;
import com.hedera.hapi.node.transaction.Query;
import com.hedera.hapi.node.transaction.Response;
import com.hedera.hapi.node.transaction.TransactionResponse;
import com.hedera.pbj.runtime.RpcMethodDefinition;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

class FileServiceDefinitionTest {

@Test
void checkBasePath() {
Assertions.assertThat(FileServiceDefinition.INSTANCE.basePath()).isEqualTo("proto.FileService");
}

@Test
void methodsDefined() {
final var methods = FileServiceDefinition.INSTANCE.methods();
Assertions.assertThat(methods)
.containsExactlyInAnyOrder(
new RpcMethodDefinition<>("createFile", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("updateFile", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("deleteFile", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("appendContent", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("getFileContent", Query.class, Response.class),
new RpcMethodDefinition<>("getFileInfo", Query.class, Response.class),
new RpcMethodDefinition<>("systemDelete", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("systemUndelete", Transaction.class, TransactionResponse.class));
}
}
5 changes: 5 additions & 0 deletions hedera-node/hedera-network-admin-service/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ description = "Hedera NetworkAdmin Service API"
// Remove the following line to enable all 'javac' lint checks that we have turned on by default
// and then fix the reported issues.
tasks.withType<JavaCompile>().configureEach { options.compilerArgs.add("-Xlint:-exports") }

testModuleInfo {
requires("org.assertj.core")
requires("org.junit.jupiter.api")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.hedera.node.app.service.networkadmin;

import com.hedera.hapi.node.base.Transaction;
import com.hedera.hapi.node.transaction.TransactionResponse;
import com.hedera.pbj.runtime.RpcMethodDefinition;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

class FreezeServiceDefinitionTest {

@Test
void checkBasePath() {
Assertions.assertThat(FreezeServiceDefinition.INSTANCE.basePath()).isEqualTo("proto.FreezeService");
}

@Test
void methodsDefined() {
final var methods = FreezeServiceDefinition.INSTANCE.methods();
Assertions.assertThat(methods)
.containsExactlyInAnyOrder(
new RpcMethodDefinition<>("freeze", Transaction.class, TransactionResponse.class));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.hedera.node.app.service.networkadmin;

import com.hedera.hapi.node.base.Transaction;
import com.hedera.hapi.node.transaction.Query;
import com.hedera.hapi.node.transaction.Response;
import com.hedera.hapi.node.transaction.TransactionResponse;
import com.hedera.pbj.runtime.RpcMethodDefinition;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

class NetworkServiceDefinitionTest {

@Test
void checkBasePath() {
Assertions.assertThat(NetworkServiceDefinition.INSTANCE.basePath()).isEqualTo("proto.NetworkService");
}

@Test
void methodsDefined() {
final var methods = NetworkServiceDefinition.INSTANCE.methods();
Assertions.assertThat(methods)
.containsExactlyInAnyOrder(
new RpcMethodDefinition<>("getVersionInfo", Query.class, Response.class),
new RpcMethodDefinition<>("getExecutionTime", Query.class, Response.class),
new RpcMethodDefinition<>("uncheckedSubmit", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("getAccountDetails", Query.class, Response.class));
}
}
2 changes: 1 addition & 1 deletion hedera-node/hedera-schedule-service/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plugins {
id("com.hedera.gradle.services-publish")
}

description = "Hedera Scheduled Service API"
description = "Hedera Schedule Service API"

// Remove the following line to enable all 'javac' lint checks that we have turned on by default
// and then fix the reported issues.
Expand Down
5 changes: 5 additions & 0 deletions hedera-node/hedera-token-service/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ description = "Hedera Token Service API"
// Remove the following line to enable all 'javac' lint checks that we have turned on by default
// and then fix the reported issues.
tasks.withType<JavaCompile>().configureEach { options.compilerArgs.add("-Xlint:-exports") }

testModuleInfo {
requires("org.assertj.core")
requires("org.junit.jupiter.api")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.hedera.node.app.service.token;

import com.hedera.hapi.node.base.Transaction;
import com.hedera.hapi.node.transaction.Query;
import com.hedera.hapi.node.transaction.Response;
import com.hedera.hapi.node.transaction.TransactionResponse;
import com.hedera.pbj.runtime.RpcMethodDefinition;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

class CryptoServiceDefinitionTest {

@Test
void checkBasePath() {
Assertions.assertThat(CryptoServiceDefinition.INSTANCE.basePath()).isEqualTo("proto.CryptoService");
}

@Test
void methodsDefined() {
final var methods = CryptoServiceDefinition.INSTANCE.methods();
Assertions.assertThat(methods)
.containsExactlyInAnyOrder(
new RpcMethodDefinition<>("createAccount", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("updateAccount", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("cryptoTransfer", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("cryptoDelete", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("approveAllowances", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("deleteAllowances", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("addLiveHash", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("deleteLiveHash", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("getLiveHash", Query.class, Response.class),
new RpcMethodDefinition<>("getAccountRecords", Query.class, Response.class),
new RpcMethodDefinition<>("cryptoGetBalance", Query.class, Response.class),
new RpcMethodDefinition<>("getAccountInfo", Query.class, Response.class),
new RpcMethodDefinition<>("getTransactionReceipts", Query.class, Response.class),
new RpcMethodDefinition<>("getFastTransactionRecord", Query.class, Response.class),
new RpcMethodDefinition<>("getTxRecordByTxID", Query.class, Response.class),
new RpcMethodDefinition<>("getStakersByAccountID", Query.class, Response.class));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.hedera.node.app.service.token;

import com.hedera.hapi.node.base.Transaction;
import com.hedera.hapi.node.transaction.Query;
import com.hedera.hapi.node.transaction.Response;
import com.hedera.hapi.node.transaction.TransactionResponse;
import com.hedera.pbj.runtime.RpcMethodDefinition;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

class TokenServiceDefinitionTest {

@Test
void checkBasePath() {
Assertions.assertThat(TokenServiceDefinition.INSTANCE.basePath()).isEqualTo("proto.TokenService");
}

@Test
void methodsDefined() {
final var methods = TokenServiceDefinition.INSTANCE.methods();
Assertions.assertThat(methods)
.containsExactlyInAnyOrder(
new RpcMethodDefinition<>("createToken", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("updateToken", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("mintToken", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("burnToken", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("deleteToken", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("wipeTokenAccount", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("freezeTokenAccount", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("unfreezeTokenAccount", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>(
"grantKycToTokenAccount", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>(
"revokeKycFromTokenAccount", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("associateTokens", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("dissociateTokens", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>(
"updateTokenFeeSchedule", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("getTokenInfo", Query.class, Response.class),
new RpcMethodDefinition<>("getAccountNftInfos", Query.class, Response.class),
new RpcMethodDefinition<>("getTokenNftInfo", Query.class, Response.class),
new RpcMethodDefinition<>("getTokenNftInfos", Query.class, Response.class),
new RpcMethodDefinition<>("pauseToken", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("updateNfts", Transaction.class, TransactionResponse.class),
new RpcMethodDefinition<>("unpauseToken", Transaction.class, TransactionResponse.class));
}
}
5 changes: 5 additions & 0 deletions hedera-node/hedera-util-service/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ description = "Hedera Util Service API"
// Remove the following line to enable all 'javac' lint checks that we have turned on by default
// and then fix the reported issues.
tasks.withType<JavaCompile>().configureEach { options.compilerArgs.add("-Xlint:-exports") }

testModuleInfo {
requires("org.assertj.core")
requires("org.junit.jupiter.api")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.hedera.node.app.service.util;

import com.hedera.hapi.node.base.Transaction;
import com.hedera.hapi.node.transaction.TransactionResponse;
import com.hedera.pbj.runtime.RpcMethodDefinition;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

class UtilServiceDefinitionTest {

@Test
void checkBasePath() {
Assertions.assertThat(UtilServiceDefinition.INSTANCE.basePath()).isEqualTo("proto.UtilService");
}

@Test
void methodsDefined() {
final var methods = UtilServiceDefinition.INSTANCE.methods();
Assertions.assertThat(methods)
.containsExactlyInAnyOrder(
new RpcMethodDefinition<>("prng", Transaction.class, TransactionResponse.class));
}
}
Loading