github.com/tenywen/fabric@v1.0.0-beta.0.20170620030522-a5b1ed380643/common/mocks/config/orderer.go (about)

     1  /*
     2  Copyright IBM Corp. 2016 All Rights Reserved.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8                   http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package config
    18  
    19  import (
    20  	"time"
    21  
    22  	"github.com/hyperledger/fabric/common/config"
    23  	ab "github.com/hyperledger/fabric/protos/orderer"
    24  )
    25  
    26  // Orderer is a mock implementation of config.Orderer
    27  type Orderer struct {
    28  	// ConsensusTypeVal is returned as the result of ConsensusType()
    29  	ConsensusTypeVal string
    30  	// BatchSizeVal is returned as the result of BatchSize()
    31  	BatchSizeVal *ab.BatchSize
    32  	// BatchTimeoutVal is returned as the result of BatchTimeout()
    33  	BatchTimeoutVal time.Duration
    34  	// KafkaBrokersVal is returned as the result of KafkaBrokers()
    35  	KafkaBrokersVal []string
    36  	// MaxChannelsCountVal is returns as the result of MaxChannelsCount()
    37  	MaxChannelsCountVal uint64
    38  	// OrganizationsVal is returned as the result of Organizations()
    39  	OrganizationsVal map[string]config.Org
    40  }
    41  
    42  // ConsensusType returns the ConsensusTypeVal
    43  func (scm *Orderer) ConsensusType() string {
    44  	return scm.ConsensusTypeVal
    45  }
    46  
    47  // BatchSize returns the BatchSizeVal
    48  func (scm *Orderer) BatchSize() *ab.BatchSize {
    49  	return scm.BatchSizeVal
    50  }
    51  
    52  // BatchTimeout returns the BatchTimeoutVal
    53  func (scm *Orderer) BatchTimeout() time.Duration {
    54  	return scm.BatchTimeoutVal
    55  }
    56  
    57  // KafkaBrokers returns the KafkaBrokersVal
    58  func (scm *Orderer) KafkaBrokers() []string {
    59  	return scm.KafkaBrokersVal
    60  }
    61  
    62  // MaxChannelsCount returns the MaxChannelsCountVal
    63  func (scm *Orderer) MaxChannelsCount() uint64 {
    64  	return scm.MaxChannelsCountVal
    65  }
    66  
    67  // Organizations returns OrganizationsVal
    68  func (scm *Orderer) Organizations() map[string]config.Org {
    69  	return scm.OrganizationsVal
    70  }