dubbo.apache.org/dubbo-go/v3@v3.1.1/config/instance/metadata_report_test.go (about)

     1  /*
     2   * Licensed to the Apache Software Foundation (ASF) under one or more
     3   * contributor license agreements.  See the NOTICE file distributed with
     4   * this work for additional information regarding copyright ownership.
     5   * The ASF licenses this file to You under the Apache License, Version 2.0
     6   * (the "License"); you may not use this file except in compliance with
     7   * the License.  You may obtain a copy of the License at
     8   *
     9   *     http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   */
    17  
    18  package instance
    19  
    20  import (
    21  	"testing"
    22  )
    23  
    24  import (
    25  	gxset "github.com/dubbogo/gost/container/set"
    26  
    27  	"github.com/stretchr/testify/assert"
    28  )
    29  
    30  import (
    31  	"dubbo.apache.org/dubbo-go/v3/common"
    32  	"dubbo.apache.org/dubbo-go/v3/common/extension"
    33  	"dubbo.apache.org/dubbo-go/v3/metadata/identifier"
    34  	"dubbo.apache.org/dubbo-go/v3/metadata/report"
    35  	"dubbo.apache.org/dubbo-go/v3/metadata/report/factory"
    36  	"dubbo.apache.org/dubbo-go/v3/registry"
    37  )
    38  
    39  func TestGetMetadataReportInstance(t *testing.T) {
    40  	extension.SetMetadataReportFactory("mock", func() factory.MetadataReportFactory {
    41  		return &mockMetadataReportFactory{}
    42  	})
    43  	u, _ := common.NewURL("mock://127.0.0.1")
    44  	SetMetadataReportInstance(u)
    45  	rpt := GetMetadataReportInstance()
    46  	assert.NotNil(t, rpt)
    47  }
    48  
    49  type mockMetadataReportFactory struct{}
    50  
    51  func (m *mockMetadataReportFactory) CreateMetadataReport(*common.URL) report.MetadataReport {
    52  	return &mockMetadataReport{}
    53  }
    54  
    55  type mockMetadataReport struct{}
    56  
    57  func (m mockMetadataReport) GetConfigKeysByGroup(group string) (*gxset.HashSet, error) {
    58  	//TODO implement me
    59  	panic("implement me")
    60  }
    61  
    62  func (m mockMetadataReport) RegisterServiceAppMapping(string, string, string) error {
    63  	panic("implement me")
    64  }
    65  
    66  func (m mockMetadataReport) GetServiceAppMapping(string, string, registry.MappingListener) (*gxset.HashSet, error) {
    67  	panic("implement me")
    68  }
    69  
    70  func (m mockMetadataReport) RemoveServiceAppMappingListener(string, string) error {
    71  	panic("implement me")
    72  }
    73  
    74  func (m mockMetadataReport) GetAppMetadata(*identifier.SubscriberMetadataIdentifier) (*common.MetadataInfo, error) {
    75  	panic("implement me")
    76  }
    77  
    78  func (m mockMetadataReport) PublishAppMetadata(*identifier.SubscriberMetadataIdentifier, *common.MetadataInfo) error {
    79  	panic("implement me")
    80  }
    81  
    82  func (m mockMetadataReport) StoreProviderMetadata(*identifier.MetadataIdentifier, string) error {
    83  	panic("implement me")
    84  }
    85  
    86  func (m mockMetadataReport) StoreConsumerMetadata(*identifier.MetadataIdentifier, string) error {
    87  	panic("implement me")
    88  }
    89  
    90  func (m mockMetadataReport) SaveServiceMetadata(*identifier.ServiceMetadataIdentifier, *common.URL) error {
    91  	panic("implement me")
    92  }
    93  
    94  func (m mockMetadataReport) RemoveServiceMetadata(*identifier.ServiceMetadataIdentifier) error {
    95  	panic("implement me")
    96  }
    97  
    98  func (m mockMetadataReport) GetExportedURLs(*identifier.ServiceMetadataIdentifier) ([]string, error) {
    99  	panic("implement me")
   100  }
   101  
   102  func (m mockMetadataReport) SaveSubscribedData(*identifier.SubscriberMetadataIdentifier, string) error {
   103  	panic("implement me")
   104  }
   105  
   106  func (m mockMetadataReport) GetSubscribedURLs(*identifier.SubscriberMetadataIdentifier) ([]string, error) {
   107  	panic("implement me")
   108  }
   109  
   110  func (m mockMetadataReport) GetServiceDefinition(*identifier.MetadataIdentifier) (string, error) {
   111  	panic("implement me")
   112  }