MockServices.Companion
Keywords: net.corda.testing.node.MockServices.Companion class
Date: 2023-09-18

net.corda.testing.node

## Class MockServices.Companion

- net.corda.testing.node.MockServices.Companion

- Enclosing class:
    MockServices

      public static class MockServices.Companion

- - ### Method Detail

    - #### makeTestDataSourceProperties

          @JvmStatic
           @NotNull
          public java.util.Properties makeTestDataSourceProperties(@NotNull
                                                                                        java.lang.String nodeName)

      Make properties appropriate for creating a DataSource for unit tests.

      Parameters:
        `nodeName` - Reflects the "instance" of the in-memory database. Defaults to a random string.

    - #### makeTestDatabaseAndMockServices

          @JvmStatic
           @JvmOverloads
           @NotNull
          public kotlin.Pair<net.corda.nodeapi.internal.persistence.CordaPersistence,net.corda.testing.node.MockServices> makeTestDatabaseAndMockServices(@NotNull
                                                                                                                                                                                              java.util.List<java.lang.String> cordappPackages,
                                                                                                                                                                                              @NotNull
                                                                                                                                                                                              IdentityService identityService,
                                                                                                                                                                                              @NotNull
                                                                                                                                                                                              NonExistentClass initialIdentity,
                                                                                                                                                                                              @NotNull
                                                                                                                                                                                              NetworkParameters networkParameters,
                                                                                                                                                                                              @NotNull
                                                                                                                                                                                              java.security.KeyPair... moreKeys)

      Makes database and mock services appropriate for unit tests.

      Parameters:
        `cordappPackages` - A List of cordapp packages to scan for any cordapp code, e.g. contract verification code, flows and services.
        `identityService` - An instance of `interface IdentityService`, see `makeTestIdentityService`.
        `initialIdentity` - The first (typically sole) identity the services will represent.
        `moreKeys` - A list of additional KeyPair instances to be used by `class MockServices`.
      Returns:
        A pair where the first element is the instance of CordaPersistence and the second is `class MockServices`.

    - #### makeTestDatabaseAndMockServices

          @JvmStatic
           @JvmOverloads
           @NotNull
          public kotlin.Pair<net.corda.nodeapi.internal.persistence.CordaPersistence,net.corda.testing.node.MockServices> makeTestDatabaseAndMockServices(@NotNull
                                                                                                                                                                                              java.util.List<java.lang.String> cordappPackages,
                                                                                                                                                                                              @NotNull
                                                                                                                                                                                              IdentityService identityService,
                                                                                                                                                                                              @NotNull
                                                                                                                                                                                              NonExistentClass initialIdentity,
                                                                                                                                                                                              @NotNull
                                                                                                                                                                                              java.security.KeyPair... moreKeys)

      Makes database and mock services appropriate for unit tests.

      Parameters:
        `cordappPackages` - A List of cordapp packages to scan for any cordapp code, e.g. contract verification code, flows and services.
        `identityService` - An instance of `interface IdentityService`, see `makeTestIdentityService`.
        `initialIdentity` - The first (typically sole) identity the services will represent.
        `moreKeys` - A list of additional KeyPair instances to be used by `class MockServices`.
      Returns:
        A pair where the first element is the instance of CordaPersistence and the second is `class MockServices`.

    - #### makeTestDatabaseAndPersistentServices

          @JvmStatic
           @JvmOverloads
           @NotNull
          public kotlin.Pair<net.corda.nodeapi.internal.persistence.CordaPersistence,net.corda.testing.node.MockServices> makeTestDatabaseAndPersistentServices(@NotNull
                                                                                                                                                                                                    java.util.List<java.lang.String> cordappPackages,
                                                                                                                                                                                                    @NotNull
                                                                                                                                                                                                    NonExistentClass initialIdentity,
                                                                                                                                                                                                    @NotNull
                                                                                                                                                                                                    NetworkParameters networkParameters,
                                                                                                                                                                                                    @NotNull
                                                                                                                                                                                                    java.util.Set<java.security.KeyPair> moreKeys,
                                                                                                                                                                                                    @NotNull
                                                                                                                                                                                                    java.util.Set<net.corda.core.identity.PartyAndCertificate> moreIdentities,
                                                                                                                                                                                                    @NotNull
                                                                                                                                                                                                    net.corda.testing.internal.TestingNamedCacheFactory cacheFactory)

      Makes database and persistent services appropriate for unit tests which require persistence across the vault, identity service and key managment service.

      Parameters:
        `cordappPackages` - A List of cordapp packages to scan for any cordapp code, e.g. contract verification code, flows and services.
        `initialIdentity` - The first (typically sole) identity the services will represent.
        `moreKeys` - A list of additional KeyPair instances to be used by `class MockServices`.
        `moreIdentities` - A list of additional KeyPair instances to be used by `class MockServices`.
        `cacheFactory` - A custom cache factory to be used by the created `interface IdentityService`
      Returns:
        A pair where the first element is the instance of CordaPersistence and the second is `class MockServices`.

    - #### makeTestDatabaseAndPersistentServices

          @JvmStatic
           @JvmOverloads
           @NotNull
          public kotlin.Pair<net.corda.nodeapi.internal.persistence.CordaPersistence,net.corda.testing.node.MockServices> makeTestDatabaseAndPersistentServices(@NotNull
                                                                                                                                                                                                    java.util.List<java.lang.String> cordappPackages,
                                                                                                                                                                                                    @NotNull
                                                                                                                                                                                                    NonExistentClass initialIdentity,
                                                                                                                                                                                                    @NotNull
                                                                                                                                                                                                    NetworkParameters networkParameters,
                                                                                                                                                                                                    @NotNull
                                                                                                                                                                                                    java.util.Set<java.security.KeyPair> moreKeys,
                                                                                                                                                                                                    @NotNull
                                                                                                                                                                                                    java.util.Set<net.corda.core.identity.PartyAndCertificate> moreIdentities)

      Makes database and persistent services appropriate for unit tests which require persistence across the vault, identity service and key managment service.

      Parameters:
        `cordappPackages` - A List of cordapp packages to scan for any cordapp code, e.g. contract verification code, flows and services.
        `initialIdentity` - The first (typically sole) identity the services will represent.
        `moreKeys` - A list of additional KeyPair instances to be used by `class MockServices`.
        `moreIdentities` - A list of additional KeyPair instances to be used by `class MockServices`.
      Returns:
        A pair where the first element is the instance of CordaPersistence and the second is `class MockServices`.

    - #### makeTestDatabaseAndPersistentServices

          @JvmStatic
           @JvmOverloads
           @NotNull
          public kotlin.Pair<net.corda.nodeapi.internal.persistence.CordaPersistence,net.corda.testing.node.MockServices> makeTestDatabaseAndPersistentServices(@NotNull
                                                                                                                                                                                                    java.util.List<java.lang.String> cordappPackages,
                                                                                                                                                                                                    @NotNull
                                                                                                                                                                                                    NonExistentClass initialIdentity,
                                                                                                                                                                                                    @NotNull
                                                                                                                                                                                                    java.util.Set<java.security.KeyPair> moreKeys,
                                                                                                                                                                                                    @NotNull
                                                                                                                                                                                                    java.util.Set<net.corda.core.identity.PartyAndCertificate> moreIdentities)

      Makes database and persistent services appropriate for unit tests which require persistence across the vault, identity service and key managment service.

      Parameters:
        `cordappPackages` - A List of cordapp packages to scan for any cordapp code, e.g. contract verification code, flows and services.
        `initialIdentity` - The first (typically sole) identity the services will represent.
        `moreKeys` - A list of additional KeyPair instances to be used by `class MockServices`.
        `moreIdentities` - A list of additional KeyPair instances to be used by `class MockServices`.
      Returns:
        A pair where the first element is the instance of CordaPersistence and the second is `class MockServices`.