#  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.

Namespaces:
  =: io.murano.test
  std: io.murano
  sys: io.murano.system
  res: io.murano.resources
--- # ------------------------------------------------------------------ # ---

Name: TestFixture

Methods:
  setUp:
    Body:

  tearDown:
    Body:

--- # ------------------------------------------------------------------ # ---
Name: DummyNetwork
Extends: res:Network

Methods:
  joinInstance:
    Arguments:
      - instance:
          Contract: $.class(res:Instance).notNull()
      - securityGroupName:
          Contract: $.string()
      - assignFloatingIp:
          Contract: $.bool().notNull()
      - sharedIps:
          Contract:
            - $.class(std:SharedIp)
    Body:
      - Return:
          template: {}
          portRef:
          instanceFipOutput:

  generateSecurityGroupManager:
    Body:
      - Return: new(sys:DummySecurityGroupManager, $this)

  describe:
    Body:
      - Return: {}

--- # ------------------------------------------------------------------ # ---

Name: TestFixtureWithEnvironment
Extends: TestFixture

Properties:
  environment:
    Usage: Runtime
    Contract: $.class(std:Environment)

Methods:
  setUp:
    Body:
      - $testClassName: typeinfo($).name
      - $envName: format('environment-of-testclass-{0}', $testClassName)
      - $netName: format('default-network-of-testclass-{0}', $testClassName)
      - $envSnippet:
          Objects:
            std:Environment:
              name: $envName
              defaultNetworks:
                environment:
                  :DummyNetwork:

      - $this.environment: $this.load($envSnippet)
