text:
package loadbalancer

import (
	"reflect"
	"testing"

	cluster "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
	core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
	endpoint "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
	. "github.com/onsi/gomega"
	"google.golang.org/protobuf/types/known/durationpb"
	wrappers "google.golang.org/protobuf/types/known/wrapperspb"

	meshconfig "istio.io/api/mesh/v1alpha1"
	networking "istio.io/api/networking/v1alpha3"
	"istio.io/istio/pilot/pkg/config/memory"
	"istio.io/istio/pilot/pkg/model"
	memregistry "istio.io/istio/pilot/pkg/serviceregistry/memory"
	"istio.io/istio/pkg/config"
	"istio.io/istio/pkg/config/mesh"
	"istio.io/istio/pkg/config/protocol"
	"istio.io/istio/pkg/config/schema/collections"
)

func TestApplyLocalitySetting(t *testing.T) {
	locality := &core.Locality{
		Region:  "region1",
		Zone:    "zone1",
		SubZone: "subzone1",
	}

	t.Run("Distribute", func(t *testing.T) {
		tests := []struct {
			name       string
			distribute []*networking.LocalityLoadBalancerSetting_Distribute
			expected   []int
		}{
			{
				name: "distribution between subzones",
				distribute: []*networking.LocalityLoadBalancerSetting_Distribute{
					{
						From: "region1/zone1/subzone1",
						To: map[string]uint32{
							"region1/zone1/subzone1": 80,
							"region1/zone1/subzone2": 15,
							"region1/zone1/subzone3": 5,
						},
					},
				},
				expected: []int{40, 40, 15, 5, 0, 0, 0},
			},
		}
		for _, tt := range tests {
			t.Run(tt.name, func(t *testing.T) {
				env := buildEnvForClustersWithDistribute(tt.distribute)
				cluster := buildFakeCluster()
				ApplyLocalityLBSetting(cluster.LoadAssignment, nil, locality, nil, env.Mesh().LocalityLbSetting, true)
				weights := make([]int, 0)
				for _, localityEndpoint := range cluster.LoadAssignment.Endpoints {
					weights = append(weights, int(localityEndpoint.LoadBalancingWeight.GetValue()))
				}
				if !reflect.DeepEqual(weights, tt.expected) {
					t.Errorf("Got weights %v expected %v", weights, tt.expected)
				}
			})
		}
	})

	t.Run("Failover: all priorities", func(t *testing.T) {
		g := NewWithT(t)
		env := buildEnvForClustersWithFailover()
		cluster := buildFakeCluster()
		ApplyLocalityLBSetting(cluster.LoadAssignment, nil, locality, nil, env.Mesh().LocalityLbSetting, true)
		for _, localityEndpoint := range cluster.LoadAssignment.Endpoints {
			if localityEndpoint.Locality.Region == locality.Region {
				if localityEndpoint.Locality.Zone == locality.Zone {
					if localityEndpoint.Locality.SubZone == locality.SubZone {
						g.Expect(localityEndpoint.Priority).To(Equal(uint32(0)))
						continue
					}
					g.Expect(localityEndpoint.Priority).To(Equal(uint32(1)))
					continue
				}
				g.Expect(localityEndpoint.Priority).To(Equal(uint32(2)))
				continue
			}
			if localityEndpoint.Locality.Region == "region2" {
				g.Expect(localityEndpoint.Priority).To(Equal(uint32(3)))
			} else {
				g.Expect(localityEndpoint.Priority).To(Equal(uint32(4)))
			}
		}
	})

	t.Run("Failover: priorities with gaps", func(t *testing.T) {
		g := NewWithT(t)
		env := buildEnvForClustersWithFailover()
		cluster := buildSmallCluster()
		ApplyLocalityLBSetting(cluster.LoadAssignment, nil, locality, nil, env.Mesh().LocalityLbSetting, true)
		for _, localityEndpoint := range cluster.LoadAssignment.Endpoints {
			if localityEndpoint.Locality.Region == locality.Region {
				if localityEndpoint.Locality.Zone == locality.Zone {
					if localityEndpoint.Locality.SubZone == locality.SubZone {
						t.Errorf("Should not exist")
						continue
					}
					g.Expect(localityEndpoint.Priority).To(Equal(uint32(0)))
					continue
				}
				t.Errorf("Should not exist")
				continue
			}
			if localityEndpoint.Locality.Region == "region2" {
				g.Expect(localityEndpoint.Priority).To(Equal(uint32(1)))
			} else {
				t.Errorf("Should not exist")
			}
		}
	})

	t.Run("Failover: priorities with some nil localities", func(t *testing.T) {
		g := NewWithT(t)
		env := buildEnvForClustersWithFailover()
		cluster := buildSmallClusterWithNilLocalities()
		ApplyLocalityLBSetting(cluster.LoadAssignment, nil, locality, nil, env.Mesh().LocalityLbSetting, true)
		for _, localityEndpoint := range cluster.LoadAssignment.Endpoints {
			if localityEndpoint.Locality == nil {
				g.Expect(localityEndpoint.Priority).To(Equal(uint32(2)))
			} else if localityEndpoint.Locality.Region == locality.Region {
				if localityEndpoint.Locality.Zone == locality.Zone {
					if localityEndpoint.Locality.SubZone == locality.SubZone {
						t.Errorf("Should not exist")
						continue
					}
					g.Expect(localityEndpoint.Priority).To(Equal(uint32(0)))
					continue
				}
				t.Errorf("Should not exist")
				continue
			} else if localityEndpoint.Locality.Region == "region2" {
				g.Expect(localityEndpoint.Priority).To(Equal(uint32(1)))
			} else {
				t.Errorf("Should not exist")
			}
		}
	})

	t.Run("Failover: with locality lb disabled", func(t *testing.T) {
		g := NewWithT(t)
		cluster := buildSmallClusterWithNilLocalities()
		lbsetting := &networking.LocalityLoadBalancerSetting{
			Enabled: &wrappers.BoolValue{Value: false},
		}
		ApplyLocalityLBSetting(cluster.LoadAssignment, nil, locality, nil, lbsetting, true)
		for _, localityEndpoint := range cluster.LoadAssignment.Endpoints {
			g.Expect(localityEndpoint.Priority).To(Equal(uint32(0)))
		}
	})

	t.Run("FailoverPriority", func(t *testing.T) {
		tests := []struct {
			name             string
			failoverPriority []string
			proxyLabels      map[string]string
			expected         []*endpoint.LocalityLbEndpoints
		}{
			{
				name:             "match none label",
				failoverPriority: []string{"topology.istio.io/network", "topology.istio.io/cluster"},
				proxyLabels: map[string]string{
					"topology.istio.io/network": "test",
					"topology.istio.io/cluster": "test",
				},
				expected: []*endpoint.LocalityLbEndpoints{
					{
						Locality: &core.Locality{
							Region:  "region1",
							Zone:    "zone1",
							SubZone: "subzone1",
						},
						LbEndpoints: []*endpoint.LbEndpoint{
							{
								HostIdentifier: buildEndpoint("1.1.1.1"),
								LoadBalancingWeight: &wrappers.UInt32Value{
									Value: 1,
								},
							},
							{
								HostIdentifier: buildEndpoint("2.2.2.2"),
								LoadBalancingWeight: &wrappers.UInt32Value{
									Value: 1,
								},
							},
						},
						LoadBalancingWeight: &wrappers.UInt32Value{
							Value: 2,
						},
						Priority: 0,
					},
					{
						Locality: &core.Locality{
							Region:  "region2",
							Zone:    "zone2",
							SubZone: "subzone2",
						},
						LbEndpoints: []*endpoint.LbEndpoint{
							{
								HostIdentifier: buildEndpoint("3.3.3.3"),
								LoadBalancingWeight: &wrappers.UInt32Value{
									Value: 1,
								},
							},
							{
								HostIdentifier: buildEndpoint("4.4.4.4"),
								LoadBalancingWeight: &wrappers.UInt32Value{
									Value: 1,
								},
							},
						},
						LoadBalancingWeight: &wrappers.UInt32Value{
							Value: 2,
						},
						Priority: 0,
					},
				},
			},
			{
				name:             "match network label",
				failoverPriority: []string{"topology.istio.io/network", "topology.istio.io/cluster"},
				proxyLabels: map[string]string{
					"topology.istio.io/network": "n1",
					"topology.istio.io/cluster": "test",
				},
				expected: []*endpoint.LocalityLbEndpoints{
					{
						Locality: &core.Locality{
							Region:  "region1",
							Zone:    "zone1",
							SubZone: "subzone1",
						},
						LbEndpoints: []*endpoint.LbEndpoint{
							{
								HostIdentifier: buildEndpoint("1.1.1.1"),
								LoadBalancingWeight: &wrappers.UInt32Value{
									Value: 1,
								},
							},
						},
						LoadBalancingWeight: &wrappers.UInt32Value{
							Value: 1,
						},
						Priority: 0,
					},
					{
						Locality: &core.Locality{
							Region:  "region1",
							Zone:    "zone1",
							SubZone: "subzone1",
						},
						LbEndpoints: []*endpoint.LbEndpoint{
							{
								HostIdentifier: buildEndpoint("2.2.2.2"),
								LoadBalancingWeight: &wrappers.UInt32Value{
									Value: 1,
								},
							},
						},
						LoadBalancingWeight: &wrappers.UInt32Value{
							Value: 1,
						},
						Priority: 1,
					},
					{
						Locality: &core.Locality{
							Region:  "region2",
							Zone:    "zone2",
							SubZone: "subzone2",
						},
						LbEndpoints: []*endpoint.LbEndpoint{
							{
								HostIdentifier: buildEndpoint("3.3.3.3"),
								LoadBalancingWeight: &wrappers.UInt32Value{
									Value: 1,
								},
							},
						},
						LoadBalancingWeight: &wrappers.UInt32Value{
							Value: 1,
						},
						Priority: 0,
					},
					{
						Locality: &core.Locality{
							Region:  "region2",
							Zone:    "zone2",
							SubZone: "subzone2",
						},
						LbEndpoints: []*endpoint.LbEndpoint{
							{
								HostIdentifier: buildEndpoint("4.4.4.4"),
								LoadBalancingWeight: &wrappers.UInt32Value{
									Value: 1,
								},
							},
						},
						LoadBalancingWeight: &wrappers.UInt32Value{
							Value: 1,
						},
						Priority: 1,
					},
				},
			},
			{
				name:             "not match the first n label",
				failoverPriority: []string{"topology.istio.io/network", "topology.istio.io/cluster"},
				proxyLabels: map[string]string{
					"topology.istio.io/network": "test",
					"topology.istio.io/cluster": "c1",
				},
				expected: []*endpoint.LocalityLbEndpoints{
					{
						Locality: &core.Locality{
							Region:  "region1",
							Zone:    "zone1",
							SubZone: "subzone1",
						},
						LbEndpoints: []*endpoint.LbEndpoint{
							{
								HostIdentifier: buildEndpoint("1.1.1.1"),
								LoadBalancingWeight: &wrappers.UInt32Value{
									Value: 1,
								},
							},
							{
								HostIdentifier: buildEndpoint("2.2.2.2"),
								LoadBalancingWeight: &wrappers.UInt32Value{
									Value: 1,
								},
							},
						},
						LoadBalancingWeight: &wrappers.UInt32Value{
							Value: 2,
						},
						Priority: 0,
					},
					{
						Locality: &core.Locality{
							Region:  "region2",
							Zone:    "zone2",
							SubZone: "subzone2",
						},
						LbEndpoints: []*endpoint.LbEndpoint{
							{
								HostIdentifier: buildEndpoint("3.3.3.3"),
								LoadBalancingWeight: &wrappers.UInt32Value{
									Value: 1,
								},
							},
							{
								HostIdentifier: buildEndpoint("4.4.4.4"),
								LoadBalancingWeight: &wrappers.UInt32Value{
									Value: 1,
								},
							},
						},
						LoadBalancingWeight: &wrappers.UInt32Value{
							Value: 2,
						},
						Priority: 0,
					},
				},
			},
			{
				name:             "match all labels",
				failoverPriority: []string{"key", "topology.istio.io/network", "topology.istio.io/cluster"},
				proxyLabels: map[string]string{
					"key":                       "value",
					"topology.istio.io/network": "n2",
					"topology.istio.io/cluster": "c2",
				},
				expected: []*endpoint.LocalityLbEndpoints{
					{
						Locality: &core.Locality{
							Region:  "region1",
							Zone:    "zone1",
							SubZone: "subzone1",
						},
						LbEndpoints: []*endpoint.LbEndpoint{
							{
								HostIdentifier: buildEndpoint("2.2.2.2"), // match [key, network, cluster]
								LoadBalancingWeight: &wrappers.UInt32Value{
									Value: 1,
								},
							},
						},
						LoadBalancingWeight: &wrappers.UInt32Value{
							Value: 1,
						},
						Priority: 0,
					},
					{
						Locality: &core.Locality{
							Region:  "region1",
							Zone:    "zone1",
							SubZone: "subzone1",
						},
						LbEndpoints: []*endpoint.LbEndpoint{
							{
								HostIdentifier: buildEndpoint("1.1.1.1"), // match no label
								LoadBalancingWeight: &wrappers.UInt32Value{
									Value: 1,
								},
							},
						},
						LoadBalancingWeight: &wrappers.UInt32Value{
							Value: 1,
						},
						Priority: 3,
					},
					{
						Locality: &core.Locality{
							Region:  "region2",
							Zone:    "zone2",
							SubZone: "subzone2",
						},
						LbEndpoints: []*endpoint.LbEndpoint{
							{
								HostIdentifier: buildEndpoint("4.4.4.4"), // match [key, network]
								LoadBalancingWeight: &wrappers.UInt32Value{
									Value: 1,
								},
							},
						},
						LoadBalancingWeight: &wrappers.UInt32Value{
							Value: 1,
						},
						Priority: 1,
					},
					{
						Locality: &core.Locality{
							Region:  "region2",
							Zone:    "zone2",
							SubZone: "subzone2",
						},
						LbEndpoints: []*endpoint.LbEndpoint{
							{
								HostIdentifier: buildEndpoint("3.3.3.3"), // match [key]
								LoadBalancingWeight: &wrappers.UInt32Value{
									Value: 1,
								},
							},
						},
						LoadBalancingWeight: &wrappers.UInt32Value{
							Value: 1,
						},
						Priority: 2,
					},
				},
			},
		}

		wrappedEndpoints := buildWrappedLocalityLbEndpoints()

		for _, tt := range tests {
			t.Run(tt.name, func(t *testing.T) {
				env := buildEnvForClustersWithFailoverPriority(tt.failoverPriority)
				cluster := buildFakeCluster()
				ApplyLocalityLBSetting(cluster.LoadAssignment, wrappedEndpoints, locality, tt.proxyLabels, env.Mesh().LocalityLbSetting, true)

				if len(cluster.LoadAssignment.Endpoints) != len(tt.expected) {
					t.Fatalf("expected endpoints %d but got %d", len(cluster.LoadAssignment.Endpoints), len(tt.expected))
				}
				for i := range cluster.LoadAssignment.Endpoints {
					if cluster.LoadAssignment.Endpoints[i].LoadBalancingWeight.GetValue() != tt.expected[i].LoadBalancingWeight.GetValue() {
						t.Errorf("Got unexpected lb weight %v expected %v", cluster.LoadAssignment.Endpoints[i].LoadBalancingWeight, tt.expected[i].LoadBalancingWeight)
					}
					if cluster.LoadAssignment.Endpoints[i].Priority != tt.expected[i].Priority {
						t.Errorf("Got unexpected priority %v expected %v", cluster.LoadAssignment.Endpoints[i].Priority, tt.expected[i].Priority)
					}
				}
			})
		}
	})
}

func TestGetLocalityLbSetting(t *testing.T) {
	// dummy config for test
	failover := []*networking.LocalityLoadBalancerSetting_Failover{nil}
	cases := []struct {
		name     string
		mesh     *networking.LocalityLoadBalancerSetting
		dr       *networking.LocalityLoadBalancerSetting
		expected *networking.LocalityLoadBalancerSetting
	}{
		{
			"all disabled",
			nil,
			nil,
			nil,
		},
		{
			"mesh only",
			&networking.LocalityLoadBalancerSetting{},
			nil,
			&networking.LocalityLoadBalancerSetting{},
		},
		{
			"dr only",
			nil,
			&networking.LocalityLoadBalancerSetting{},
			&networking.LocalityLoadBalancerSetting{},
		},
		{
			"dr only override",
			nil,
			&networking.LocalityLoadBalancerSetting{Enabled: &wrappers.BoolValue{Value: true}},
			&networking.LocalityLoadBalancerSetting{Enabled: &wrappers.BoolValue{Value: true}},
		},
		{
			"both",
			&networking.LocalityLoadBalancerSetting{},
			&networking.LocalityLoadBalancerSetting{Failover: failover},
			&networking.LocalityLoadBalancerSetting{Failover: failover},
		},
		{
			"mesh disabled",
			&networking.LocalityLoadBalancerSetting{Enabled: &wrappers.BoolValue{Value: false}},
			nil,
			nil,
		},
		{
			"dr disabled",
			&networking.LocalityLoadBalancerSetting{Enabled: &wrappers.BoolValue{Value: true}},
			&networking.LocalityLoadBalancerSetting{Enabled: &wrappers.BoolValue{Value: false}},
			nil,
		},
		{
			"dr enabled override mesh disabled",
			&networking.LocalityLoadBalancerSetting{Enabled: &wrappers.BoolValue{Value: false}},
			&networking.LocalityLoadBalancerSetting{Enabled: &wrappers.BoolValue{Value: true}},
			&networking.LocalityLoadBalancerSetting{Enabled: &wrappers.BoolValue{Value: true}},
		},
	}
	for _, tt := range cases {
		t.Run(tt.name, func(t *testing.T) {
			got := GetLocalityLbSetting(tt.mesh, tt.dr)
			if !reflect.DeepEqual(tt.expected, got) {
				t.Fatalf("Expected: %v, got: %v", tt.expected, got)
			}
		})
	}
}

func buildEnvForClustersWithDistribute(distribute []*networking.LocalityLoadBalancerSetting_Distribute) *model.Environment {
	serviceDiscovery := memregistry.NewServiceDiscovery(&model.Service{
		Hostname:       "test.example.org",
		DefaultAddress: "1.1.1.1",
		Ports: model.PortList{
			&model.Port{
				Name:     "default",
				Port:     8080,
				Protocol: protocol.HTTP,
			},
		},
	})

	meshConfig := &meshconfig.MeshConfig{
		ConnectTimeout: &durationpb.Duration{
			Seconds: 10,
			Nanos:   1,
		},
		LocalityLbSetting: &networking.LocalityLoadBalancerSetting{
			Distribute: distribute,
		},
	}

	configStore := memory.Make(collections.Pilot)

	env := model.NewEnvironment()
	env.ServiceDiscovery = serviceDiscovery
	env.ConfigStore = configStore
	env.Watcher = mesh.NewFixedWatcher(meshConfig)

	env.PushContext = model.NewPushContext()
	env.Init()
	_ = env.PushContext.InitContext(env, nil, nil)
	env.PushContext.SetDestinationRulesForTesting([]config.Config{
		{
			Meta: config.Meta{
				GroupVersionKind: collections.IstioNetworkingV1Alpha3Destinationrules.Resource().GroupVersionKind(),
				Name:             "acme",
			},
			Spec: &networking.DestinationRule{
				Host: "test.example.org",
				TrafficPolicy: &networking.TrafficPolicy{
					OutlierDetection: &networking.OutlierDetection{},
				},
			},
		},
	})

	return env
}

func buildEnvForClustersWithFailover() *model.Environment {
	serviceDiscovery := memregistry.NewServiceDiscovery(&model.Service{
		Hostname:       "test.example.org",
		DefaultAddress: "1.1.1.1",
		Ports: model.PortList{
			&model.Port{
				Name:     "default",
				Port:     8080,
				Protocol: protocol.HTTP,
			},
		},
	})

	meshConfig := &meshconfig.MeshConfig{
		ConnectTimeout: &durationpb.Duration{
			Seconds: 10,
			Nanos:   1,
		},
		LocalityLbSetting: &networking.LocalityLoadBalancerSetting{
			Failover: []*networking.LocalityLoadBalancerSetting_Failover{
				{
					From: "region1",
					To:   "region2",
				},
			},
		},
	}

	configStore := memory.Make(collections.Pilot)

	env := model.NewEnvironment()
	env.ServiceDiscovery = serviceDiscovery
	env.ConfigStore = configStore
	env.Watcher = mesh.NewFixedWatcher(meshConfig)

	env.PushContext = model.NewPushContext()
	env.Init()
	_ = env.PushContext.InitContext(env, nil, nil)
	env.PushContext.SetDestinationRulesForTesting([]config.Config{
		{
			Meta: config.Meta{
				GroupVersionKind: collections.IstioNetworkingV1Alpha3Destinationrules.Resource().GroupVersionKind(),
				Name:             "acme",
			},
			Spec: &networking.DestinationRule{
				Host: "test.example.org",
				TrafficPolicy: &networking.TrafficPolicy{
					OutlierDetection: &networking.OutlierDetection{},
				},
			},
		},
	})

	return env
}

func buildEnvForClustersWithFailoverPriority(failoverPriority []string) *model.Environment {
	serviceDiscovery := memregistry.NewServiceDiscovery(&model.Service{
		Hostname:       "test.example.org",
		DefaultAddress: "1.1.1.1",
		Ports: model.PortList{
			&model.Port{
				Name:     "default",
				Port:     8080,
				Protocol: protocol.HTTP,
			},
		},
	})

	meshConfig := &meshconfig.MeshConfig{
		ConnectTimeout: &durationpb.Duration{
			Seconds: 10,
			Nanos:   1,
		},
		LocalityLbSetting: &networking.LocalityLoadBalancerSetting{
			FailoverPriority: failoverPriority,
		},
	}

	configStore := memory.Make(collections.Pilot)

	env := model.NewEnvironment()
	env.ServiceDiscovery = serviceDiscovery
	env.ConfigStore = configStore
	env.Watcher = mesh.NewFixedWatcher(meshConfig)

	env.PushContext = model.NewPushContext()
	env.Init()
	_ = env.PushContext.InitContext(env, nil, nil)
	env.PushContext.SetDestinationRulesForTesting([]config.Config{
		{
			Meta: config.Meta{
				GroupVersionKind: collections.IstioNetworkingV1Alpha3Destinationrules.Resource().GroupVersionKind(),
				Name:             "acme",
			},
			Spec: &networking.DestinationRule{
				Host: "test.example.org",
				TrafficPolicy: &networking.TrafficPolicy{
					OutlierDetection: &networking.OutlierDetection{},
				},
			},
		},
	})

	return env
}

func buildFakeCluster() *cluster.Cluster {
	return &cluster.Cluster{
		Name: "outbound|8080||test.example.org",
		LoadAssignment: &endpoint.ClusterLoadAssignment{
			ClusterName: "outbound|8080||test.example.org",
			Endpoints: []*endpoint.LocalityLbEndpoints{
				{
					Locality: &core.Locality{
						Region:  "region1",
						Zone:    "zone1",
						SubZone: "subzone1",
					},
				},
				{
					Locality: &core.Locality{
						Region:  "region1",
						Zone:    "zone1",
						SubZone: "subzone1",
					},
				},
				{
					Locality: &core.Locality{
						Region:  "region1",
						Zone:    "zone1",
						SubZone: "subzone2",
					},
				},
				{
					Locality: &core.Locality{
						Region:  "region1",
						Zone:    "zone1",
						SubZone: "subzone3",
					},
				},
				{
					Locality: &core.Locality{
						Region:  "region1",
						Zone:    "zone2",
						SubZone: "",
					},
				},
				{
					Locality: &core.Locality{
						Region:  "region2",
						Zone:    "",
						SubZone: "",
					},
				},
				{
					Locality: &core.Locality{
						Region:  "region3",
						Zone:    "",
						SubZone: "",
					},
				},
			},
		},
	}
}

func buildSmallCluster() *cluster.Cluster {
	return &cluster.Cluster{
		Name: "outbound|8080||test.example.org",
		LoadAssignment: &endpoint.ClusterLoadAssignment{
			ClusterName: "outbound|8080||test.example.org",
			Endpoints: []*endpoint.LocalityLbEndpoints{
				{
					Locality: &core.Locality{
						Region:  "region1",
						Zone:    "zone1",
						SubZone: "subzone2",
					},
				},
				{
					Locality: &core.Locality{
						Region:  "region2",
						Zone:    "zone1",
						SubZone: "subzone2",
					},
				},
				{
					Locality: &core.Locality{
						Region:  "region2",
						Zone:    "zone1",
						SubZone: "subzone2",
					},
				},
			},
		},
	}
}

func buildSmallClusterWithNilLocalities() *cluster.Cluster {
	return &cluster.Cluster{
		Name: "outbound|8080||test.example.org",
		LoadAssignment: &endpoint.ClusterLoadAssignment{
			ClusterName: "outbound|8080||test.example.org",
			Endpoints: []*endpoint.LocalityLbEndpoints{
				{
					Locality: &core.Locality{
						Region:  "region1",
						Zone:    "zone1",
						SubZone: "subzone2",
					},
				},
				{},
				{
					Locality: &core.Locality{
						Region:  "region2",
						Zone:    "zone1",
						SubZone: "subzone2",
					},
				},
			},
		},
	}
}

func buildSmallClusterForFailOverPriority() *cluster.Cluster {
	return &cluster.Cluster{
		Name: "outbound|8080||test.example.org",
		LoadAssignment: &endpoint.ClusterLoadAssignment{
			ClusterName: "outbound|8080||test.example.org",
			Endpoints: []*endpoint.LocalityLbEndpoints{
				{
					Locality: &core.Locality{
						Region:  "region1",
						Zone:    "zone1",
						SubZone: "subzone1",
					},
					LbEndpoints: []*endpoint.LbEndpoint{
						{
							HostIdentifier: buildEndpoint("1.1.1.1"),
							LoadBalancingWeight: &wrappers.UInt32Value{
								Value: 1,
							},
						},
						{
							HostIdentifier: buildEndpoint("2.2.2.2"),
							LoadBalancingWeight: &wrappers.UInt32Value{
								Value: 1,
							},
						},
					},
				},
				{
					Locality: &core.Locality{
						Region:  "region2",
						Zone:    "zone2",
						SubZone: "subzone2",
					},
					LbEndpoints: []*endpoint.LbEndpoint{
						{
							HostIdentifier: buildEndpoint("3.3.3.3"),
							LoadBalancingWeight: &wrappers.UInt32Value{
								Value: 1,
							},
						},
						{
							HostIdentifier: buildEndpoint("4.4.4.4"),
							LoadBalancingWeight: &wrappers.UInt32Value{
								Value: 1,
							},
						},
					},
				},
			},
		},
	}
}

func buildEndpoint(ip string) *endpoint.LbEndpoint_Endpoint {
	return &endpoint.LbEndpoint_Endpoint{
		Endpoint: &endpoint.Endpoint{
			Address: &core.Address{
				Address: &core.Address_SocketAddress{
					SocketAddress: &core.SocketAddress{
						Address: ip,
						PortSpecifier: &core.SocketAddress_PortValue{
							PortValue: 10001,
						},
					},
				},
			},
		},
	}
}

func buildWrappedLocalityLbEndpoints() []*WrappedLocalityLbEndpoints {
	cluster := buildSmallClusterForFailOverPriority()
	return []*WrappedLocalityLbEndpoints{
		{
			IstioEndpoints: []*model.IstioEndpoint{
				{
					Labels: map[string]string{
						"topology.istio.io/network": "n1",
						"topology.istio.io/cluster": "c1",
					},
					Address: "1.1.1.1",
				},
				{
					Labels: map[string]string{
						"key":                       "value",
						"topology.istio.io/network": "n2",
						"topology.istio.io/cluster": "c2",
					},
					Address: "2.2.2.2",
				},
			},
			LocalityLbEndpoints: cluster.LoadAssignment.Endpoints[0],
		},
		{
			IstioEndpoints: []*model.IstioEndpoint{
				{
					Labels: map[string]string{
						"key":                       "value",
						"topology.istio.io/network": "n1",
						"topology.istio.io/cluster": "c3",
					},
					Address: "3.3.3.3",
				},
				{
					Labels: map[string]string{
						"key":                       "value",
						"topology.istio.io/network": "n2",
						"topology.istio.io/cluster": "c4",
					},
					Address: "4.4.4.4",
				},
			},
			LocalityLbEndpoints: cluster.LoadAssignment.Endpoints[1],
		},
	}
}


text:
/**
 * @author Manuel Guenther <manuel.guenther@idiap.ch>
 * @date Mon Jun 23 19:18:25 CEST 2014
 *
 * @brief Header file for bindings to bob::ip
 */

#ifndef BOB_IP_BASE_MAIN_H
#define BOB_IP_BASE_MAIN_H

#include <bob.blitz/cppapi.h>
#include <bob.blitz/cleanup.h>
#include <bob.core/api.h>
#include <bob.core/random_api.h>
#include <bob.sp/api.h>
#include <bob.io.base/api.h>
#include <bob.extension/documentation.h>

#define BOB_IP_BASE_MODULE
#include <bob.ip.base/api.h>

#include <bob.ip.base/LBPTop.h>
#include <bob.ip.base/DCTFeatures.h>
#include <bob.ip.base/TanTriggs.h>
#include <bob.ip.base/Gaussian.h>
#include <bob.ip.base/MultiscaleRetinex.h>
#include <bob.ip.base/WeightedGaussian.h>
#include <bob.ip.base/SelfQuotientImage.h>
#include <bob.ip.base/GaussianScaleSpace.h>
#include <bob.ip.base/SIFT.h>
#include <bob.ip.base/HOG.h>
#include <bob.ip.base/GeomNorm.h>
#include <bob.ip.base/FaceEyesNorm.h>
#include <bob.ip.base/GLCM.h>
#include <bob.ip.base/Wiener.h>

/// inserts the given key, value pair into the given dictionaries
static inline int insert_item_string(PyObject* dict, PyObject* entries, const char* key, Py_ssize_t value){
  auto v = make_safe(Py_BuildValue("n", value));
  if (PyDict_SetItemString(dict, key, v.get()) < 0) return -1;
  return PyDict_SetItemString(entries, key, v.get());
}

// GeomNorm
typedef struct {
  PyObject_HEAD
  boost::shared_ptr<bob::ip::base::GeomNorm> cxx;
} PyBobIpBaseGeomNormObject;

extern PyTypeObject PyBobIpBaseGeomNorm_Type;
bool init_BobIpBaseGeomNorm(PyObject* module);
int PyBobIpBaseGeomNorm_Check(PyObject* o);

// FaceEyesNorm
typedef struct {
  PyObject_HEAD
  boost::shared_ptr<bob::ip::base::FaceEyesNorm> cxx;
} PyBobIpBaseFaceEyesNormObject;

extern PyTypeObject PyBobIpBaseFaceEyesNorm_Type;
bool init_BobIpBaseFaceEyesNorm(PyObject* module);
int PyBobIpBaseFaceEyesNorm_Check(PyObject* o);

// .. scaling
PyObject* PyBobIpBase_scale(PyObject*, PyObject*, PyObject*);
extern bob::extension::FunctionDoc s_scale;
PyObject* PyBobIpBase_scaledOutputShape(PyObject*, PyObject*, PyObject*);
extern bob::extension::FunctionDoc s_scaledOutputShape;
// .. rotating
PyObject* PyBobIpBase_rotate(PyObject*, PyObject*, PyObject*);
extern bob::extension::FunctionDoc s_rotate;
PyObject* PyBobIpBase_rotatedOutputShape(PyObject*, PyObject*, PyObject*);
extern bob::extension::FunctionDoc s_rotatedOutputShape;

// mask functions (in Affine.h)
PyObject* PyBobIpBase_maxRectInMask(PyObject*, PyObject*, PyObject*);
extern bob::extension::FunctionDoc s_maxRectInMask;
PyObject* PyBobIpBase_extrapolateMask(PyObject*, PyObject*, PyObject*);
extern bob::extension::FunctionDoc s_extrapolateMask;

// LBP
bool init_BobIpBaseLBP(PyObject* module);

// LBP-Top
typedef struct {
  PyObject_HEAD
  boost::shared_ptr<bob::ip::base::LBPTop> cxx;
} PyBobIpBaseLBPTopObject;

extern PyTypeObject PyBobIpBaseLBPTop_Type;
bool init_BobIpBaseLBPTop(PyObject* module);
int PyBobIpBaseLBPTop_Check(PyObject* o);

// DCTFeatures
typedef struct {
  PyObject_HEAD
  boost::shared_ptr<bob::ip::base::DCTFeatures> cxx;
} PyBobIpBaseDCTFeaturesObject;

extern PyTypeObject PyBobIpBaseDCTFeatures_Type;
bool init_BobIpBaseDCTFeatures(PyObject* module);
int PyBobIpBaseDCTFeatures_Check(PyObject* o);

// gamma correction
PyObject* PyBobIpBase_gammaCorrection(PyObject*, PyObject*, PyObject*);
extern bob::extension::FunctionDoc s_gammaCorrection;
// Tan-Triggs
typedef struct {
  PyObject_HEAD
  boost::shared_ptr<bob::ip::base::TanTriggs> cxx;
} PyBobIpBaseTanTriggsObject;

extern PyTypeObject PyBobIpBaseTanTriggs_Type;
bool init_BobIpBaseTanTriggs(PyObject* module);
int PyBobIpBaseTanTriggs_Check(PyObject* o);

// Gaussian
typedef struct {
  PyObject_HEAD
  boost::shared_ptr<bob::ip::base::Gaussian> cxx;
} PyBobIpBaseGaussianObject;

extern PyTypeObject PyBobIpBaseGaussian_Type;
bool init_BobIpBaseGaussian(PyObject* module);
int PyBobIpBaseGaussian_Check(PyObject* o);

// MultiscaleRetinex
typedef struct {
  PyObject_HEAD
  boost::shared_ptr<bob::ip::base::MultiscaleRetinex> cxx;
} PyBobIpBaseMultiscaleRetinexObject;

extern PyTypeObject PyBobIpBaseMultiscaleRetinex_Type;
bool init_BobIpBaseMultiscaleRetinex(PyObject* module);
int PyBobIpBaseMultiscaleRetinex_Check(PyObject* o);

// WeightedGaussian
typedef struct {
  PyObject_HEAD
  boost::shared_ptr<bob::ip::base::WeightedGaussian> cxx;
} PyBobIpBaseWeightedGaussianObject;

extern PyTypeObject PyBobIpBaseWeightedGaussian_Type;
bool init_BobIpBaseWeightedGaussian(PyObject* module);
int PyBobIpBaseWeightedGaussian_Check(PyObject* o);

// SelfQuotientImage
typedef struct {
  PyObject_HEAD
  boost::shared_ptr<bob::ip::base::SelfQuotientImage> cxx;
} PyBobIpBaseSelfQuotientImageObject;

extern PyTypeObject PyBobIpBaseSelfQuotientImage_Type;
bool init_BobIpBaseSelfQuotientImage(PyObject* module);
int PyBobIpBaseSelfQuotientImage_Check(PyObject* o);

// SIFT...
// .. Gaussian Scale Space Keypoint
typedef struct {
  PyObject_HEAD
  boost::shared_ptr<bob::ip::base::GSSKeypoint> cxx;
} PyBobIpBaseGSSKeypointObject;

extern PyTypeObject PyBobIpBaseGSSKeypoint_Type;
int PyBobIpBaseGSSKeypoint_Check(PyObject* o);

// .. Gaussian Scale Space KeypointInfo
typedef struct {
  PyObject_HEAD
  boost::shared_ptr<bob::ip::base::GSSKeypointInfo> cxx;
} PyBobIpBaseGSSKeypointInfoObject;

extern PyTypeObject PyBobIpBaseGSSKeypointInfo_Type;
int PyBobIpBaseGSSKeypointInfo_Check(PyObject* o);

// .. Gaussian Scale Space
typedef struct {
  PyObject_HEAD
  boost::shared_ptr<bob::ip::base::GaussianScaleSpace> cxx;
} PyBobIpBaseGaussianScaleSpaceObject;

extern PyTypeObject PyBobIpBaseGaussianScaleSpace_Type;
bool init_BobIpBaseGaussianScaleSpace(PyObject* module);
int PyBobIpBaseGaussianScaleSpace_Check(PyObject* o);

// .. SIFT
typedef struct {
  PyObject_HEAD
  boost::shared_ptr<bob::ip::base::SIFT> cxx;
} PyBobIpBaseSIFTObject;

extern PyTypeObject PyBobIpBaseSIFT_Type;
bool init_BobIpBaseSIFT(PyObject* module);
int PyBobIpBaseSIFT_Check(PyObject* o);

#if HAVE_VLFEAT
// .. VLSIFT
typedef struct {
  PyObject_HEAD
  boost::shared_ptr<bob::ip::base::VLSIFT> cxx;
} PyBobIpBaseVLSIFTObject;

extern PyTypeObject PyBobIpBaseVLSIFT_Type;
int PyBobIpBaseVLSIFT_Check(PyObject* o);

// .. VLDSIFT
typedef struct {
  PyObject_HEAD
  boost::shared_ptr<bob::ip::base::VLDSIFT> cxx;
} PyBobIpBaseVLDSIFTObject;

extern PyTypeObject PyBobIpBaseVLDSIFT_Type;
int PyBobIpBaseVLDSIFT_Check(PyObject* o);

bool init_BobIpBaseVLFEAT(PyObject* module);
#endif // HAVE_VLFEAT

// HOG...
// .. GradientMagnitude
extern PyTypeObject PyBobIpBaseGradientMagnitude_Type;
int PyBobIpBaseGradientMagnitude_Check(PyObject* o);
int PyBobIpBaseGradientMagnitude_Converter(PyObject* o, bob::ip::base::GradientMagnitudeType* b);

// .. BlockNorm
extern PyTypeObject PyBobIpBaseBlockNorm_Type;
int PyBobIpBaseBlockNorm_Check(PyObject* o);
int PyBobIpBaseBlockNorm_Converter(PyObject* o, bob::ip::base::BlockNorm* b);

// .. HOG
typedef struct {
  PyObject_HEAD
  boost::shared_ptr<bob::ip::base::HOG> cxx;
} PyBobIpBaseHOGObject;

extern PyTypeObject PyBobIpBaseHOG_Type;
int PyBobIpBaseHOG_Check(PyObject* o);

bool init_BobIpBaseHOG(PyObject* module);

// GLCM
typedef struct {
  PyObject_HEAD
  int type_num;
  boost::shared_ptr<void> cxx; // will be casted in each call
  boost::shared_ptr<bob::ip::base::GLCMProp> prop; // the GLMC property handler
} PyBobIpBaseGLCMObject;

extern PyTypeObject PyBobIpBaseGLCM_Type;
int PyBobIpBaseGLCM_Check(PyObject* o);

bool init_BobIpBaseGLCM(PyObject* module);

// .. Wiener filter
typedef struct {
  PyObject_HEAD
  boost::shared_ptr<bob::ip::base::Wiener> cxx;
} PyBobIpBaseWienerObject;

extern PyTypeObject PyBobIpBaseWiener_Type;
int PyBobIpBaseWiener_Check(PyObject* o);

bool init_BobIpBaseWiener(PyObject* module);

// block
PyObject* PyBobIpBase_block(PyObject*, PyObject*, PyObject*);
extern bob::extension::FunctionDoc s_block;
PyObject* PyBobIpBase_blockOutputShape(PyObject*, PyObject*, PyObject*);
extern bob::extension::FunctionDoc s_blockOutputShape;

// LBPHS
PyObject* PyBobIpBase_lbphs(PyObject*, PyObject*, PyObject*);
extern bob::extension::FunctionDoc s_lbphs;
PyObject* PyBobIpBase_lbphsOutputShape(PyObject*, PyObject*, PyObject*);
extern bob::extension::FunctionDoc s_lbphsOutputShape;

// integral
PyObject* PyBobIpBase_integral(PyObject*, PyObject*, PyObject*);
extern bob::extension::FunctionDoc s_integral;

// histogram
PyObject* PyBobIpBase_histogram(PyObject*, PyObject*, PyObject*);
extern bob::extension::FunctionDoc s_histogram;
PyObject* PyBobIpBase_histogramEqualization(PyObject*, PyObject*, PyObject*);
extern bob::extension::FunctionDoc s_histogramEqualization;

// zigzag
PyObject* PyBobIpBase_zigzag(PyObject*, PyObject*, PyObject*);
extern bob::extension::FunctionDoc s_zigzag;

// filtering
PyObject* PyBobIpBase_median(PyObject*, PyObject*, PyObject*);
extern bob::extension::FunctionDoc s_median;

PyObject* PyBobIpBase_sobel(PyObject*, PyObject*, PyObject*);
extern bob::extension::FunctionDoc s_sobel;

#endif // BOB_IP_BASE_MAIN_H

redpajama_set_name: RedPajamaGithub


text:
.scroller {
  height: 100%;
  overflow-y: auto;
  scrollbar-color: var(--colorDisabled) var(--colorBackground); /* For Firefox. */
  -webkit-overflow-scrolling: touch;
}


text:
/**
 * Converts an input filename to a destination filename.
 * @param {string} filename - The input filename.
 * @param {{name: [string], templateName: [string]}} options - Conversion options.
 * @returns {string} The converted filename.
 */
module.exports = function (filename, options) {
  let result = filename.replace(/([a-z]*)_([a-z]+)/ig, ($0, $1, $2) => ($1 ? $0 : `.${$2}`));

  if (options && options.name && options.templateName) {
    result = result.replace(new RegExp(options.templateName, 'g'), options.name);
  }

  return result;
};


text:
#ifndef _Hydrax_CfgFileManager_H_
#define _Hydrax_CfgFileManager_H_

#include "HydraxPrerequisites.h"
#include "HydraxHelp.h"

namespace Hydrax
{
	class Hydrax;

	/** Config file manager.
	    Class to load/save all Hydrax options from/to a config file
	 */
	class HydraxDllExport CfgFileManager
	{
	public:
		/** Constructor
		    @param h Hydrax parent pointer
		 */
		CfgFileManager(Hydrax *h);

		/** Destructor
		 */
        ~CfgFileManager();

		/** Load hydrax cfg file
		    @param File File name
			@return false if an error has been ocurred(Check the log file in this case).
		 */
		const bool load(const Ogre::String& File) const;

		/** Save current hydrax config to a file
		    @param File Destination file name
			@param Path File path
			@return false if an error has been ocurred(Check the log file in this case).
		 */
		const bool save(const Ogre::String& File, const Ogre::String& Path = "") const;

		/** <int> Get the cfg string
		    @param Name Parameter name
		    @param Value Parameter value
			@return int cfg string
		 */
		static Ogre::String _getCfgString(const Ogre::String& Name, const int& Value);

		/** <float> Get the cfg string
		    @param Name Parameter name
		    @param Value Parameter value
			@return Ogre::Real cfg string
		 */
		static Ogre::String _getCfgString(const Ogre::String& Name, const Ogre::Real& Value);

		/** <bool> Get the cfg string
		    @param Name Parameter name
		    @param Value Parameter value
			@return bool cfg string
		 */
		static Ogre::String _getCfgString(const Ogre::String& Name, const bool& Value);

		/** <vector2> Get the cfg string
		    @param Name Parameter name
		    @param Value Parameter value
			@return Ogre::Vector2 cfg string
		 */
		static Ogre::String _getCfgString(const Ogre::String& Name, const Ogre::Vector2& Value);

		/** <vector3> Get the cfg string
		    @param Name Parameter name
		    @param Value Parameter value
			@return Ogre::Vector3 cfg string
		 */
		static Ogre::String _getCfgString(const Ogre::String& Name, const Ogre::Vector3& Value);

		/** <size> Get the cfg string
		    @param Name Parameter name
		    @param Value Parameter value
			@return Hydrax::Size cfg string
		 */
		static Ogre::String _getCfgString(const Ogre::String& Name, const Size& Value);

		/** Get int value
		    @param CfgFile Config file
		    @param Name Parameter name
			@return int value
			@remarks if the parameter isn't found or the data type is not an int value, return 0 as default
		 */
		static int _getIntValue(Ogre::ConfigFile& CfgFile, const Ogre::String Name);

		/** Get float value
		    @param CfgFile Config file
		    @param Name Parameter name
			@return float value
			@remarks if the parameter isn't found or the data type is not a float value, return 0 as default
		 */
		static Ogre::Real _getFloatValue(Ogre::ConfigFile& CfgFile, const Ogre::String Name);

		/** Get bool value
		    @param CfgFile Config file
		    @param Name Parameter name
			@return bool value
			@remarks if the parameter isn't found or the data type is not a bool value, return false as default
		 */
		static bool _getBoolValue(Ogre::ConfigFile& CfgFile, const Ogre::String Name);

		/** Get vector2 value
		    @param CfgFile Config file
		    @param Name Parameter name
			@return vector2 value
			@remarks if the parameter isn't found or the data type is not an int value, returns (0,0) as default
		 */
		static Ogre::Vector2 _getVector2Value(Ogre::ConfigFile& CfgFile, const Ogre::String Name);

		/** Get vector3 value
		    @param CfgFile Config file
		    @param Name Parameter name
			@return vector3 value
			@remarks if the parameter isn't found or the data type is not an int value, returns (0,0,0) as default
		 */
		static Ogre::Vector3 _getVector3Value(Ogre::ConfigFile& CfgFile, const Ogre::String Name);

		/** Get size value
		    @param CfgFile Config file
		    @param Name Parameter name
			@return size value
			@remarks if the parameter isn't found or the data type is not an int value, returns (0,0) as default
		 */
		static Size _getSizeValue(Ogre::ConfigFile& CfgFile, const Ogre::String Name);

		/** Check is a std::vector<Ogre::String> contains a specified Ogre::String
		    @param List String list
			@param Find String to find
			@return true if it's contained, false if not
		 */
		static bool _isStringInList(const Ogre::StringVector &List, const Ogre::String &Find);

	private:
		/** Save a string in file
		    @param Data Data
			@param File Destination file
			@param Path File path
			@return false if an error has ocurred
		 */
		const bool _saveToFile(const Ogre::String& Data, const Ogre::String& File, const Ogre::String& Path) const;

		/** Load a cfg file in an Ogre::ConfigFile
		    @param File File name
			@param Result, std::pair<bool, Ogre::ConfigFile&> First: False if the file isn't in the Hydrax resource group, Second: Ogre::ConfigFile
		 */
		const void _loadCfgFile(const Ogre::String& File, std::pair<bool,Ogre::ConfigFile> &Result) const;

		/** Get components config string
		    @return Components cfg string
		 */
		const Ogre::String _getComponentsCfgString() const;

		/** Load components settings
		    @param CfgFile Config file
		 */
		const void _loadComponentsSettings(Ogre::ConfigFile& CfgFile) const;

		/** Get rtt quality config string
		    @return Rtt quality cfg string
		 */
		const Ogre::String _getRttCfgString() const;

		/** Load rtt settings
		    @param CfgFile Config file
		 */
		const void _loadRttSettings(Ogre::ConfigFile& CfgFile) const;

		/** Get hydrax version cfg string
		    @return Hydrax version cfg string
		 */
		const Ogre::String _getVersionCfgString() const;

		/** Check hydrax version cfg file
		    @param CfgFile Config file
		    @return true if it's the same version, false if not.
		 */
		const bool _checkVersion(Ogre::ConfigFile& CfgFile) const;

		/// Hydrax parent pointer
		Hydrax* mHydrax;
	};
};

#endif


text:
import { pushState } from 'redux-router'

export function addTodoRequest() {
    return {
        type: 'ADD_TODO_REQUEST',
    }
}

export function addTodoSuccess(todo) {
    return {
        type: 'ADD_TODO_SUCCESS',
        payload: todo
    }
}

export function addTodoFailure(validationErrors) {
    return {
        type: 'ADD_TODO_FAILURE',
        payload: validationErrors
    }
}

export function toggleTodoDoneSuccess(todo) {
    return {
        type: 'TOGGLE_TODO_DONE_SUCCESS',
        payload: todo
    }
}

export function toggleTodoDoneFailure() {
    return {
        type: 'TOGGLE_TODO_DONE_FAILURE'
    }
}

export function getTodosRequest() {
    return {
        type: 'GET_TODOS_REQUEST',
    }
}

export function getTodosSuccess(todos) {
    return {
        type: 'GET_TODOS_SUCCESS',
        payload: todos
    }
}

export function getTodosFailure() {
    return {
        type: 'GET_TODOS_FAILURE'
    }
}

export function addTodo(userId, todo) {

    return function(dispatch) {
        dispatch(addTodoRequest())

        if (todo.text === undefined || todo.text.length === 0) {
            dispatch(addTodoFailure([{
                path: 'text',
                message: 'Enter what you need to do'
            }]))
            return
        }

        dispatch({
            type: 'API_POST',
            uri: `/api/users/${userId}/todos`,
            payload: todo,
            onSuccess: (dispatch, result) => {
                dispatch(addTodoSuccess(result))
            },
            onError: (dispatch, error) => {
                dispatch(addTodoFailure(error.validationErrors))
            }
        })
    }
}

export function toggleTodoDone(userId, todo) {

    return function(dispatch) {

        todo.done = todo.done ? false : true

        dispatch({
            type: 'API_PUT',
            uri: `/api/users/${userId}/todos/${todo.id}`,
            payload: todo,
            onSuccess: (dispatch, result) => {
                dispatch(toggleTodoDoneSuccess(result))
            },
            onError: (dispatch, error) => {
                dispatch(toggleTodoDoneFailure())
            }
        })
    }
}

export function getTodos(userId) {

    return function(dispatch) {
        dispatch(getTodosRequest())

        dispatch({
            type: 'API_GET',
            uri: `/api/users/${userId}/todos`,
            onSuccess: (dispatch, result) => {
                dispatch(getTodosSuccess(result))
            },
            onError: (dispatch, error) => {
                dispatch(getTodosFailure())
            }
        })
    }
}


text:
package gov.usda.nrcs.wcc.awdbWebService;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for getAllForecastsForStation complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="getAllForecastsForStation">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="stationTriplet" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="beginPublicationDate" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="endPublicationDate" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "getAllForecastsForStation", propOrder = {
    "stationTriplet",
    "beginPublicationDate",
    "endPublicationDate"
})
public class GetAllForecastsForStation {

    @XmlElement(required = true)
    protected String stationTriplet;
    @XmlElement(required = true)
    protected String beginPublicationDate;
    @XmlElement(required = true)
    protected String endPublicationDate;

    /**
     * Gets the value of the stationTriplet property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getStationTriplet() {
        return stationTriplet;
    }

    /**
     * Sets the value of the stationTriplet property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setStationTriplet(String value) {
        this.stationTriplet = value;
    }

    /**
     * Gets the value of the beginPublicationDate property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getBeginPublicationDate() {
        return beginPublicationDate;
    }

    /**
     * Sets the value of the beginPublicationDate property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setBeginPublicationDate(String value) {
        this.beginPublicationDate = value;
    }

    /**
     * Gets the value of the endPublicationDate property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getEndPublicationDate() {
        return endPublicationDate;
    }

    /**
     * Sets the value of the endPublicationDate property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setEndPublicationDate(String value) {
        this.endPublicationDate = value;
    }

}


text:
#include "mainwindow.h"

#include <QFontComboBox>
#include <QFontDatabase>
#include <QFileDialog>
#include <QMessageBox>
#include <QListWidget>
#include <QDebug>
#include <QShortcut>
#include <QCompleter>
#include <QDirModel>
#include <QTextCodec>

QT_BEGIN_NAMESPACE

MainWindow::MainWindow(const QString &customFont)
{
    setupUi(this);
    pixelSize->setValue(QFontInfo(QFont()).pixelSize());
    populateCharacterRanges();

    {
        weightCombo->addItem(QLatin1String("Light"), QVariant(int(QFont::Light)));
        const int normalIdx = weightCombo->count();
        weightCombo->addItem(QLatin1String("Normal"), QVariant(int(QFont::Normal)));
        weightCombo->addItem(QLatin1String("DemiBold"), QVariant(int(QFont::DemiBold)));
        weightCombo->addItem(QLatin1String("Bold"), QVariant(int(QFont::Bold)));
        weightCombo->addItem(QLatin1String("Black"), QVariant(int(QFont::Black)));

        weightCombo->setCurrentIndex(normalIdx);
    }

    QShortcut *sc = new QShortcut(Qt::ControlModifier + Qt::Key_A, this);
    connect(sc, SIGNAL(activated()),
            this, SLOT(on_selectAll_clicked()));
    sc = new QShortcut(Qt::ControlModifier + Qt::Key_D, this);
    connect(sc, SIGNAL(activated()),
            this, SLOT(on_deselectAll_clicked()));
    sc = new QShortcut(Qt::ControlModifier + Qt::Key_I, this);
    connect(sc, SIGNAL(activated()),
            this, SLOT(on_invertSelection_clicked()));

    QCompleter *completer = new QCompleter(this);
    completer->setModel(new QDirModel(this));
    path->setCompleter(completer);
    path->setText(QDir::currentPath());

    completer = new QCompleter(this);
    completer->setModel(new QDirModel(this));
    sampleFile->setCompleter(completer);
    charCount->setText(QString());

    if (!customFont.isEmpty())
        addCustomFont(customFont);

    fontChanged();

    connect(fontComboBox, SIGNAL(currentFontChanged(QFont)),
            this, SLOT(fontChanged()));
    connect(pixelSize, SIGNAL(valueChanged(int)),
            this, SLOT(fontChanged()));
    connect(italic, SIGNAL(stateChanged(int)),
            this, SLOT(fontChanged()));
    connect(weightCombo, SIGNAL(currentIndexChanged(int)),
            this, SLOT(fontChanged()));
}

void MainWindow::on_actionAdd_Custom_Font_triggered()
{
    QString fontFile = QFileDialog::getOpenFileName(this, tr("Add Custom Font"));
    if (fontFile.isEmpty())
        return;
    addCustomFont(fontFile);
}

void MainWindow::on_selectAll_clicked()
{
    for (int i = 0; i < characterRangeView->count(); ++i)
        characterRangeView->item(i)->setCheckState(Qt::Checked);
}

void MainWindow::on_deselectAll_clicked()
{
    for (int i = 0; i < characterRangeView->count(); ++i)
        characterRangeView->item(i)->setCheckState(Qt::Unchecked);
}

void MainWindow::on_invertSelection_clicked()
{
    for (int i = 0; i < characterRangeView->count(); ++i) {
        QListWidgetItem *item = characterRangeView->item(i);
        if (item->checkState() == Qt::Checked)
            item->setCheckState(Qt::Unchecked);
        else
            item->setCheckState(Qt::Checked);
    }
}

void MainWindow::fontChanged()
{
    QFont f = preview->font();
    f.setStyleStrategy(QFont::NoFontMerging);
    f.setPixelSize(pixelSize->value());
    f.setFamily(fontComboBox->currentFont().family());
    f.setItalic(italic->isChecked());
    f.setWeight(weightCombo->itemData(weightCombo->currentIndex()).toInt());

    if (!preview->isModified()) {
        QFontDatabase db;
        QFontDatabase::WritingSystem ws = db.writingSystems(f.family()).value(0, QFontDatabase::Any);
        QString sample = db.writingSystemSample(ws);
        preview->setText(sample);
        preview->setModified(false);
    }

    fileName->setText(QPF::fileNameForFont(f));

    preview->setFont(f);
}

void MainWindow::on_browsePath_clicked()
{
    QString dir = QFileDialog::getExistingDirectory(this, tr("Select Directory"));
    if (!dir.isEmpty())
        path->setText(dir);
}

void MainWindow::on_browseSampleFile_clicked()
{
    QString dir = QFileDialog::getOpenFileName(this, tr("Select Sample File"));
    if (!dir.isEmpty()) {
        sampleFile->setText(dir);
        on_sampleFile_editingFinished();
    }
}

void MainWindow::on_generate_clicked()
{
    QFile f(path->text() + QDir::separator() + fileName->text());
    if (f.exists()) {
        if (QMessageBox::warning(this, QString(),
                                 tr("%1 already exists.\nDo you want to replace it?").arg(f.fileName()),
                                 QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
            != QMessageBox::Yes) {
            statusBar()->showMessage(tr("Pre-rendering aborted..."));
            return;
        }
    }

    QList<QPF::CharacterRange> ranges;

    if (chooseFromSampleFile->isChecked()) {
        ranges = sampleFileRanges;
    } else if (chooseFromCodePoints->isChecked()) {
        ranges.clear();
        for (int i = 0; i < characterRangeView->count(); ++i) {
            QListWidgetItem *item = characterRangeView->item(i);
            if (item->checkState() != Qt::Checked)
                continue;

            QPF::CharacterRange range = qvariant_cast<QPF::CharacterRange>(item->data(Qt::UserRole));
            ranges.append(range);
        }
    }

    const int generationOptions = QPF::IncludeCMap | QPF::RenderGlyphs;
    QByteArray qpf = QPF::generate(preview->font(), generationOptions, ranges);
    f.open(QIODevice::WriteOnly | QIODevice::Truncate);
    f.write(qpf);
    f.close();

    statusBar()->showMessage(tr("Font successfully pre-rendered to %1").arg(fileName->text()));
}

void MainWindow::on_sampleFile_editingFinished()
{
    sampleFileRanges.clear();
    QFile f(sampleFile->text());
    if (!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
        sampleFileRanges.append(QPF::CharacterRange()); // default = all
        return;
    }
    QTextStream stream(&f);
    stream.setCodec(QTextCodec::codecForName("utf-8"));
    stream.setAutoDetectUnicode(true);
    QString text = stream.readAll();

    QSet<QChar> coverage;
    for (int i = 0; i < text.length(); ++i)
        coverage.insert(text.at(i));

    QList<QChar> sortedCoverage = QList<QChar>::fromSet(coverage);
    qSort(sortedCoverage);
    // play simple :)
    foreach (QChar ch, sortedCoverage) {
        QPF::CharacterRange r;
        r.start = ch.unicode();
        r.end = r.start;
        sampleFileRanges.append(r);
    }

    charCount->setText(tr("(%1 unique characters found)").arg(sortedCoverage.count()));
}

void MainWindow::populateCharacterRanges()
{
    QFile f(":/Blocks.txt");
    if (!f.open(QIODevice::ReadOnly | QIODevice::Text))
        return;

    QRegExp rangeExpr("([0-9a-f]+)\\.\\.([0-9a-f]+); (.+)");
    rangeExpr.setCaseSensitivity(Qt::CaseInsensitive);

    QString ellipsis(QChar(0x2026));
    if (!characterRangeView->fontMetrics().inFont(ellipsis.at(0)))
        ellipsis = QLatin1String("...");

    while (!f.atEnd()) {
        QString line = QString::fromAscii(f.readLine());

        if (line.endsWith(QLatin1Char('\n')))
            line.chop(1);
        if (line.endsWith(QLatin1Char('\r')))
            line.chop(1);

        line = line.trimmed();

        if (line.isEmpty() || line.startsWith(QLatin1Char('#')))
            continue;

        if (!rangeExpr.exactMatch(line) || rangeExpr.captureCount() != 3)
            continue;

        QPF::CharacterRange range;

        bool ok = false;
        range.start = rangeExpr.cap(1).toUInt(&ok, /*base*/16);
        if (!ok)
            continue;
        range.end = rangeExpr.cap(2).toUInt(&ok, /*base*/16);
        if (!ok)
            continue;

        if (range.start >= 0xffff || range.end >= 0xffff)
            continue;

        QString description = rangeExpr.cap(3);

        QListWidgetItem *item = new QListWidgetItem(characterRangeView);
        QString text = description;
        text.append(QLatin1String(" ("));
        text.append(rangeExpr.cap(1));
        text.append(ellipsis);
        text.append(rangeExpr.cap(2));
        text.append(QLatin1String(")"));
        item->setText(text);
        item->setCheckState(Qt::Checked);

        item->setData(Qt::UserRole, QVariant::fromValue(range));
    }
}

void MainWindow::addCustomFont(const QString &fontFile)
{
    int id = QFontDatabase::addApplicationFont(fontFile);
    if (id < 0) {
        QMessageBox::warning(this, tr("Error Adding Custom Font"),
                             tr("The custom font %s could not be loaded.").arg(fontFile));
        return;
    }
    const QStringList families = QFontDatabase::applicationFontFamilies(id);
    if (families.isEmpty()) {
        QMessageBox::warning(this, tr("Error Adding Custom Font"),
                             tr("The custom font %s provides no font families.").arg(fontFile));
        return;
    }
    QFont f(families.first());
    fontComboBox->setCurrentFont(f);
}

QT_END_NAMESPACE


text:
package com.l1.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
import com.l1.dao.PurchaseDtlDao;
import com.l1.entity.PurchaseDtl;
import com.l1.service.PurchaseDtlService;

@Service("purchaseDtlService")
public class PurchaseDtlServiceImpl implements PurchaseDtlService {
  @Resource
  private PurchaseDtlDao purchaseDtlDao;

  @Override
  public List<PurchaseDtl> find(Map<String, Object> map) {
    return purchaseDtlDao.find(map);
  }

  @Override
  public Long getTotalByPurchaseId(Integer id) {
    return purchaseDtlDao.getTotalByPurchaseId(id);
  }

  @Override
  public Integer add(PurchaseDtl purchaseDtl) {
    return purchaseDtlDao.add(purchaseDtl);
  }

  @Override
  public Integer update(PurchaseDtl purchaseDtl) {
    return purchaseDtlDao.update(purchaseDtl);
  }

  @Override
  public int batchSave(List<PurchaseDtl> dtls) {
    return purchaseDtlDao.batchSave(dtls);
  }

  @Override
  public List<PurchaseDtl> findByDtlIds(Integer[] dtlIds) {
    return purchaseDtlDao.findByDtlIds(dtlIds);
  }

  @Override
  public List<PurchaseDtl> findByPurchaseId(Integer id) {
    return purchaseDtlDao.findByPurchaseId(id);
  }

  @Override
  public PurchaseDtl findByDtlId(Integer dtlId) {
    return purchaseDtlDao.findByDtlId(dtlId);
  }

  @Override
  public Integer deleteByDtlId(Integer id) {
    return purchaseDtlDao.deleteByDtlId(id);
  }

  @Override
  public void deleteByDtlIds(Integer[] ids) {
    purchaseDtlDao.deleteByDtlIds(ids);
  }

  @Override
  public void deleteByPuchaseId(Integer purchaseId) {
    purchaseDtlDao.deleteByPuchaseId(purchaseId);
  }

}


text:
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace JsonPersister.Controllers
{
    public class ValuesController : ApiController
    {
        public HttpResponseMessage Options()
        {
            return new HttpResponseMessage { StatusCode = HttpStatusCode.OK };
        }

        public IEnumerable<Resource> Get(string appId)
        {
            return new ResourceRepository(appId).ListAll().ToList();
        }

        public JObject Get(string appId, string resourceId)
        {
            return new ResourceRepository(appId).GetById(resourceId).Content;
        }

        public string Post(string appId, [FromBody]JObject resource)
        {
            return new ResourceRepository(appId).Add(resource);
        }

        public void Put(string appId, string resourceId, [FromBody]JObject resource)
        {
            new ResourceRepository(appId).Add(resourceId, resource);
        }

        public void Delete(string appId, string resourceId = null)
        {
            if (resourceId == null)
            {
                new ResourceRepository(appId).DeleteAll();
            }
            else
            {
                new ResourceRepository(appId).Delete(resourceId);
            }
        }

        [Serializable]
        public struct Resource
        {
            public Resource(string id, JObject content)
            {
                this.Id = id;
                this.Content = content;
            }

            public string Id;

            public JObject Content;
        }

        public class ResourceRepository
        {
            private readonly string appId;

            public ResourceRepository(string appId)
            {
                this.appId = appId;
            }

            private static ConnectionMultiplexer redis;

            private static ConnectionMultiplexer Redis
            {
                get
                {
                    if (redis == null)
                    {
                        var redisCloudUrl = ConfigurationManager.AppSettings["REDISCLOUD_URL"].ToString();
                        var connectionUri = new Uri(redisCloudUrl);
                        string host = connectionUri.Host;
                        int port = connectionUri.Port;
                        string password = connectionUri.UserInfo.Split(':').LastOrDefault();

                        ConfigurationOptions options = new ConfigurationOptions();
                        options.Password = password;
                        options.EndPoints.Add(host, port);

                        redis = ConnectionMultiplexer.Connect(options);
                    }
                    return redis;
                }
            }

            public IEnumerable<Resource> ListAll()
            {
                var db = Redis.GetDatabase();

                var list = db.ListRange(appId, 0, -1);

                return list.Select(x => JsonConvert.DeserializeObject<Resource>(x));
            }

            public Resource GetById(string id)
            {
                return ListAll().SingleOrDefault(x => x.Id == id);
            }

            public void Add(string id, JObject content)
            {
                var db = Redis.GetDatabase();

                db.ListLeftPush(appId, JsonConvert.SerializeObject(new Resource(id, content)));
            }

            public string Add(JObject content)
            {
                var id = Guid.NewGuid().ToString();
                Add(id, content);
                return id;
            }

            public void DeleteAll()
            {
                var db = Redis.GetDatabase();

                db.KeyDelete(appId);
            }

            public void Delete(string id)
            {
                var db = Redis.GetDatabase();

                db.ListRemove(appId, JsonConvert.SerializeObject(GetById(id)), -1);
            }
        }
    }
}


text:
/*!
 * Angular Material Design
 * https://github.com/angular/material
 * @license MIT
 * v1.0.0-rc4
 */
md-divider.md-THEME_NAME-theme {
  border-top-color: '{{foreground-4}}'; }


text:
package br.gov.siscomex.portalunico.duimp.model;

import java.util.List;

import javax.validation.Valid;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import com.fasterxml.jackson.annotation.JsonProperty;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(name = "ItemTributoCover", propOrder =
    { "dadosMercadoria", "valorMercadoria", "tributosAplicados", "calculosTributos"
})

@XmlRootElement(name="ItemTributoCover")
/**
  * Dados da mercadoria e dos tributos do item
 **/
@ApiModel(description="Dados da mercadoria e dos tributos do item")
public class ItemTributoCover  {

  @XmlElement(name="dadosMercadoria")
  @ApiModelProperty(value = "")
  @Valid
  private DadosMercadoriaCover dadosMercadoria = null;

  @XmlElement(name="valorMercadoria")
  @ApiModelProperty(value = "")
  @Valid
  private ValorMercadoriaCover valorMercadoria = null;

  @XmlElement(name="tributosAplicados")
  @ApiModelProperty(value = "Lista de tributos aplicados")
  @Valid
 /**
   * Lista de tributos aplicados
  **/
  private List<TributoAplicadoCover> tributosAplicados = null;

  @XmlElement(name="calculosTributos")
  @ApiModelProperty(value = "Lista de tributos calculados")
  @Valid
 /**
   * Lista de tributos calculados
  **/
  private List<CalculoTributoCover> calculosTributos = null;
 /**
   * Get dadosMercadoria
   * @return dadosMercadoria
  **/
  @JsonProperty("dadosMercadoria")
  public DadosMercadoriaCover getDadosMercadoria() {
    return dadosMercadoria;
  }

  public void setDadosMercadoria(DadosMercadoriaCover dadosMercadoria) {
    this.dadosMercadoria = dadosMercadoria;
  }

  public ItemTributoCover dadosMercadoria(DadosMercadoriaCover dadosMercadoria) {
    this.dadosMercadoria = dadosMercadoria;
    return this;
  }

 /**
   * Get valorMercadoria
   * @return valorMercadoria
  **/
  @JsonProperty("valorMercadoria")
  public ValorMercadoriaCover getValorMercadoria() {
    return valorMercadoria;
  }

  public void setValorMercadoria(ValorMercadoriaCover valorMercadoria) {
    this.valorMercadoria = valorMercadoria;
  }

  public ItemTributoCover valorMercadoria(ValorMercadoriaCover valorMercadoria) {
    this.valorMercadoria = valorMercadoria;
    return this;
  }

 /**
   * Lista de tributos aplicados
   * @return tributosAplicados
  **/
  @JsonProperty("tributosAplicados")
  public List<TributoAplicadoCover> getTributosAplicados() {
    return tributosAplicados;
  }

  public void setTributosAplicados(List<TributoAplicadoCover> tributosAplicados) {
    this.tributosAplicados = tributosAplicados;
  }

  public ItemTributoCover tributosAplicados(List<TributoAplicadoCover> tributosAplicados) {
    this.tributosAplicados = tributosAplicados;
    return this;
  }

  public ItemTributoCover addTributosAplicadosItem(TributoAplicadoCover tributosAplicadosItem) {
    this.tributosAplicados.add(tributosAplicadosItem);
    return this;
  }

 /**
   * Lista de tributos calculados
   * @return calculosTributos
  **/
  @JsonProperty("calculosTributos")
  public List<CalculoTributoCover> getCalculosTributos() {
    return calculosTributos;
  }

  public void setCalculosTributos(List<CalculoTributoCover> calculosTributos) {
    this.calculosTributos = calculosTributos;
  }

  public ItemTributoCover calculosTributos(List<CalculoTributoCover> calculosTributos) {
    this.calculosTributos = calculosTributos;
    return this;
  }

  public ItemTributoCover addCalculosTributosItem(CalculoTributoCover calculosTributosItem) {
    this.calculosTributos.add(calculosTributosItem);
    return this;
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class ItemTributoCover {\n");

    sb.append("    dadosMercadoria: ").append(toIndentedString(dadosMercadoria)).append("\n");
    sb.append("    valorMercadoria: ").append(toIndentedString(valorMercadoria)).append("\n");
    sb.append("    tributosAplicados: ").append(toIndentedString(tributosAplicados)).append("\n");
    sb.append("    calculosTributos: ").append(toIndentedString(calculosTributos)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private static String toIndentedString(java.lang.Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }
}


text:
<?php

namespace FrontEndBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;

class FrontEndExtension extends Extension
{
    public function load(array $configs, ContainerBuilder $container)
    {
        $loaderYAML = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
        $loaderYAML->load('services.yml');
        $loaderYAML->load('twig.yml');
    }
}


text:
<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Enable Routes Explorer route
    |--------------------------------------------------------------------------
    |
    | Make sure, either you protect this route by overriding it with some middleware
    | or make it false in production environment
    |
    */

    'enable_explorer' => true,

    /*
    |--------------------------------------------------------------------------
    | Routes Explorer route
    |--------------------------------------------------------------------------
    |
    | On this url, routes explorer will be displayed
    |
    */

    'route' => 'routes-explorer',

    /*
    |--------------------------------------------------------------------------
    | Routes Explorer view file name
    |--------------------------------------------------------------------------
    |
    | this view file will be used to display a view
    |
    */

    'view' => 'infyomlabs::routes',

    /*
    |--------------------------------------------------------------------------
    | Data Collectors
    |--------------------------------------------------------------------------
    |
    | Various data collectors to collect data
    |
    */

    'collections' => [

        // collect api calls count
        'api_calls_count' => false

    ]
];


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 1.0 Transitional//EN">

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../includes/main.css" type="text/css">
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon">
<title>Apache CloudStack | The Power Behind Your Cloud</title>

									Apache CloudStack v4.7.0 Root Admin API Reference

listHypervisorCapabilities

Lists all hypervisor capabilities.

Request parameters

Parameter Name	Description	Required

hypervisor	the hypervisor for which to restrict the search	false

id	ID of the hypervisor capability	false

keyword	List by keyword	false

page		false

pagesize		false

Response Tags

Response Name	Description

id	the ID of the hypervisor capabilities row

hypervisor	the hypervisor type

hypervisorversion	the hypervisor version

maxdatavolumeslimit	the maximum number of Data Volumes that can be attached for this hypervisor

maxguestslimit	the maximum number of guest vms recommended for this hypervisor

maxhostspercluster	the maximum number of Hosts per cluster for this hypervisor

securitygroupenabled	true if security group is supported

storagemotionenabled	true if storage motion is supported

Copyright © 2015 The Apache Software Foundation, Licensed under the
                   Apache License, Version 2.0.

                Apache, CloudStack, Apache CloudStack, the Apache CloudStack logo, the CloudMonkey logo  and the Apache feather logo are trademarks of The Apache Software Foundation.


text:
import { take, call, put, takeLatest, cancel } from 'redux-saga/effects';
import { LOCATION_CHANGE } from 'react-router-redux';
import { normalize } from 'normalizr';
import chatsSchema from './schema';
import { LOAD_CHATS } from './constants';
import { chatsLoaded, chatsLoadingError } from './actions';

import fetchChats from './requests';

export function* getChats() {
  try {
    const chats = yield call(fetchChats);
    const normalized = yield normalize(chats, chatsSchema);
    yield put(chatsLoaded(normalized.entities.chats, normalized.entities.messages));
  } catch (err) {
    yield put(chatsLoadingError(err));
  }
}

export function* chatsData() {
  const watcher = yield takeLatest(LOAD_CHATS, getChats);

  yield take(LOCATION_CHANGE);
  yield cancel(watcher);
}

export default [
  chatsData,
];


text:
<?php

namespace Milax\Mconsole\Traits\Models;

use Illuminate\Database\Eloquent\Relations\HasManyThrough;

trait HasTags
{
    /**
     * Dynamic hasMany relationship on Tag model
     *
     * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
     */
    public function tags()
    {
        return $this->morphToMany('Milax\Mconsole\Models\Tag', 'taggable');
    }

    /**
     * Cascade Delete Tags
     *
     * @return void
     */
    protected function cascadeDeleteTags()
    {
        app('API')->tags->detach($this);
    }
}


text:
<?php

namespace Dywee\OrderCMSBundle\Repository;
use Doctrine\ORM\EntityRepository;
use Dywee\OrderBundle\Entity\BaseOrder;

/**
 * OrderStatRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class OrderStatRepository extends EntityRepository
{
    public function getStats($type, $beginAt, $endAt, $detail = 'day')
    {
        $qb = $this->createQueryBuilder('s')
            ->select('s.createdAt, s.type, YEAR(s.createdAt) as year, MONTH(s.createdAt) as month, DAY(s.createdAt) as day')
            ->andWhere('s.createdAt between :beginAt and :endAt')
            ->setParameters(array(
                    'beginAt' => $beginAt,
                    'endAt' => $endAt))
            ->orderBy('s.createdAt', 'asc');

        $qb->groupBy('s.type, year, month');

        if (is_string($type)) {
            $qb->where('count(s.id) as total, s.type = :type')
            ->setParameter('type', $type);
        } elseif (is_array($type)) {
            $where = '(';
            $i = 0;
            foreach ($type as $typeElement) {
                if ($i > 0) {
                    $where .= ' or ';
                }
                $where .= 's.type = :type' . $i;
                $qb->setParameter('type' . $i++, $typeElement);
            }
            $where .= ')';
            $qb->addSelect('count(s.id) as total');
            $qb->andWhere($where);
        }

        if ($detail == 'day') {
            $qb->addGroupBy('day');
        }

        return $qb->getQuery()->getResult();
    }

    public function retrievedStatForOrder(BaseOrder $order, $event, $trackingKey)
    {
        $qb = $this->createQueryBuilder('s')
            ->select('s')
            ->where('s.order = :order and s.type = :event and s.trackingKey = :key and s.createdAt between :start and :end')
            ->setParameters(array(
                'order' => $order,
                'event' => $event,
                'key' => $trackingKey,
                'start' => new \DateTime('today'),
                'end' => new \DateTime('tomorrow'),
            ))
        ;

        return $qb->getQuery()->getResult();
    }
}


text:
class CreateEvents < ActiveRecord::Migration
  def change
    create_table :events do |t|
      t.string :title
      t.string :short_description
      t.text :long_description
      t.integer :city_id
      t.string :address
      t.string :address_complement
      t.string :number
      t.string :district
      t.string :zip_code
      t.float :latitude
      t.float :longitude
      t.string :url_site
      t.string :facebook_page
      t.date :initial_date
      t.date :end_date
      t.time :initial_hour
      t.time :end_hour
      t.string :status
      t.text :note
      t.boolean :archive
      t.integer :event_type_id
      t.integer :event_category_id
      t.boolean :use_password
      t.string :password
      t.string :confirm_password
      t.integer :min_users
      t.integer :max_users
      t.integer :company_id

      t.timestamps null: false
    end
  end
end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Uses of Interface net.sf.jasperreports.engine.export.JRHyperlinkTargetProducer (JasperReports 5.6.0 API)</title>
<meta name="date" content="2014-05-27">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Interface
net.sf.jasperreports.engine.export.JRHyperlinkTargetProducer

Packages that use JRHyperlinkTargetProducer

Package
Description

net.sf.jasperreports.engine.export

Provides utility classes for exporting reports to various popular formats such as
 PDF, HTML, RTF, CSV, Excel, DOCX, PPTX, ODT, ODS, XML, Text, etc.

Uses of JRHyperlinkTargetProducer in net.sf.jasperreports.engine.export

Methods in net.sf.jasperreports.engine.export that return JRHyperlinkTargetProducer

Modifier and Type
Method and Description

JRHyperlinkTargetProducer
DefaultHyperlinkTargetProducerFactory.getHyperlinkTargetProducer(java.lang.String linkTarget)

abstract JRHyperlinkTargetProducer
JRHyperlinkTargetProducerFactory.getHyperlinkTargetProducer(java.lang.String linkTarget)

Returns the hyperlink target producer associated with a specific hyperlink target.

JRHyperlinkTargetProducer
JRHyperlinkTargetProducerMapFactory.getHyperlinkTargetProducer(java.lang.String linkTarget)

JRHyperlinkTargetProducer
JRHyperlinkTargetProducerMapFactory.removeProducer(java.lang.String linkTarget)

Removes a target to producer association.

Methods in net.sf.jasperreports.engine.export that return types with arguments of type JRHyperlinkTargetProducer

Modifier and Type
Method and Description

java.util.Map<java.lang.String,JRHyperlinkTargetProducer>
JRHyperlinkTargetProducerMapFactory.getProducersMap()

Exposes the target to producer association map.

Methods in net.sf.jasperreports.engine.export with parameters of type JRHyperlinkTargetProducer

Modifier and Type
Method and Description

void
JRHyperlinkTargetProducerMapFactory.addProducer(java.lang.String linkTarget,
           JRHyperlinkTargetProducer producer)

Adds a hyperlink target producer instance associated to a hyperlink target.

Method parameters in net.sf.jasperreports.engine.export with type arguments of type JRHyperlinkTargetProducer

Modifier and Type
Method and Description

void
JRHyperlinkTargetProducerMapFactory.setProducersMap(java.util.Map<java.lang.String,JRHyperlinkTargetProducer> producers)

Sets the target to producer association map.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com


text:
// <auto-generated />
using LearningSystem.Data;
using LearningSystem.Data.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;

namespace LearningSystem.Data.Migrations
{
    [DbContext(typeof(LearningSystemDbContext))]
    [Migration("20171124130401_GradeColumn")]
    partial class GradeColumn
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "2.0.1-rtm-125")
                .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

            modelBuilder.Entity("LearningSystem.Data.Models.Article", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("AuthorId");

                    b.Property<string>("Content")
                        .IsRequired();

                    b.Property<DateTime>("PublishDate");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasMaxLength(50);

                    b.HasKey("Id");

                    b.HasIndex("AuthorId");

                    b.ToTable("Articles");
                });

            modelBuilder.Entity("LearningSystem.Data.Models.Course", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(2000);

                    b.Property<DateTime>("EndDate");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(50);

                    b.Property<DateTime>("StartDate");

                    b.Property<string>("TrainerId");

                    b.HasKey("Id");

                    b.HasIndex("TrainerId");

                    b.ToTable("Courses");
                });

            modelBuilder.Entity("LearningSystem.Data.Models.StudentCourse", b =>
                {
                    b.Property<int>("CourseId");

                    b.Property<string>("StudentId");

                    b.Property<int?>("Grade");

                    b.HasKey("CourseId", "StudentId");

                    b.HasIndex("StudentId");

                    b.ToTable("StudentCourse");
                });

            modelBuilder.Entity("LearningSystem.Data.Models.User", b =>
                {
                    b.Property<string>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<int>("AccessFailedCount");

                    b.Property<DateTime>("Birthdate");

                    b.Property<string>("ConcurrencyStamp")
                        .IsConcurrencyToken();

                    b.Property<string>("Email")
                        .HasMaxLength(256);

                    b.Property<bool>("EmailConfirmed");

                    b.Property<bool>("LockoutEnabled");

                    b.Property<DateTimeOffset?>("LockoutEnd");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(100);

                    b.Property<string>("NormalizedEmail")
                        .HasMaxLength(256);

                    b.Property<string>("NormalizedUserName")
                        .HasMaxLength(256);

                    b.Property<string>("PasswordHash");

                    b.Property<string>("PhoneNumber");

                    b.Property<bool>("PhoneNumberConfirmed");

                    b.Property<string>("SecurityStamp");

                    b.Property<bool>("TwoFactorEnabled");

                    b.Property<string>("UserName")
                        .HasMaxLength(256);

                    b.HasKey("Id");

                    b.HasIndex("NormalizedEmail")
                        .HasName("EmailIndex");

                    b.HasIndex("NormalizedUserName")
                        .IsUnique()
                        .HasName("UserNameIndex")
                        .HasFilter("[NormalizedUserName] IS NOT NULL");

                    b.ToTable("AspNetUsers");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
                {
                    b.Property<string>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("ConcurrencyStamp")
                        .IsConcurrencyToken();

                    b.Property<string>("Name")
                        .HasMaxLength(256);

                    b.Property<string>("NormalizedName")
                        .HasMaxLength(256);

                    b.HasKey("Id");

                    b.HasIndex("NormalizedName")
                        .IsUnique()
                        .HasName("RoleNameIndex")
                        .HasFilter("[NormalizedName] IS NOT NULL");

                    b.ToTable("AspNetRoles");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("ClaimType");

                    b.Property<string>("ClaimValue");

                    b.Property<string>("RoleId")
                        .IsRequired();

                    b.HasKey("Id");

                    b.HasIndex("RoleId");

                    b.ToTable("AspNetRoleClaims");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("ClaimType");

                    b.Property<string>("ClaimValue");

                    b.Property<string>("UserId")
                        .IsRequired();

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("AspNetUserClaims");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
                {
                    b.Property<string>("LoginProvider");

                    b.Property<string>("ProviderKey");

                    b.Property<string>("ProviderDisplayName");

                    b.Property<string>("UserId")
                        .IsRequired();

                    b.HasKey("LoginProvider", "ProviderKey");

                    b.HasIndex("UserId");

                    b.ToTable("AspNetUserLogins");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
                {
                    b.Property<string>("UserId");

                    b.Property<string>("RoleId");

                    b.HasKey("UserId", "RoleId");

                    b.HasIndex("RoleId");

                    b.ToTable("AspNetUserRoles");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
                {
                    b.Property<string>("UserId");

                    b.Property<string>("LoginProvider");

                    b.Property<string>("Name");

                    b.Property<string>("Value");

                    b.HasKey("UserId", "LoginProvider", "Name");

                    b.ToTable("AspNetUserTokens");
                });

            modelBuilder.Entity("LearningSystem.Data.Models.Article", b =>
                {
                    b.HasOne("LearningSystem.Data.Models.User", "Author")
                        .WithMany("Articles")
                        .HasForeignKey("AuthorId");
                });

            modelBuilder.Entity("LearningSystem.Data.Models.Course", b =>
                {
                    b.HasOne("LearningSystem.Data.Models.User", "Trainer")
                        .WithMany("Trainings")
                        .HasForeignKey("TrainerId");
                });

            modelBuilder.Entity("LearningSystem.Data.Models.StudentCourse", b =>
                {
                    b.HasOne("LearningSystem.Data.Models.Course", "Course")
                        .WithMany("Students")
                        .HasForeignKey("CourseId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("LearningSystem.Data.Models.User", "Student")
                        .WithMany("Courses")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
                {
                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
                        .WithMany()
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
                {
                    b.HasOne("LearningSystem.Data.Models.User")
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
                {
                    b.HasOne("LearningSystem.Data.Models.User")
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
                {
                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
                        .WithMany()
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("LearningSystem.Data.Models.User")
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
                {
                    b.HasOne("LearningSystem.Data.Models.User")
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade);
                });
#pragma warning restore 612, 618
        }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Uses of Interface org.apache.lucene.queryparser.flexible.core.config.FieldConfigListener (Lucene 6.0.1 API)</title>
<meta name="date" content="2016-05-23">
<link rel="stylesheet" type="text/css" href="../../../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Interface
org.apache.lucene.queryparser.flexible.core.config.FieldConfigListener

Packages that use FieldConfigListener

Package
Description

org.apache.lucene.queryparser.flexible.core.config

Base classes used to configure the query processing.

org.apache.lucene.queryparser.flexible.standard.config

Standard Lucene Query Configuration.

Uses of FieldConfigListener in org.apache.lucene.queryparser.flexible.core.config

Methods in org.apache.lucene.queryparser.flexible.core.config with parameters of type FieldConfigListener

Modifier and Type
Method and Description

void
QueryConfigHandler.addFieldConfigListener(FieldConfigListener listener)

Adds a listener.

Uses of FieldConfigListener in org.apache.lucene.queryparser.flexible.standard.config

Classes in org.apache.lucene.queryparser.flexible.standard.config that implement FieldConfigListener

Modifier and Type
Class and Description

class
FieldBoostMapFCListener

This listener listens for every field configuration request and assign a
 StandardQueryConfigHandler.ConfigurationKeys.BOOST to the
 equivalent FieldConfig based on a defined map: fieldName -> boostValue stored in
 StandardQueryConfigHandler.ConfigurationKeys.FIELD_BOOST_MAP.

class
FieldDateResolutionFCListener

This listener listens for every field configuration request and assign a
 StandardQueryConfigHandler.ConfigurationKeys.DATE_RESOLUTION to the equivalent FieldConfig based
 on a defined map: fieldName -> DateTools.Resolution stored in
 StandardQueryConfigHandler.ConfigurationKeys.FIELD_DATE_RESOLUTION_MAP.

class
LegacyNumericFieldConfigListener

Deprecated.

Index with Points instead and use PointsConfigListener

class
PointsConfigListener

This listener is used to listen to FieldConfig requests in
 QueryConfigHandler and add StandardQueryConfigHandler.ConfigurationKeys.POINTS_CONFIG
 based on the StandardQueryConfigHandler.ConfigurationKeys.POINTS_CONFIG_MAP set in the
 QueryConfigHandler.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Help

Prev

Next

Frames

No Frames

All Classes

          Copyright © 2000-2016 Apache Software Foundation.  All Rights Reserved.


text:
/**
 * Package containing keys that identify items or market data.
 *

 * Market data keys identify market data used by calculations. For example, a calculation might create
 * a market data key for the USD discounting curve and use it to request the curve.
 *

 * A key identifies a piece of market data which can appear multiple time in the system. For example,
 * the system can contain an unlimited number of curve groups, and each of those groups can contain
 * a USD discounting curve.
 *

 * The individual instances of the USD discounting curve are uniquely identified by a market data ID.
 * When a calculation requests market data using a key, there is a mapping step to convert the key
 * to an ID, and the ID is used to look up the data. The mappings between keys and IDs are part
 * of the configuration of the calculations and are defined in a set of market data rules.
 */
package com.opengamma.strata.market.key;


text:
// The MIT License (MIT)
//
// Copyright (c) 2017 Smart&Soft
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

using System;
using System.Threading.Tasks;
using System.Windows.Controls;
using Microsoft.Phone.Shell;
using ModernApp4Me.Core.LifeCycle;
using ModernApp4Me.Core.ViewModel;
using ModernApp4Me.WP8.Sample.ViewModel;
using ModernApp4Me.WP8.Sample.WebService;

namespace ModernApp4Me.WP8.Sample.ExceptionHandler
{

    /// <author>Ludovic ROLAND</author>
    /// <since>2015.03.05</since>
    public sealed partial class ExceptionHandlerDetailPage
    {

        private string param;

        public ExceptionHandlerDetailPage()
        {
            InitializeComponent();

            isManagingProgressIndicatorItself = true;
        }

        protected override void LoadQueryString()
        {
            param = NavigationContext.QueryString["param"];
        }

        protected async override Task<M4MBaseViewModel> ComputeViewModel()
        {
            if (ExceptionHandlerPage.BO.Equals(param) == true)
            {
                throw new M4MBusinessObjectUnavailableException();
            }

            if (ExceptionHandlerPage.EXCEPTION.Equals(param) == true)
            {
                throw new NullReferenceException();
            }

            var weather = await Services.Instance.GetWeather("London");
            return new ForecastsViewModel() { Forecasts = weather.Forecasts };
        }

        protected override void OnFullfillDisplayObjects()
        {
            DataContext = viewModel;
        }

        protected override Panel RetrieveMainContainer()
        {
            return ContentPanel;
        }

        protected override ProgressIndicator RetrieveProgressIndicator()
        {
            return null;
        }
    }
}