text:
  <button type="button" class="close" aria-label="Close" ng-click="$ctrl.cancel()">

  </button>

Add Connection

Edit Connection

<form name="connectForm" class="form-horizontal jvm-connection-form" ng-submit="$ctrl.saveConnection($ctrl.connection)">

      Name

        <input type="text" id="connection-name" class="form-control" name="name" ng-model="$ctrl.connection.name" pf-focused="!$ctrl.connection.name">
        {{$ctrl.errors.name}}

      Scheme

        <select id="connection-scheme" class="form-control" name="scheme" ng-model="$ctrl.connection.scheme">
          <option>http</option>
          <option>https</option>
        </select>

      Host

        <input type="text" id="connection-host" class="form-control" name="host" ng-model="$ctrl.connection.host" ng-change="">
        {{$ctrl.errors.host}}

      Port

        <input type="number" id="connection-port" class="form-control" name="port" ng-model="$ctrl.connection.port" ng-change="resetTestConnection()">
        {{$ctrl.errors.port}}

      Path

        <input type="text" id="connection-path" class="form-control" name="path" ng-model="$ctrl.connection.path" ng-change="resetTestConnection()">

        <button type="button" class="btn btn-default" ng-click="$ctrl.testConnection($ctrl.connection)">
          Test Connection
        </button>

          {{$ctrl.connectionTestResult.message}}

    <button type="button" class="btn btn-default" ng-click="$ctrl.cancel()">Cancel</button>
    <button type="submit" class="btn btn-primary" ng-show="$ctrl.operation === 'add'">Add</button>
    <button type="submit" class="btn btn-primary" ng-show="$ctrl.operation === 'edit'">Save</button>

</form>


text:
case node['platform_family']
when 'debian'
  apt_repository 'yarn' do
    uri node['yarn']['package']['repository']['uri']
    distribution node['yarn']['package']['repository']['distribution']
    key node['yarn']['package']['repository']['key']
    components node['yarn']['package']['repository']['components']
    action :add
    notifies :run, 'execute[apt-get update]', :immediately
  end

  package 'apt-transport-https' do
    action :install
  end
when 'rhel'
  yum_repository 'yarn' do
    baseurl node['yarn']['package']['repository']['uri']
    gpgkey  node['yarn']['package']['repository']['key']
  end
end

redpajama_set_name: RedPajamaGithub


text:
package v1alpha2

import (
	"encoding/json"
	"testing"

	apis "github.com/openebs/maya/pkg/apis/openebs.io/upgrade/v1alpha1"
	clientset "github.com/openebs/maya/pkg/client/generated/openebs.io/upgrade/v1alpha1/clientset/internalclientset"
	errors "github.com/pkg/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/types"
)

func fakeGetClientsetOk() (cli *clientset.Clientset, err error) {
	return &clientset.Clientset{}, nil
}

func fakeGetClientsetForPathOk(
	fakeConfigPath string,
) (cli *clientset.Clientset, err error) {
	return &clientset.Clientset{}, nil
}

func fakeGetClientsetForPathErr(
	fakeConfigPath string,
) (cli *clientset.Clientset, err error) {
	return nil, errors.New("fake error")
}

func fakeGetFnOk(
	cli *clientset.Clientset,
	name, namespace string,
	opts metav1.GetOptions,
) (*apis.UpgradeTask, error) {
	return &apis.UpgradeTask{}, nil
}

func fakeListFnOk(
	cli *clientset.Clientset,
	namespace string,
	opts metav1.ListOptions,
) (*apis.UpgradeTaskList, error) {
	return &apis.UpgradeTaskList{}, nil
}

func fakeDeleteFnOk(
	cli *clientset.Clientset,
	name, namespace string,
	opts *metav1.DeleteOptions,
) error {
	return nil
}

func fakeListFnErr(
	cli *clientset.Clientset,
	namespace string,
	opts metav1.ListOptions,
) (*apis.UpgradeTaskList, error) {
	return &apis.UpgradeTaskList{}, errors.New("some error")
}

func fakeGetFnErr(
	cli *clientset.Clientset,
	name, namespace string,
	opts metav1.GetOptions,
) (*apis.UpgradeTask, error) {
	return &apis.UpgradeTask{}, errors.New("some error")
}

func fakeDeleteFnErr(
	cli *clientset.Clientset,
	name, namespace string,
	opts *metav1.DeleteOptions,
) error {
	return errors.New("some error")
}

func fakeGetClientsetErr() (clientset *clientset.Clientset, err error) {
	return nil, errors.New("Some error")
}

func fakeCreateFnOk(
	cli *clientset.Clientset,
	namespace string,
	upgradeTask *apis.UpgradeTask) (*apis.UpgradeTask, error) {
	return &apis.UpgradeTask{}, nil
}

func fakeCreateErr(
	cli *clientset.Clientset,
	namespace string,
	upgradeTask *apis.UpgradeTask,
) (*apis.UpgradeTask, error) {
	return nil, errors.New("failed to create UpgradeTask")
}

func fakePatchFnOk(
	cli *clientset.Clientset,
	namespace, name string,
	pt types.PatchType,
	data []byte,
	subresources ...string,
) (*apis.UpgradeTask, error) {
	return &apis.UpgradeTask{}, nil
}

func fakePatchFnErr(
	cli *clientset.Clientset,
	namespace, name string,
	pt types.PatchType,
	data []byte,
	subresources ...string,
) (*apis.UpgradeTask, error) {
	return nil, errors.New("fake error")
}

func TestWithDefaultOptionsForClientset(t *testing.T) {
	tests := map[string]struct {
		getClientset        getClientsetFn
		getClientsetForPath getClientsetForPathFn
	}{
		"TestCase1":               {nil, nil},
		"When clientset is error": {fakeGetClientsetErr, fakeGetClientsetForPathErr},
		"When clientset is ok":    {fakeGetClientsetOk, fakeGetClientsetForPathOk},
	}
	for name, mock := range tests {
		name := name // pin it
		mock := mock // pin it
		t.Run(name, func(t *testing.T) {
			fc := &Kubeclient{
				getClientset:        mock.getClientset,
				getClientsetForPath: mock.getClientsetForPath,
			}
			fc.WithDefaults()
			if fc.getClientset == nil {
				t.Fatalf(
					"test %q failed: expected getClientset not to be empty",
					name,
				)
			}
			if fc.getClientsetForPath == nil {
				t.Fatalf(
					"test %q failed: expected getClientset not to be nil",
					name,
				)
			}
		})
	}
}

func TestGetClientsetForPathOrDirect(t *testing.T) {
	tests := map[string]struct {
		getClientset        getClientsetFn
		getClientsetForPath getClientsetForPathFn
		kubeConfigPath      string
		isErr               bool
	}{
		// Positive tests
		"Positive 1": {fakeGetClientsetOk, fakeGetClientsetForPathOk, "", false},
		"Positive 2": {fakeGetClientsetErr, fakeGetClientsetForPathOk, "fake-path", false},
		"Positive 3": {fakeGetClientsetOk, fakeGetClientsetForPathErr, "", false},

		// Negative tests
		"Negative 1": {fakeGetClientsetErr, fakeGetClientsetForPathOk, "", true},
		"Negative 2": {fakeGetClientsetOk, fakeGetClientsetForPathErr, "fake-path", true},
		"Negative 3": {fakeGetClientsetErr, fakeGetClientsetForPathErr, "fake-path", true},
		"Negative 4": {fakeGetClientsetErr, fakeGetClientsetForPathErr, "", true},
	}

	for name, mock := range tests {
		name, mock := name, mock
		t.Run(name, func(t *testing.T) {
			fc := &Kubeclient{
				getClientset:        mock.getClientset,
				getClientsetForPath: mock.getClientsetForPath,
				kubeConfigPath:      mock.kubeConfigPath,
			}
			_, err := fc.getClientsetForPathOrDirect()
			if mock.isErr && err == nil {
				t.Fatalf(
					"test %q failed : expected error not to be nil but got %v",
					name,
					err,
				)
			}
			if !mock.isErr && err != nil {
				t.Fatalf(
					"test %q failed : expected error be nil but got %v",
					name,
					err,
				)
			}
		})
	}
}

func TestWithClientsetBuildOption(t *testing.T) {
	tests := map[string]struct {
		Clientset             *clientset.Clientset
		expectKubeClientEmpty bool
	}{
		"Clientset is empty":     {nil, true},
		"Clientset is not empty": {&clientset.Clientset{}, false},
	}

	for name, mock := range tests {
		name, mock := name, mock
		t.Run(name, func(t *testing.T) {
			h := WithKubeClient(mock.Clientset)
			fake := &Kubeclient{}
			h(fake)
			if mock.expectKubeClientEmpty && fake.clientset != nil {
				t.Fatalf(
					"test %q failed expected fake.clientset to be empty",
					name,
				)
			}
			if !mock.expectKubeClientEmpty && fake.clientset == nil {
				t.Fatalf(
					"test %q failed expected fake.clientset not to be empty",
					name,
				)
			}
		})
	}
}

func TestGetClientOrCached(t *testing.T) {
	tests := map[string]struct {
		getClientset        getClientsetFn
		getClientsetForPath getClientsetForPathFn
		kubeConfigPath      string
		expectErr           bool
	}{
		// Positive tests
		"Positive 1": {fakeGetClientsetOk, fakeGetClientsetForPathOk, "", false},
		"Positive 2": {fakeGetClientsetErr, fakeGetClientsetForPathOk, "fake-path", false},
		"Positive 3": {fakeGetClientsetOk, fakeGetClientsetForPathErr, "", false},

		// Negative tests
		"Negative 1": {fakeGetClientsetErr, fakeGetClientsetForPathOk, "", true},
		"Negative 2": {fakeGetClientsetOk, fakeGetClientsetForPathErr, "fake-path", true},
		"Negative 3": {fakeGetClientsetErr, fakeGetClientsetForPathErr, "fake-path", true},
		"Negative 4": {fakeGetClientsetErr, fakeGetClientsetForPathErr, "", true},
	}

	for name, mock := range tests {
		name := name // pin it
		mock := mock // pin it
		t.Run(name, func(t *testing.T) {
			fc := &Kubeclient{
				getClientset:        mock.getClientset,
				getClientsetForPath: mock.getClientsetForPath,
				kubeConfigPath:      mock.kubeConfigPath,
			}
			_, err := fc.getClientsetOrCached()
			if mock.expectErr && err == nil {
				t.Fatalf(
					"test %q failed : expected error not to be nil but got %v",
					name,
					err,
				)
			}
			if !mock.expectErr && err != nil {
				t.Fatalf(
					"test %q failed : expected error be nil but got %v",
					name,
					err,
				)
			}
		})
	}
}

func TestUpgradeTaskList(t *testing.T) {
	tests := map[string]struct {
		getClientset        getClientsetFn
		getClientsetForPath getClientsetForPathFn
		kubeConfigPath      string
		list                listFn
		expectedErr         bool
	}{
		// Positive tests
		"Positive 1": {
			nil,
			fakeGetClientsetForPathOk,
			"fake-path",
			fakeListFnOk,
			false,
		},
		"Positive 2": {
			fakeGetClientsetOk,
			fakeGetClientsetForPathOk,
			"",
			fakeListFnOk,
			false,
		},
		"Positive 3": {
			fakeGetClientsetErr,
			fakeGetClientsetForPathOk,
			"fake-path",
			fakeListFnOk,
			false,
		},
		"Positive 4": {
			fakeGetClientsetOk,
			fakeGetClientsetForPathErr,
			"",
			fakeListFnOk,
			false,
		},

		// Negative tests
		"Negative 1": {
			fakeGetClientsetErr,
			fakeGetClientsetForPathOk,
			"",
			fakeListFnOk,
			true,
		},
		"Negative 2": {
			fakeGetClientsetOk,
			fakeGetClientsetForPathErr,
			"fake-path",
			fakeListFnOk,
			true,
		},
		"Negative 3": {
			fakeGetClientsetErr,
			fakeGetClientsetForPathErr,
			"fake-path",
			fakeListFnOk,
			true,
		},
		"Negative 4": {
			fakeGetClientsetOk,
			fakeGetClientsetForPathOk,
			"",
			fakeListFnErr,
			true,
		},
	}

	for name, mock := range tests {
		name := name // pin it
		mock := mock // pin it
		t.Run(name, func(t *testing.T) {
			fc := &Kubeclient{
				getClientset:        mock.getClientset,
				getClientsetForPath: mock.getClientsetForPath,
				kubeConfigPath:      mock.kubeConfigPath,
				list:                mock.list,
			}
			_, err := fc.List(metav1.ListOptions{})
			if mock.expectedErr && err == nil {
				t.Fatalf("Test %q failed: expected error not to be nil", name)
			}
			if !mock.expectedErr && err != nil {
				t.Fatalf("Test %q failed: expected error to be nil", name)
			}
		})
	}
}

func TestUpgradeTaskGet(t *testing.T) {
	tests := map[string]struct {
		getClientset        getClientsetFn
		getClientsetForPath getClientsetForPathFn
		kubeConfigPath      string
		get                 getFn
		UpgradeTaskName     string
		expectErr           bool
	}{
		"Test 1": {
			fakeGetClientsetErr,
			fakeGetClientsetForPathOk,
			"",
			fakeGetFnOk,
			"UpgradeTask-1",
			true,
		},
		"Test 2": {
			fakeGetClientsetOk,
			fakeGetClientsetForPathErr,
			"fake-path",
			fakeGetFnOk,
			"UpgradeTask-1",
			true,
		},
		"Test 3": {
			fakeGetClientsetOk,
			fakeGetClientsetForPathOk,
			"",
			fakeGetFnOk,
			"UpgradeTask-2",
			false,
		},
		"Test 4": {
			fakeGetClientsetOk,
			fakeGetClientsetForPathOk,
			"fp",
			fakeGetFnErr,
			"UpgradeTask-3",
			true,
		},
		"Test 5": {
			fakeGetClientsetOk,
			fakeGetClientsetForPathOk,
			"fakepath",
			fakeGetFnOk,
			"",
			true,
		},
	}

	for name, mock := range tests {
		name := name
		mock := mock
		t.Run(name, func(t *testing.T) {
			k := &Kubeclient{
				getClientset:        mock.getClientset,
				getClientsetForPath: mock.getClientsetForPath,
				kubeConfigPath:      mock.kubeConfigPath,
				namespace:           "default",
				get:                 mock.get,
			}
			_, err := k.Get(mock.UpgradeTaskName, metav1.GetOptions{})
			if mock.expectErr && err == nil {
				t.Fatalf("Test %q failed: expected error not to be nil", name)
			}
			if !mock.expectErr && err != nil {
				t.Fatalf("Test %q failed: expected error to be nil", name)
			}
		})
	}
}

func TestUpgradeTaskDelete(t *testing.T) {
	tests := map[string]struct {
		getClientset        getClientsetFn
		getClientsetForPath getClientsetForPathFn
		kubeConfigPath      string
		UpgradeTaskName     string
		delete              deleteFn
		expectErr           bool
	}{
		"Test 1": {
			fakeGetClientsetErr,
			fakeGetClientsetForPathOk,
			"",
			"UpgradeTask-1",
			fakeDeleteFnOk,
			true,
		},
		"Test 2": {
			fakeGetClientsetOk,
			fakeGetClientsetForPathOk,
			"fake-path2",
			"UpgradeTask-2",
			fakeDeleteFnOk,
			false,
		},
		"Test 3": {
			fakeGetClientsetOk,
			fakeGetClientsetForPathOk,
			"",
			"UpgradeTask-3",
			fakeDeleteFnErr,
			true,
		},
		"Test 4": {
			fakeGetClientsetOk,
			fakeGetClientsetForPathOk,
			"fakepath",
			"",
			fakeDeleteFnOk,
			true,
		},
		"Test 5": {
			fakeGetClientsetOk,
			fakeGetClientsetForPathErr,
			"fake-path2",
			"UpgradeTask1",
			fakeDeleteFnOk,
			true,
		},
		"Test 6": {
			fakeGetClientsetOk,
			fakeGetClientsetForPathErr,
			"fake-path2",
			"UpgradeTask1",
			fakeDeleteFnErr,
			true,
		},
	}

	for name, mock := range tests {
		name := name
		mock := mock
		t.Run(name, func(t *testing.T) {
			k := &Kubeclient{
				getClientset:        mock.getClientset,
				getClientsetForPath: mock.getClientsetForPath,
				kubeConfigPath:      mock.kubeConfigPath,
				namespace:           "",
				del:                 mock.delete,
			}
			err := k.Delete(mock.UpgradeTaskName, &metav1.DeleteOptions{})
			if mock.expectErr && err == nil {
				t.Fatalf("Test %q failed: expected error not to be nil", name)
			}
			if !mock.expectErr && err != nil {
				t.Fatalf("Test %q failed: expected error to be nil", name)
			}
		})
	}
}

func TestUpgradeTaskCreate(t *testing.T) {
	tests := map[string]struct {
		getClientset        getClientsetFn
		getClientsetForPath getClientsetForPathFn
		kubeConfigPath      string
		create              createFn
		upgradeTask         *apis.UpgradeTask
		expectErr           bool
	}{
		"Test 1": {
			getClientset:        fakeGetClientsetErr,
			getClientsetForPath: fakeGetClientsetForPathErr,
			kubeConfigPath:      "",
			create:              fakeCreateFnOk,
			upgradeTask: &apis.UpgradeTask{
				ObjectMeta: metav1.ObjectMeta{Name: "UpgradeTask-1"},
			},
			expectErr: true,
		},
		"Test 2": {
			getClientset:        fakeGetClientsetOk,
			getClientsetForPath: fakeGetClientsetForPathOk,
			kubeConfigPath:      "",
			create:              fakeCreateErr,
			upgradeTask: &apis.UpgradeTask{
				ObjectMeta: metav1.ObjectMeta{Name: "UpgradeTask-2"},
			},
			expectErr: true,
		},
		"Test 3": {
			getClientset:        fakeGetClientsetOk,
			getClientsetForPath: fakeGetClientsetForPathOk,
			kubeConfigPath:      "fake-path",
			create:              fakeCreateErr,
			upgradeTask:         nil,
			expectErr:           true,
		},
		"Test 4": {
			getClientset:        fakeGetClientsetErr,
			getClientsetForPath: fakeGetClientsetForPathOk,
			kubeConfigPath:      "fake-path",
			create:              fakeCreateFnOk,
			upgradeTask:         nil,
			expectErr:           true,
		},
		"Test 5": {
			getClientset:        fakeGetClientsetOk,
			getClientsetForPath: fakeGetClientsetForPathErr,
			kubeConfigPath:      "fake-path",
			create:              fakeCreateFnOk,
			upgradeTask:         nil,
			expectErr:           true,
		},
	}

	for name, mock := range tests {
		name, mock := name, mock
		t.Run(name, func(t *testing.T) {
			fc := &Kubeclient{
				getClientset:        mock.getClientset,
				getClientsetForPath: mock.getClientsetForPath,
				kubeConfigPath:      mock.kubeConfigPath,
				create:              mock.create,
			}
			_, err := fc.Create(mock.upgradeTask)
			if mock.expectErr && err == nil {
				t.Fatalf("Test %q failed: expected error not to be nil", name)
			}
			if !mock.expectErr && err != nil {
				t.Fatalf("Test %q failed: expected error to be nil", name)
			}
		})
	}
}

func TestUpgradeTaskPatch(t *testing.T) {
	tests := map[string]struct {
		getClientset        getClientsetFn
		getClientsetForPath getClientsetForPathFn
		kubeConfigPath      string
		patch               patchFn
		UpgradeTaskName     string
		expectErr           bool
	}{
		"Test 1": {
			fakeGetClientsetErr,
			fakeGetClientsetForPathOk,
			"",
			fakePatchFnOk,
			"upgradeTask-1", true},
		"Test 2": {
			fakeGetClientsetOk,
			fakeGetClientsetForPathErr,
			"fake-path",
			fakePatchFnOk,
			"upgradeTask-1",
			true,
		},
		"Test 3": {
			fakeGetClientsetOk,
			fakeGetClientsetForPathOk,
			"",
			fakePatchFnOk,
			"upgradeTask-2",
			false,
		},
		"Test 4": {
			fakeGetClientsetOk,
			fakeGetClientsetForPathOk,
			"fp",
			fakePatchFnErr,
			"upgradeTask-3",
			true,
		},
		"Test 5": {
			fakeGetClientsetOk,
			fakeGetClientsetForPathOk,
			"fakepath",
			fakePatchFnOk,
			"",
			true,
		},
	}

	for name, mock := range tests {
		name := name
		mock := mock
		t.Run(name, func(t *testing.T) {
			k := &Kubeclient{
				getClientset:        mock.getClientset,
				getClientsetForPath: mock.getClientsetForPath,
				kubeConfigPath:      mock.kubeConfigPath,
				patch:               mock.patch,
			}
			//fake data
			data, _ := json.Marshal(mock)
			_, err := k.Patch(mock.UpgradeTaskName, types.MergePatchType, data)
			if mock.expectErr && err == nil {
				t.Fatalf("Test %q failed: expected error not to be nil", name)
			}
			if !mock.expectErr && err != nil {
				t.Fatalf("Test %q failed: expected error to be nil", name)
			}
		})
	}
}

func TestIsValidStatus(t *testing.T) {
	tests := map[string]struct {
		status       apis.UpgradeDetailedStatuses
		expectOutput bool
	}{
		"Test 1": {
			apis.UpgradeDetailedStatuses{
				Step: apis.PreUpgrade,
				Status: apis.Status{
					Phase: apis.StepWaiting,
				},
			},
			true,
		},
		"Test 2": {
			apis.UpgradeDetailedStatuses{
				Step: apis.PreUpgrade,
				Status: apis.Status{
					Phase:   apis.StepCompleted,
					Message: "fake-message",
				},
			},
			true,
		},
		"Test 3": {
			apis.UpgradeDetailedStatuses{
				Step: apis.PreUpgrade,
				Status: apis.Status{
					Phase:   apis.StepErrored,
					Message: "fake-message",
					Reason:  "fake-reason",
				},
			},
			true,
		},
		// negative test
		"Test 4": {
			apis.UpgradeDetailedStatuses{},
			false,
		},
		"Test 5": {
			apis.UpgradeDetailedStatuses{
				Step: apis.PreUpgrade,
			},
			false,
		},
		"Test 6": {
			apis.UpgradeDetailedStatuses{
				Step: apis.PreUpgrade,
				Status: apis.Status{
					Phase: apis.StepCompleted,
				},
			},
			false,
		},
		"Test 7": {
			apis.UpgradeDetailedStatuses{
				Step: apis.PreUpgrade,
				Status: apis.Status{
					Phase:   apis.StepErrored,
					Message: "fake-message",
				},
			},
			false,
		},
	}
	for name, mock := range tests {
		name := name
		mock := mock
		t.Run(name, func(t *testing.T) {

			output := IsValidStatus(mock.status)
			if mock.expectOutput != output {
				t.Fatalf(
					"Test %q failed: expected %v not to be %v",
					name,
					output,
					mock.expectOutput,
				)
			}
		})
	}
}


text:
.class public Lcom/zte/ZTESecurity/ZTESecUtil;
.super Ljava/lang/Object;
.source "ZTESecUtil.java"

# static fields
.field private static final ACCESS_COARSE_LOCATION:Ljava/lang/String; = "android.permission.ACCESS_COARSE_LOCATION"

.field private static final ACCESS_FINE_LOCATION:Ljava/lang/String; = "android.permission.ACCESS_FINE_LOCATION"

.field private static final BLUETOOTH_ADMIN_PERM:Ljava/lang/String; = "android.permission.BLUETOOTH_ADMIN"

.field private static final CHANGE_NETWORK_STATE:Ljava/lang/String; = "android.permission.CHANGE_NETWORK_STATE"

.field private static final CHANGE_WIFI_STATE:Ljava/lang/String; = "android.permission.CHANGE_WIFI_STATE"

.field private static final DEBUG:Z = false

.field private static final DEFAULT_PHONE_INFO_VALUE:Ljava/lang/String; = "Unknown"

.field private static final DEFAULT_TABLE:Ljava/lang/String; = "empty_table"

.field private static final READ_PHONE_STATE:Ljava/lang/String; = "android.permission.READ_PHONE_STATE"

.field private static final SEND_MMS:Ljava/lang/String; = "android.permission.ZTE_SEND_MMS"

.field private static final SEND_SMS:Ljava/lang/String; = "android.permission.SEND_SMS"

.field private static final TAG:Ljava/lang/String; = "ZTESecUtil"

.field private static final _ID:Ljava/lang/String; = "_id"

.field private static mDb:Landroid/database/sqlite/SQLiteDatabase;

.field private static sInstance:Lcom/zte/ZTESecurity/ZTESecUtil;

# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 21
    const/4 v0, 0x0

    sput-object v0, Lcom/zte/ZTESecurity/ZTESecUtil;->sInstance:Lcom/zte/ZTESecurity/ZTESecUtil;

    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 48
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 50
    return-void
.end method

.method private createDatabase()V
    .locals 2

    .prologue
    .line 284
    const/4 v0, 0x0

    invoke-static {v0}, Landroid/database/sqlite/SQLiteDatabase;->create(Landroid/database/sqlite/SQLiteDatabase$CursorFactory;)Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v0

    sput-object v0, Lcom/zte/ZTESecurity/ZTESecUtil;->mDb:Landroid/database/sqlite/SQLiteDatabase;

    .line 285
    sget-object v0, Lcom/zte/ZTESecurity/ZTESecUtil;->mDb:Landroid/database/sqlite/SQLiteDatabase;

    const-string v1, "CREATE TABLE IF NOT EXISTS empty_table (_id INTEGER PRIMARY KEY AUTOINCREMENT);"

    invoke-virtual {v0, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 288
    return-void
.end method

.method private enforce(Ljava/lang/String;IZILjava/lang/String;)V
    .locals 4
    .param p1, "permission"    # Ljava/lang/String;
    .param p2, "resultOfCheck"    # I
    .param p3, "selfToo"    # Z
    .param p4, "uid"    # I
    .param p5, "message"    # Ljava/lang/String;

    .prologue
    .line 366
    if-eqz p2, :cond_2

    .line 367
    new-instance v1, Ljava/lang/SecurityException;

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    if-eqz p5, :cond_0

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v0, p5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v3, ": "

    invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    :goto_0
    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    if-eqz p3, :cond_1

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "Neither user "

    invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v3, " nor current process has "

    invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    :goto_1
    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v2, "."

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-direct {v1, v0}, Ljava/lang/SecurityException;-><init>(Ljava/lang/String;)V

    throw v1

    :cond_0
    const-string v0, ""

    goto :goto_0

    :cond_1
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "User "

    invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v3, " does not have "

    invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    goto :goto_1

    .line 375
    :cond_2
    return-void
.end method

.method public static getInstance()Lcom/zte/ZTESecurity/ZTESecUtil;
    .locals 1

    .prologue
    .line 54
    sget-object v0, Lcom/zte/ZTESecurity/ZTESecUtil;->sInstance:Lcom/zte/ZTESecurity/ZTESecUtil;

    if-nez v0, :cond_0

    .line 55
    new-instance v0, Lcom/zte/ZTESecurity/ZTESecUtil;

    invoke-direct {v0}, Lcom/zte/ZTESecurity/ZTESecUtil;-><init>()V

    sput-object v0, Lcom/zte/ZTESecurity/ZTESecUtil;->sInstance:Lcom/zte/ZTESecurity/ZTESecUtil;

    .line 57
    :cond_0
    sget-object v0, Lcom/zte/ZTESecurity/ZTESecUtil;->sInstance:Lcom/zte/ZTESecurity/ZTESecUtil;

    return-object v0
.end method

.method private static getPrivacyService()Lcom/zte/privacy/IZTEPrivacyManager;
    .locals 3

    .prologue
    .line 42
    const-string v2, "privacy"

    invoke-static {v2}, Landroid/os/ServiceManager;->getService(Ljava/lang/String;)Landroid/os/IBinder;

    move-result-object v0

    .line 43
    .local v0, "b":Landroid/os/IBinder;
    invoke-static {v0}, Lcom/zte/privacy/IZTEPrivacyManager$Stub;->asInterface(Landroid/os/IBinder;)Lcom/zte/privacy/IZTEPrivacyManager;

    move-result-object v1

    const/4 v1, 0x0

    .line 44
    .local v1, "mService":Lcom/zte/privacy/IZTEPrivacyManager;
    return-object v1
.end method

# virtual methods
.method public checkCallingOrSelfPermission(Ljava/lang/String;)I
    .locals 2
    .param p1, "permission"    # Ljava/lang/String;

    .prologue
    .line 344
    if-nez p1, :cond_0

    .line 345
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string v1, "permission is null"

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 348
    :cond_0
    invoke-static {}, Landroid/os/Binder;->getCallingPid()I

    move-result v0

    invoke-static {}, Landroid/os/Binder;->getCallingUid()I

    move-result v1

    invoke-virtual {p0, p1, v0, v1}, Lcom/zte/ZTESecurity/ZTESecUtil;->checkPermission(Ljava/lang/String;II)I

    move-result v0

    return v0
.end method

.method public checkPermission(Ljava/lang/String;II)I
    .locals 3
    .param p1, "permission"    # Ljava/lang/String;
    .param p2, "pid"    # I
    .param p3, "uid"    # I

    .prologue
    .line 352
    if-nez p1, :cond_0

    .line 353
    new-instance v1, Ljava/lang/IllegalArgumentException;

    const-string v2, "permission is null"

    invoke-direct {v1, v2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v1

    .line 357
    :cond_0
    :try_start_0
    invoke-static {}, Landroid/app/ActivityManagerNative;->getDefault()Landroid/app/IActivityManager;

    move-result-object v1

    invoke-interface {v1, p1, p2, p3}, Landroid/app/IActivityManager;->checkPermission(Ljava/lang/String;II)I
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v1

    .line 360
    :goto_0
    return v1

    .line 359
    :catch_0
    move-exception v0

    .line 360
    .local v0, "e":Landroid/os/RemoteException;
    const/4 v1, -0x1

    goto :goto_0
.end method

.method public checkPermissionsSafe()Z
    .locals 4

    .prologue
    const/4 v2, 0x1

    .line 116
    invoke-static {}, Lcom/zte/ZTESecurity/ZTESecUtil;->getPrivacyService()Lcom/zte/privacy/IZTEPrivacyManager;

    move-result-object v0

    .line 117
    .local v0, "mPrivacyService":Lcom/zte/privacy/IZTEPrivacyManager;
    if-nez v0, :cond_1

    .line 133
    :cond_0
    :goto_0
    return v2

    .line 120
    :cond_1
    invoke-static {}, Landroid/os/Binder;->getCallingUid()I

    move-result v1

    .line 123
    .local v1, "uid":I
    :try_start_0
    const-string v3, "android.permission.ACCESS_COARSE_LOCATION"

    invoke-interface {v0, v3, v1}, Lcom/zte/privacy/IZTEPrivacyManager;->checkCallingPermission(Ljava/lang/String;I)I

    move-result v3

    if-nez v3, :cond_2

    const-string v3, "android.permission.ACCESS_FINE_LOCATION"

    invoke-interface {v0, v3, v1}, Lcom/zte/privacy/IZTEPrivacyManager;->checkCallingPermission(Ljava/lang/String;I)I
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v3

    if-eqz v3, :cond_0

    .line 127
    :cond_2
    const/4 v2, 0x0

    goto :goto_0

    .line 129
    :catch_0
    move-exception v3

    goto :goto_0
.end method

.method public enforceCallPhonePermission()Z
    .locals 4

    .prologue
    const/4 v2, 0x1

    .line 62
    invoke-static {}, Lcom/zte/ZTESecurity/ZTESecUtil;->getPrivacyService()Lcom/zte/privacy/IZTEPrivacyManager;

    move-result-object v0

    .line 63
    .local v0, "mPrivacyService":Lcom/zte/privacy/IZTEPrivacyManager;
    if-nez v0, :cond_1

    .line 74
    :cond_0
    :goto_0
    return v2

    .line 66
    :cond_1
    invoke-static {}, Landroid/os/Binder;->getCallingUid()I

    move-result v1

    .line 68
    .local v1, "uid":I
    :try_start_0
    const-string v3, "android.permission.CALL_PHONE"

    invoke-interface {v0, v3, v1}, Lcom/zte/privacy/IZTEPrivacyManager;->checkCallingPermission(Ljava/lang/String;I)I
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v3

    if-eqz v3, :cond_0

    .line 70
    const/4 v2, 0x0

    goto :goto_0

    .line 72
    :catch_0
    move-exception v3

    goto :goto_0
.end method

.method public enforceCallingOrSelfPermission(Ljava/lang/String;Ljava/lang/String;)V
    .locals 6
    .param p1, "permission"    # Ljava/lang/String;
    .param p2, "message"    # Ljava/lang/String;

    .prologue
    .line 336
    invoke-virtual {p0, p1}, Lcom/zte/ZTESecurity/ZTESecUtil;->checkCallingOrSelfPermission(Ljava/lang/String;)I

    move-result v2

    const/4 v3, 0x1

    invoke-static {}, Landroid/os/Binder;->getCallingUid()I

    move-result v4

    move-object v0, p0

    move-object v1, p1

    move-object v5, p2

    invoke-direct/range {v0 .. v5}, Lcom/zte/ZTESecurity/ZTESecUtil;->enforce(Ljava/lang/String;IZILjava/lang/String;)V

    .line 341
    return-void
.end method

.method public enforceCameraPermission(Ljava/lang/String;I)Z
    .locals 3
    .param p1, "permission"    # Ljava/lang/String;
    .param p2, "uid"    # I

    .prologue
    const/4 v2, 0x1

    .line 264
    invoke-static {}, Lcom/zte/ZTESecurity/ZTESecUtil;->getPrivacyService()Lcom/zte/privacy/IZTEPrivacyManager;

    move-result-object v0

    .line 267
    .local v0, "mPrivacyService":Lcom/zte/privacy/IZTEPrivacyManager;
    if-nez v0, :cond_1

    .line 280
    :cond_0
    :goto_0
    return v2

    .line 272
    :cond_1
    :try_start_0
    invoke-interface {v0, p1, p2}, Lcom/zte/privacy/IZTEPrivacyManager;->checkCallingPermission(Ljava/lang/String;I)I
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v1

    .line 273
    .local v1, "res":I
    if-eqz v1, :cond_0

    .line 280
    .end local v1    # "res":I
    :goto_1
    const/4 v2, 0x0

    goto :goto_0

    .line 276
    :catch_0
    move-exception v2

    goto :goto_1
.end method

.method public enforceChangeBluetoothPermission(Z)Z
    .locals 4
    .param p1, "enable"    # Z

    .prologue
    const/4 v2, 0x1

    .line 187
    invoke-static {}, Lcom/zte/ZTESecurity/ZTESecUtil;->getPrivacyService()Lcom/zte/privacy/IZTEPrivacyManager;

    move-result-object v0

    .line 188
    .local v0, "mPrivacyService":Lcom/zte/privacy/IZTEPrivacyManager;
    if-nez v0, :cond_1

    .line 201
    :cond_0
    :goto_0
    return v2

    .line 191
    :cond_1
    invoke-static {}, Landroid/os/Binder;->getCallingUid()I

    move-result v1

    .line 194
    .local v1, "uid":I
    :try_start_0
    const-string v3, "android.permission.BLUETOOTH_ADMIN"

    invoke-interface {v0, v3, v1, p1}, Lcom/zte/privacy/IZTEPrivacyManager;->checkNeedAskPermission(Ljava/lang/String;IZ)I
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v3

    if-eqz v3, :cond_0

    .line 196
    const/4 v2, 0x0

    goto :goto_0

    .line 198
    :catch_0
    move-exception v3

    goto :goto_0
.end method

.method public enforceChangeNetworkPermission(IZ)Z
    .locals 4
    .param p1, "subId"    # I
    .param p2, "enable"    # Z

    .prologue
    const/4 v2, 0x1

    .line 205
    invoke-static {}, Lcom/zte/ZTESecurity/ZTESecUtil;->getPrivacyService()Lcom/zte/privacy/IZTEPrivacyManager;

    move-result-object v0

    .line 206
    .local v0, "mPrivacyService":Lcom/zte/privacy/IZTEPrivacyManager;
    if-nez v0, :cond_1

    .line 219
    :cond_0
    :goto_0
    return v2

    .line 209
    :cond_1
    invoke-static {}, Landroid/os/Binder;->getCallingUid()I

    move-result v1

    .line 212
    .local v1, "uid":I
    :try_start_0
    const-string v3, "android.permission.CHANGE_NETWORK_STATE"

    invoke-interface {v0, v3, v1, p1, p2}, Lcom/zte/privacy/IZTEPrivacyManager;->checkNeedAskSysPermission(Ljava/lang/String;IIZ)I
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v3

    if-eqz v3, :cond_0

    .line 214
    const/4 v2, 0x0

    goto :goto_0

    .line 216
    :catch_0
    move-exception v3

    goto :goto_0
.end method

.method public enforceChangeWifiPermission(Z)Z
    .locals 4
    .param p1, "enable"    # Z

    .prologue
    const/4 v2, 0x1

    .line 169
    invoke-static {}, Lcom/zte/ZTESecurity/ZTESecUtil;->getPrivacyService()Lcom/zte/privacy/IZTEPrivacyManager;

    move-result-object v0

    .line 170
    .local v0, "mPrivacyService":Lcom/zte/privacy/IZTEPrivacyManager;
    if-nez v0, :cond_1

    .line 183
    :cond_0
    :goto_0
    return v2

    .line 173
    :cond_1
    invoke-static {}, Landroid/os/Binder;->getCallingUid()I

    move-result v1

    .line 176
    .local v1, "uid":I
    :try_start_0
    const-string v3, "android.permission.CHANGE_WIFI_STATE"

    invoke-interface {v0, v3, v1, p1}, Lcom/zte/privacy/IZTEPrivacyManager;->checkNeedAskPermission(Ljava/lang/String;IZ)I
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v3

    if-eqz v3, :cond_0

    .line 178
    const/4 v2, 0x0

    goto :goto_0

    .line 180
    :catch_0
    move-exception v3

    goto :goto_0
.end method

.method public enforcePrivacyNetAccessPermission(Ljava/lang/String;I)V
    .locals 2
    .param p1, "permission"    # Ljava/lang/String;
    .param p2, "uid"    # I

    .prologue
    .line 155
    invoke-static {}, Lcom/zte/ZTESecurity/ZTESecUtil;->getPrivacyService()Lcom/zte/privacy/IZTEPrivacyManager;

    move-result-object v0

    .line 156
    .local v0, "mPrivacyService":Lcom/zte/privacy/IZTEPrivacyManager;
    if-nez v0, :cond_0

    .line 166
    :goto_0
    return-void

    .line 162
    :cond_0
    :try_start_0
    invoke-interface {v0, p1, p2}, Lcom/zte/privacy/IZTEPrivacyManager;->checkNetworkAccessPermission(Ljava/lang/String;I)V
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 163
    :catch_0
    move-exception v1

    goto :goto_0
.end method

.method public enforcePrivacyPermission(Landroid/net/Uri;Ljava/lang/String;)Z
    .locals 4
    .param p1, "uri"    # Landroid/net/Uri;
    .param p2, "permission"    # Ljava/lang/String;

    .prologue
    const/4 v2, 0x1

    .line 315
    invoke-static {}, Lcom/zte/ZTESecurity/ZTESecUtil;->getPrivacyService()Lcom/zte/privacy/IZTEPrivacyManager;

    move-result-object v0

    .line 316
    .local v0, "mPrivacyService":Lcom/zte/privacy/IZTEPrivacyManager;
    if-nez v0, :cond_1

    .line 332
    :cond_0
    :goto_0
    return v2

    .line 319
    :cond_1
    if-eqz p1, :cond_2

    .line 320
    if-eqz p2, :cond_0

    .line 325
    :try_start_0
    invoke-static {}, Landroid/os/Binder;->getCallingUid()I

    move-result v3

    invoke-interface {v0, p2, v3}, Lcom/zte/privacy/IZTEPrivacyManager;->checkCallingPermission(Ljava/lang/String;I)I
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v1

    .line 326
    .local v1, "res":I
    if-eqz v1, :cond_0

    .line 332
    .end local v1    # "res":I
    :cond_2
    :goto_1
    const/4 v2, 0x0

    goto :goto_0

    .line 329
    :catch_0
    move-exception v2

    goto :goto_1
.end method

.method public enforcePrivacyRecordingPermission(Ljava/lang/String;I)Z
    .locals 3
    .param p1, "permission"    # Ljava/lang/String;
    .param p2, "uid"    # I

    .prologue
    const/4 v2, 0x1

    .line 231
    invoke-static {}, Lcom/zte/ZTESecurity/ZTESecUtil;->getPrivacyService()Lcom/zte/privacy/IZTEPrivacyManager;

    move-result-object v0

    .line 234
    .local v0, "mPrivacyService":Lcom/zte/privacy/IZTEPrivacyManager;
    if-nez v0, :cond_1

    .line 246
    :cond_0
    :goto_0
    return v2

    .line 238
    :cond_1
    :try_start_0
    invoke-interface {v0, p1, p2}, Lcom/zte/privacy/IZTEPrivacyManager;->checkRecordingPermission(Ljava/lang/String;I)I
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v1

    .line 239
    .local v1, "res":I
    if-eqz v1, :cond_0

    .line 246
    .end local v1    # "res":I
    :goto_1
    const/4 v2, 0x0

    goto :goto_0

    .line 242
    :catch_0
    move-exception v2

    goto :goto_1
.end method

.method public enforcePrivacySendMmsPermission()Z
    .locals 5

    .prologue
    const/4 v2, 0x1

    .line 301
    invoke-static {}, Lcom/zte/ZTESecurity/ZTESecUtil;->getPrivacyService()Lcom/zte/privacy/IZTEPrivacyManager;

    move-result-object v0

    .line 302
    .local v0, "mPrivacyService":Lcom/zte/privacy/IZTEPrivacyManager;
    if-nez v0, :cond_1

    .line 311
    :cond_0
    :goto_0
    return v2

    .line 305
    :cond_1
    :try_start_0
    const-string v3, "android.permission.ZTE_SEND_MMS"

    invoke-static {}, Landroid/os/Binder;->getCallingUid()I

    move-result v4

    invoke-interface {v0, v3, v4}, Lcom/zte/privacy/IZTEPrivacyManager;->checkCallingPermission(Ljava/lang/String;I)I
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v1

    .line 306
    .local v1, "res":I
    if-eqz v1, :cond_0

    .line 311
    .end local v1    # "res":I
    :goto_1
    const/4 v2, 0x0

    goto :goto_0

    .line 309
    :catch_0
    move-exception v2

    goto :goto_1
.end method

.method public enforceReadLocationPermission()Z
    .locals 5

    .prologue
    const/4 v3, 0x1

    .line 78
    invoke-static {}, Lcom/zte/ZTESecurity/ZTESecUtil;->getPrivacyService()Lcom/zte/privacy/IZTEPrivacyManager;

    move-result-object v0

    .line 79
    .local v0, "mPrivacyService":Lcom/zte/privacy/IZTEPrivacyManager;
    if-nez v0, :cond_1

    .line 91
    :cond_0
    :goto_0
    return v3

    .line 82
    :cond_1
    invoke-static {}, Landroid/os/Binder;->getCallingPid()I

    move-result v1

    .line 83
    .local v1, "pid":I
    invoke-static {}, Landroid/os/Binder;->getCallingUid()I

    move-result v2

    .line 85
    .local v2, "uid":I
    :try_start_0
    const-string v4, "android.permission.ACCESS_FINE_LOCATION"

    invoke-interface {v0, v4, v2}, Lcom/zte/privacy/IZTEPrivacyManager;->checkCallingPermission(Ljava/lang/String;I)I

    move-result v4

    if-eqz v4, :cond_0

    const-string v4, "android.permission.ACCESS_COARSE_LOCATION"

    invoke-interface {v0, v4, v2}, Lcom/zte/privacy/IZTEPrivacyManager;->checkCallingPermission(Ljava/lang/String;I)I
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v4

    if-eqz v4, :cond_0

    .line 87
    const/4 v3, 0x0

    goto :goto_0

    .line 89
    :catch_0
    move-exception v4

    goto :goto_0
.end method

.method public enforceReadPhoneInfoPermission()Ljava/lang/String;
    .locals 5

    .prologue
    const/4 v3, 0x0

    .line 96
    invoke-static {}, Lcom/zte/ZTESecurity/ZTESecUtil;->getPrivacyService()Lcom/zte/privacy/IZTEPrivacyManager;

    move-result-object v0

    .line 97
    .local v0, "mPrivacyService":Lcom/zte/privacy/IZTEPrivacyManager;
    if-nez v0, :cond_1

    .line 112
    :cond_0
    :goto_0
    return-object v3

    .line 100
    :cond_1
    invoke-static {}, Landroid/os/Binder;->getCallingUid()I

    move-result v2

    .line 103
    .local v2, "uid":I
    :try_start_0
    const-string v4, "android.permission.READ_PHONE_STATE"

    invoke-interface {v0, v4, v2}, Lcom/zte/privacy/IZTEPrivacyManager;->checkCallingPermission(Ljava/lang/String;I)I

    move-result v1

    .line 104
    .local v1, "resultOfCheck":I
    if-eqz v1, :cond_0

    .line 105
    const-string v3, "Unknown"
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 107
    .end local v1    # "resultOfCheck":I
    :catch_0
    move-exception v4

    goto :goto_0
.end method

.method public enforceSendMessagePermission()Z
    .locals 4

    .prologue
    const/4 v2, 0x1

    .line 137
    invoke-static {}, Lcom/zte/ZTESecurity/ZTESecUtil;->getPrivacyService()Lcom/zte/privacy/IZTEPrivacyManager;

    move-result-object v0

    .line 138
    .local v0, "mPrivacyService":Lcom/zte/privacy/IZTEPrivacyManager;
    if-nez v0, :cond_1

    .line 151
    :cond_0
    :goto_0
    return v2

    .line 141
    :cond_1
    invoke-static {}, Landroid/os/Binder;->getCallingUid()I

    move-result v1

    .line 144
    .local v1, "uid":I
    :try_start_0
    const-string v3, "android.permission.SEND_SMS"

    invoke-interface {v0, v3, v1}, Lcom/zte/privacy/IZTEPrivacyManager;->checkCallingPermission(Ljava/lang/String;I)I
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v3

    if-eqz v3, :cond_0

    .line 145
    const/4 v2, 0x0

    goto :goto_0

    .line 147
    :catch_0
    move-exception v3

    goto :goto_0
.end method

.method public getDefaultEmptyCursor()Landroid/database/Cursor;
    .locals 9

    .prologue
    const/4 v2, 0x0

    .line 291
    sget-object v1, Lcom/zte/ZTESecurity/ZTESecUtil;->mDb:Landroid/database/sqlite/SQLiteDatabase;

    if-nez v1, :cond_0

    .line 292
    invoke-direct {p0}, Lcom/zte/ZTESecurity/ZTESecUtil;->createDatabase()V

    .line 294
    :cond_0
    new-instance v0, Landroid/database/sqlite/SQLiteQueryBuilder;

    invoke-direct {v0}, Landroid/database/sqlite/SQLiteQueryBuilder;-><init>()V

    .line 295
    .local v0, "qb":Landroid/database/sqlite/SQLiteQueryBuilder;
    const-string v1, "empty_table"

    invoke-virtual {v0, v1}, Landroid/database/sqlite/SQLiteQueryBuilder;->setTables(Ljava/lang/String;)V

    .line 296
    sget-object v1, Lcom/zte/ZTESecurity/ZTESecUtil;->mDb:Landroid/database/sqlite/SQLiteDatabase;

    move-object v3, v2

    move-object v4, v2

    move-object v5, v2

    move-object v6, v2

    move-object v7, v2

    invoke-virtual/range {v0 .. v7}, Landroid/database/sqlite/SQLiteQueryBuilder;->query(Landroid/database/sqlite/SQLiteDatabase;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v8

    .line 297
    .local v8, "cursor":Landroid/database/Cursor;
    return-object v8
.end method

.method public isCameraPermission(Ljava/lang/String;)Z
    .locals 1
    .param p1, "permName"    # Ljava/lang/String;

    .prologue
    .line 257
    const-string v0, "android.permission.CAMERA"

    invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 258
    const/4 v0, 0x1

    .line 260
    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public isNetworkPermission(Ljava/lang/String;)Z
    .locals 1
    .param p1, "permName"    # Ljava/lang/String;

    .prologue
    .line 223
    const-string v0, "android.permission.ACCESS_NETWORK_STATE"

    invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_0

    const-string v0, "android.permission.INTERNET"

    invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_1

    .line 225
    :cond_0
    const/4 v0, 0x1

    .line 227
    :goto_0
    return v0

    :cond_1
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public isRecordingPermission(Ljava/lang/String;)Z
    .locals 1
    .param p1, "permName"    # Ljava/lang/String;

    .prologue
    .line 250
    const-string v0, "android.permission.RECORD_AUDIO"

    invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 251
    const/4 v0, 0x1

    .line 253
    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method


text:
' Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics
Imports Microsoft.CodeAnalysis.UseCoalesceExpression
Imports Microsoft.CodeAnalysis.VisualBasic.UseCoalesceExpression

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.UseCoalesceExpression
    Public Class UseCoalesceExpressionForNullableTests
        Inherits AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest

        Friend Overrides Function CreateDiagnosticProviderAndFixer(workspace As Workspace) As (DiagnosticAnalyzer, CodeFixProvider)
            Return (New VisualBasicUseCoalesceExpressionForNullableDiagnosticAnalyzer(),
                    New UseCoalesceExpressionForNullableCodeFixProvider())
        End Function

        <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseCoalesceExpression)>
        Public Async Function TestOnLeft_Equals() As Task
            Await TestInRegularAndScriptAsync(
"
Imports System

Class C
    Sub M(x as Integer?, y as Integer?)
        Dim z = [||]If (Not x.HasValue, y, x.Value)
    End Sub
End Class",
"Imports System

Class C
    Sub M(x as Integer?, y as Integer?)
        Dim z = If(x, y)
    End Sub
End Class")
        End Function

        <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseCoalesceExpression)>
        Public Async Function TestOnLeft_NotEquals() As Task
            Await TestInRegularAndScriptAsync(
"
Imports System

Class C
    Sub M(x as Integer?, y as Integer?)
        Dim z = [||]If(x.HasValue, x.Value, y)
    End Sub
End Class",
"Imports System

Class C
    Sub M(x as Integer?, y as Integer?)
        Dim z = If(x, y)
    End Sub
End Class")
        End Function

        <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseCoalesceExpression)>
        Public Async Function TestComplexExpression() As Task
            Await TestInRegularAndScriptAsync(
"
Imports System

Class C
    Sub M(x as Integer?, y as Integer?)
        Dim z = [||]If (Not (x + y).HasValue, y, (x + y).Value)
    End Sub
End Class",
"Imports System

Class C
    Sub M(x as Integer?, y as Integer?)
        Dim z = If((x + y), y)
    End Sub
End Class")
        End Function

        <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseCoalesceExpression)>
        Public Async Function TestParens1() As Task
            Await TestInRegularAndScriptAsync(
"
Imports System

Class C
    Sub M(x as Integer?, y as Integer?)
        Dim z = [||]If ((Not x.HasValue), y, x.Value)
    End Sub
End Class",
"Imports System

Class C
    Sub M(x as Integer?, y as Integer?)
        Dim z = If(x, y)
    End Sub
End Class")
        End Function

        <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseCoalesceExpression)>
        Public Async Function TestFixAll1() As Task
            Await TestInRegularAndScriptAsync(
"
Imports System

Class C
    Sub M(x as Integer?, y as Integer?)
        Dim z1 = {|FixAllInDocument:If|} (Not x.HasValue, y, x.Value)
        Dim z2 = If(x.HasValue, x.Value, y)
    End Sub
End Class",
"Imports System

Class C
    Sub M(x as Integer?, y as Integer?)
        Dim z1 = If(x, y)
        Dim z2 = If(x, y)
    End Sub
End Class")
        End Function

        <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseCoalesceExpression)>
        Public Async Function TestFixAll2() As Task
            Await TestInRegularAndScriptAsync(
"
Imports System

Class C
    Sub M(x as Integer?, y as Integer?, z as Integer?)
        dim w = {|FixAllInDocument:If|} (x.HasValue, x.Value, If(y.HasValue, y.Value, z))
    End Sub
End Class",
"Imports System

Class C
    Sub M(x as Integer?, y as Integer?, z as Integer?)
        dim w = If(x, If(y, z))
    End Sub
End Class")
        End Function

        <WorkItem(17028, "https://github.com/dotnet/roslyn/issues/17028")>
        <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseCoalesceExpression)>
        Public Async Function TestInExpressionOfT() As Task
            Await TestInRegularAndScriptAsync(
"
Imports System
Imports System.Linq.Expressions

Class C
    Sub M(x as integer?, y as integer)
        dim e as Expression(of Func(of integer)) = function() [||]If (x.HasValue, x.Value, y)
    End Sub
End Class",
"
Imports System
Imports System.Linq.Expressions

Class C
    Sub M(x as integer?, y as integer)
        dim e as Expression(of Func(of integer)) = function() {|Warning:If (x, y)|}
    End Sub
End Class")
        End Function
    End Class
End Namespace


text:
import React from 'react'
import AllChannelsView from 'components/AllChannelsView/AllChannelsView'

describe('(Component) AllChannelsView', () => {
  it('should exist', () => {

  })
})


text:
/*
 * Created on Aug 11, 2004
 *
 */
package org.kuali.kfs.pdp.dataaccess;

import java.util.List;

/**
 * This class has methods for batch maintenance.
 */
public interface BatchMaintenanceDao {
    /**
     * This method checks if all payments in this batch have open status.
     *
     * @param batchId the batch id
     * @param batchPayments a list of payments for the given batch
     * @param statusList a list of payment statuses
     * @return true if all payments have open status, false otherwise
     */
    public boolean doBatchPaymentsHaveOpenStatus(Integer batchId, List batchPayments, List statusList);

    /**
     * This method checks if all payments in this batch have held status.
     *
     * @param batchId
     * @param batchPayments a list of payments for the given batch
     * @param statusList a list of payment statuses
     * @return true if all payments have held status, false otherwise
     */
    public boolean doBatchPaymentsHaveHeldStatus(Integer batchId, List batchPayments, List statusList);
}


text:
/*
 * Project: B52 reader (https://github.com/FreekDB/b52-reader).
 * License: Apache version 2 (https://www.apache.org/licenses/LICENSE-2.0).
 */

/**
 * Classes that support fetching articles from web sites.
 */
package nl.xs4all.home.freekdb.b52reader.articlesources.website;


text:
import { join } from 'path';
import denodeify from 'denodeify';
import uuid from 'uuid/v1';

import splitIdTracks from '_server/utils/splitIdTracks';

import { getConfig } from '_server/config';

const writeFile = (
  BUNDLE === 'cordova'
  ? () => Promise.reject('Filesystem not available')
  : denodeify(require('fs').writeFile)
);

let prepared = {};
let $db;

export function init(db) {
  $db = db;
  return db.prepareAll({
    getPlayLists: 'select * from PlayLists',
    getPlayList: 'select * from PlayLists where idPlayList = $idPlayList',
    addPlayList:
      `insert or replace into PlayLists (idPlayList, name, idTracks, lastUpdated, idDevice)
          values ($idPlayList, $name, $idTracks, CURRENT_TIMESTAMP, $idDevice)`,
    deletePlayList: `update PlayLists set idTracks = null, lastUpdated = CURRENT_TIMESTAMP,
      idDevice = $idDevice where idPlayList = $idPlayList`,
  })
  .then((p) => {
    prepared = p;
  });
}

// getPlayLists: 'select * from PlayLists order by name',
export function getPlayLists() {
  return prepared.getPlayLists.all()
  .then(playLists => ({ list: playLists.map(splitIdTracks) }));
}

// getPlayList: 'select* from PlayLists where idPlayList = $idPlayList',
export function getPlayList(o) {
  return prepared.getPlayList.get(o.keys)
  .then(splitIdTracks);
}

// addPlayList:
//   `insert into PlayLists (idPlayList,  name,  idTracks, lastUpdated,        idDevice)
//                  values ($idPlayList, $name, $idTracks, CURRENT_TIMESTAMP, $idDevice)`
export function addPlayList(o) {
  const idPlayList = o.keys.idPlayList || uuid();
  return prepared.addPlayList.run({
    idPlayList,
    name: o.data.name,
    idTracks: o.data.idTracks.join(','),
    idDevice: o.data.idDevice || 0,
  })
  .then(() => $db.get('select CURRENT_TIMESTAMP as lastUpdated'))
  .then(row => ({ idPlayList, lastUpdated: row.lastUpdated }));
}

// updatePlayList: `update PlayLists set name = $name,
//     idTracks = $idTracks, lastUpdated = CURRENT_TIMESTAMP, idDevice = $idDevice
//     where idPlayList = $idPlayList`,
export function updatePlayList(o) {
  const name = o.data.name;
  const idTracks = o.data.idTracks;
  return $db.run(
    `insert or replace into PlayLists (
      idPlayList,
      ${name ? 'name,' : ''}
      ${idTracks ? 'idTracks,' : ''}
      lastUpdated,
      idDevice
    ) values (
      $idPlayList,
      ${name ? '$name,' : ''}
      ${idTracks ? '$idTracks,' : ''}
      CURRENT_TIMESTAMP,
      $idDevice
    )`,
    {
      idPlayList: o.keys.idPlayList,
      name: name || undefined,
      idTracks: idTracks ? idTracks.join(',') : undefined,
      idDevice: o.data.idDevice || 0,
    }
  );
}

// deletePlayList: `update PlayLists set idTracks = null, lastUpdated = CURRENT_TIMESTAMP,
//   idDevice = $idDevice where idPlayList = $idPlayList`,
export function deletePlayList(o) {
  return prepared.deletePlayList.run({
    idPlayList: o.keys.idPlayList,
    idDevice: o.data.idDevice || 0,
  });
}

function saveOnePlayList(playList) {
  const musicDir = getConfig('musicDir');
  const fileName = join(musicDir, `${playList.name}.m3u`);
  return $db.all(
    `select title, duration, location, coalesce(AlbumArtist.artist, Artist.artist) as artist
      from Tracks
      left join Artists as AlbumArtist on idAlbumArtist = AlbumArtist.idArtist
      left join Artists as Artist on idAlbumArtist = Artist.idArtist
      where title is not null and idTrack in (${playList.idTracks})`)
    .then(tracks => tracks.reduce((m3u, track) =>
      `${m3u}
#EXTINF:${track.duration || -1},${track.artist || ''} - ${track.title || ''}
${track.location}`,
      '#EXTM3U'
    ))
//    .then(m3u => console.log('----%s\n%s', fileName, m3u))
    .then(m3u => writeFile(fileName, m3u))
    .then(() => fileName);
}

export function saveAllPlayLists() {
  return prepared.getPlayLists.all()
  .then(playLists => Promise.all(
    playLists.map(saveOnePlayList)
  ));
}

export function savePlayList(o) {
  return getPlayList(o)
  .then(saveOnePlayList);
}

export default db =>
    init(db)
    .then(() => ({
      '/': {
        read: getPlayLists,
        create: addPlayList,
      },
      '/:idPlayList': {
        read: getPlayList,
        create: addPlayList,
        update: updatePlayList,
        delete: deletePlayList,
      },
      '/saveAll': {
        create: saveAllPlayLists,
      },
      '/save/:idPlayList': {
        create: [
          savePlayList,
        ],
      },
    })
    );


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>Struct template as_expr</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../domain.html#id-1.3.34.5.9.4.4" title="Description">
<link rel="prev" href="../domain.html" title="Struct template domain">
<link rel="next" href="as_child.html" title="Struct template as_child">

Home
Libraries
People
FAQ
More

Struct template as_expr

boost::proto::domain::as_expr —
            A callable unary MonomorphicFunctionObject that specifies how objects are turned into
            Proto expressions in this domain. The resulting expression object is suitable for storage
            in a local variable.

Synopsis

// In header: <boost/proto/domain.hpp>

// A callable unary MonomorphicFunctionObject that specifies how objects are
// turned into Proto expressions in this domain. The resulting expression
// object is suitable for storage in a local variable.
template<typename T>
struct as_expr :  proto::callable {
  // types
  typedef see-below result_type;

  // public member functions
  result_type operator()(T &) const;
};

Description

              A unary MonomorphicFunctionObject that specifies how objects are turned into Proto
              expressions in this domain. The resulting expression object is suitable for storage
              in a local variable. In that scenario, it is usually preferable to return
              expressions by value; and, in the case of objects that are not yet Proto expressions,
              to wrap them by value (if possible) in a new Proto terminal expression. (Contrast
              this description with the description for
              proto::domain::as_child.)

              The as_expr function object turns objects into
              Proto expressions, if  they are not already, by making them Proto terminals held by
              value if possible. Objects that are already Proto expressions are simply returned
              by value. If
              wants_basic_expr<Generator>::value is true,
              then let E be
              proto::basic_expr;
              otherwise, let E be
              proto::expr.
              Given an lvalue t of type
              T:

                  If T is not a Proto expression type, the resulting
                  terminal is calculated as follows:

                      If T is a function type, an abstract type, or
                      a type derived from std::ios_base, let
                      A be T &.

                      Otherwise, let A be the type
                      T stripped of cv-qualifiers.

                  Then, the result of as_expr<T>()(t) is
                  Generator()(E<tag::terminal,
                  term< A > >::make(t)).

                  Otherwise, the result is t converted to an
                  (un-const) rvalue.

as_expr public member functions

result_type operator()(T & t) const;

<colgroup>
<col align="left" valign="top">
<col>
</colgroup>

Parameters:

<colgroup>
<col align="left" valign="top">
<col>
</colgroup>

t

The object to wrap.

Copyright © 2008 Eric Niebler

        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


text:
package OpenXPKI::Test::More;
use Test::More;
use OpenXPKI::Server::Workflow::WFObject::WFArray;
use OpenXPKI::Client;
use Data::Dumper;
use Class::Std;

{
    use strict;
    use warnings;
    use Carp;

    # don't 'use' Test::More because we override it's methods
    #    require Test::More;

    # Storage for object attributes
    my %user_of : ATTR( get => 'user', set => 'user' );
    my %password : ATTR( get => 'password', set => 'password' );
    my %socketfile :
        ATTR(get => 'socketfile', set => 'socketfile', init_arg => 'socketfile' );
    my %realm : ATTR(get => 'realm', set => 'realm', init_arg => 'realm' );
    my %wfid : ATTR(get => 'wfid', set => 'wfid' );
    my %wftype : ATTR(get => 'wftype', set => 'wftype' );
    my %client : ATTR(get => 'client', set => 'client' );
    my %msg : ATTR(get => 'msg', set => 'msg');
    my %verbose : ATTR(get => 'verbose', set => 'verbose');

    # Handle initialization
    #    sub BUILD {
    #        my ( $self, $id, $args ) = @_;
    #    }

    ############################################################
    # TEST METHODS
    ############################################################

   # Basically, the *_ok, *_nok, *_is, etc. all behave in a
   # similar way -- they call the underlying method and wrap
   # the response into an ok(), etc.
   #
   # The AUTOMETHOD creates a one-size-fits-all solution for this.
   #
   # There is, however, one caveat. In order for AUTOMETHOD to
   # know which parameters are to be passed to the wrapped method,
   # they are passed in an anonymous array as the first parameter.
   #
   # <method>_ok( [ <params for method> ], 'name of test' );
   #
   # <method>_is( [ <params for method> ], <expected value>, 'name of test' );
   #

    sub AUTOMETHOD {
        my $self     = shift;
        my $ident    = shift;
        my $params   = shift;
        my $testname = shift;
        my $subname  = $_;
        my ( $base, $action ) = $subname =~ m/\A (.+)_(.+?) \z/xms
            or return;

        # check that we support the test action
        $action =~ m/\A (ok|nok|is|isnt) \z/xms
            or return;

        # check that we support the underlying method
        $self->can($base)
            or return;

        $testname ||= 'Running ' . $base;

        # methods that take 2 params
        if ( $action =~ /^(ok|nok)$/ ) {
            my $result = $self->$base( @{$params} );
            my $ret = $self->$action( $result, $testname );
            return sub { return $ret }
        }
        # @Fixme: Implement ok/nok and add like
        return;

    }

    sub connect_ok {
        my $self   = shift;
        my %params = @_;

        my $testname = 'Connect to server';
        if ( exists $params{testname} ) {
            $testname = $params{testname};
            delete $params{testname};
        }

        my $ret = $self->connect(%params);
        return $self->ok( $ret, $testname );
    }

    sub create_ok {
        my ( $self, $wftype, $params, $testname ) = @_;
        $testname ||= 'Creating workflow ' . $wftype;
        my $ret = $self->create( $wftype, $params );
        $self->ok( $ret, $testname );
        return $ret;
    }

    sub create_nok {
        my ( $self, $wftype, $params, $testname ) = @_;
        $testname ||= 'Creating workflow ' . $wftype;
        my $result = $self->create( $wftype, $params );
        my $ret = $self->ok( ( not $result ), $testname );
        return $ret;
    }

    sub execute_ok {
        my ( $self, $action, $params, $testname ) = @_;
        $testname ||= 'Executing action ' . $action;
        return $self->ok( scalar( $self->execute( $action, $params ) ),
            $testname );
    }
    sub execute_nok {
        my ( $self, $action, $params, $testname ) = @_;
        $testname ||= 'Executing action ' . $action;
        my $result = scalar $self->execute( $action, $params );
        $result = ($result)?0:1;

        return $self->ok( $result,$testname );
    }

    sub param_is {
        my ( $self, $name, $expected, $testname ) = @_;
        $testname ||= 'Fetching parameter ' . $name;
        return $self->is( $self->param($name), $expected, $testname );
    }

    sub param_isnt {
        my ( $self, $name, $expected, $testname ) = @_;
        $testname ||= 'Fetching parameter ' . $name;
        return $self->isnt( $self->param($name), $expected, $testname );
    }

    sub param_like {
        my ( $self, $name, $expected, $testname ) = @_;
        $testname ||= 'Fetching parameter ' . $name;
        return $self->like( $self->param($name), $expected, $testname );
    }

    sub state_is {
        my ( $self, $state, $testname ) = @_;
        $testname ||= 'Expecting state ' . $state;
        my $currstate = $self->state();

        if ( not defined $currstate ) {
            $currstate = '<undef>';
        }

        if ( not defined $state ) {
            $state = '<undef>';
        }

        if ( $self->get_verbose ) {
            $self->diag("\tstate=$state");
            $self->diag("\ttestname=$testname");
            $self->diag("\tcurrstate=$currstate");
        }
        return $self->is( $currstate, $state, $testname );
    }

    sub error_is {
        my ( $self, $expected, $testname ) = @_;
        $testname ||= 'Checking API message error';
        my $error = $self->error();
        $error ||= '';#avoid undef
        return $self->is($error , $expected, $testname );
    }

    ############################################################
    # HELPER METHODS
    ############################################################
    sub login {
        my $self   = shift;
        my $client = $self->get_client;
        my $user   = $self->get_user;
        my $pass   = $self->get_password;
        my $realm  = $self->get_realm;
        my $msg;

        $client->init_session();

        if ($realm) {
            $msg = $client->send_receive_service_msg( 'GET_PKI_REALM',
                { PKI_REALM => $realm } );
            $self->set_msg($msg);
            if ( $self->error ) {
                $self->diag(
                    "Login failed (get pki realm $realm): " . Dumper $msg);
                return;
            }
            $msg = $client->send_receive_service_msg( 'PING', );
            $self->set_msg($msg);
            if ( $self->error ) {
                $self->diag( "Login failed (ping): " . Dumper $msg);
                return;
            }
        }

        if ($user) {
            $msg
                = $client->send_receive_service_msg(
                'GET_AUTHENTICATION_STACK',
                { 'AUTHENTICATION_STACK' => 'External Dynamic', },
                );
            $self->set_msg($msg);
            if ( $self->error ) {
                $self->diag(
                    "Login failed (stack selection): " . Dumper $msg);
                return;
            }

            $msg = $client->send_receive_service_msg(
                'GET_PASSWD_LOGIN',
                {   'LOGIN'  => $user,
                    'PASSWD' => $pass,
                },
            );
            $self->set_msg($msg);
            if ( $self->error ) {
                $self->diag( "Login failed: " . Dumper $msg);
                return;
            }
        }
        else {
            $msg
                = $client->send_receive_service_msg(
                'GET_AUTHENTICATION_STACK',
                { 'AUTHENTICATION_STACK' => 'Anonymous', },
                );
            $self->set_msg($msg);
            if ( $self->error ) {
                $self->diag(
                    "Login failed (stack selection): " . Dumper $msg);
                return;
            }
        }

        return 1;
    }

    sub connect {
        my $self   = shift;
        my %params = @_;
        foreach my $k ( keys %params ) {
            if ( not $k =~ m/^(user|password|socketfile|realm)$/ ) {
                croak "Invalid parameter '$k' to connect";
            }
        }

        foreach my $k (qw( user password socketfile realm )) {
            if ( exists $params{$k} ) {
                my $accessor = 'set_' . $k;
                $self->$accessor( $params{$k} );
            }
        }

        my $c = OpenXPKI::Client->new(
            {   TIMEOUT    => 100,
                SOCKETFILE => $self->get_socketfile
            }
        );
        if ( not $c ) {
            croak "Unable to create OpenXPKI::Client instance: $@";
        }

        $self->set_client($c);

        if ( $self->get_user ) {
            $self->login(
                {   CLIENT   => $c,
                    USER     => $self->get_user,
                    PASSWORD => $self->get_password,
                    REALM    => $self->get_realm,
                }
            ) or croak "Login as ", $self->get_user(), " failed: $@";
        }
        else {
            $self->login( { CLIENT => $c, REALM => $self->get_realm } )
                or croak "Login as anonymous failed: $@";
        }
        $self->set_msg(undef);
        return $self;
    }

    sub command {

        my ( $self, $name ) = @_;
        my $client = $self->get_client;
        my $command = shift;
        my $params = shift;

        my $msg = $client->send_receive_service_msg( $command , $params );

        $self->set_msg($msg);

        if ( $self->error ) {
            $@ = 'Error getting workflow info: ' . Dumper($msg);
            return sprintf('ERROR %s',$self->error);
        }

        return $msg->{PARAMS};
    }

    sub create {
        my ( $self, $wftype, $params ) = @_;
        my $client = $self->get_client;
        $self->set_wftype($wftype);

        my $msg
            = $client->send_receive_command_msg( 'create_workflow_instance',
            { PARAMS => $params, WORKFLOW => $wftype },
            );

        $self->diag(
            "Command create_workflow_instance returned MSG: " . Dumper($msg) )
            if $self->get_verbose;
        $self->set_msg($msg);
        $self->set_wfid( $msg->{PARAMS}->{WORKFLOW}->{ID} );
        if ( $self->error ) {

            #            $self->diag(" RETURNING ERROR ");
            $@
                = 'Error creating workflow '
                . $wftype
                . ' - MSG: '
                . Dumper($msg);
            return;
        }
        else {
            return $self;
        }
    }

    sub execute {
        my ( $self, $action, $params ) = @_;
        my $msg;
        my $client = $self->get_client;
        my $wftype = $self->get_wftype;
        my $wfid   = $self->get_wfid;

        if ( not defined $params ) {
            $params = {};
        }

        croak("Unable to exec action '$action' on closed connection")
            unless defined $client;

        $msg = $client->send_receive_command_msg(
            'execute_workflow_activity',
            {   'ID'       => $wfid,
                'WORKFLOW' => $wftype,
                'ACTIVITY' => $action,
                'PARAMS'   => $params,
            },
        );
        $self->set_msg($msg);
        $self->diag( "Command $action returned MSG: " . Dumper($msg) )
            if $self->get_verbose;
        if ( $self->error ) {
            $@ = 'Error executing ' . $action . ': ' . Dumper($msg);
            return;
        }
        return $self;
    }

    sub param {
        my ( $self, $name ) = @_;
        my $wfid   = $self->get_wfid;
        my $client = $self->get_client;
        my $msg    = $self->get_msg;

        if ( not $msg ) {
            $msg = $client->send_receive_command_msg( 'get_workflow_info',
                { ID => $wfid } );
        }

        $self->set_msg($msg);

        if ( $self->error ) {
            $@ = 'Error getting workflow info: ' . Dumper($msg);
            return sprintf('ERROR %s',$self->error);
        }

       #        $self->diag(
       #            "context keys: "
       #                . join( ', ',
       #                sort keys %{ $msg->{PARAMS}->{WORKFLOW}->{CONTEXT} } )
       #        );

        my $val = (defined $msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{$name})?$msg->{PARAMS}->{WORKFLOW}->{CONTEXT}->{$name}:'UNDEFINED';
        return $val;
    }

    sub array {
        my ( $self, $name ) = @_;
        my $wfid   = $self->get_wfid;
        my $client = $self->get_client;
        my $msg    = $self->get_msg;

        if ( not $msg ) {
            $msg = $client->send_receive_command_msg( 'get_workflow_info',
                { ID => $wfid } );
        }

        $self->set_msg($msg);
        if ( $self->error ) {
            $@ = 'Error getting workflow info: ' . Dumper($msg);
            return;
        }

        my $val = OpenXPKI::Server::Workflow::WFObject::WFArray->new(
            {
                workflow => $msg->{PARAMS}->{WORKFLOW},
                context_key => $name,
            }
        );
        if ( not $val ) {
            $self->diag("WFArray->new($name) failed: $@");
        }
        return $val;
    }

    sub state {
        my ($self) = @_;
        my $wfid   = $self->get_wfid;
        my $client = $self->get_client;
        my $msg    = $self->get_msg;

        if ( defined $msg and defined $msg->{PARAMS}->{WORKFLOW}->{STATE} ) {
            return $msg->{PARAMS}->{WORKFLOW}->{STATE};
        }

        $msg = $client->send_receive_command_msg( 'get_workflow_info',
            { ID => $wfid } );

        $self->set_msg($msg);
        if ( $self->error ) {
            $@ = 'Error getting workflow info: ' . Dumper($msg);
            return;
        }

   #        $self->diag(
   #            "WF: " . join( ', ', keys %{ $msg->{PARAMS}->{WORKFLOW} } ) );
        return $msg->{PARAMS}->{WORKFLOW}->{STATE};
    }

    sub search {
        my ( $self, $key, $value ) = @_;
        my $client = $self->get_client;

        my $msg = $client->send_receive_command_msg(
            'search_workflow_instances',
            {   CONTEXT => [
                    {   KEY   => $key,
                        VALUE => $value,
                    },
                ],
                TYPE => $self->get_wftype(),
            },
            )
            or die "Error running search_workflow_instances: " . $self->dump;

        return @{ $msg->{PARAMS} };
    }

    sub reset{
        my $self = shift;
        $self->set_msg(undef);
    }

    sub error {
        my $self = shift;
        my $msg  = $self->get_msg;

        if (   $msg
            && exists $msg->{'SERVICE_MSG'}
            && $msg->{'SERVICE_MSG'} eq 'ERROR' )
        {
            return $msg->{'LIST'}->[0]->{'LABEL'} || 'Unknown error';
        }
        else {
            return;
        }
    }

    sub dump {
        my $self = shift;
        foreach (@_) {
            Test::More::diag($_);
        }
        Test::More::diag("Current Test Instance:");
        foreach my $k (qw( user wfid )) {
            my $acc = 'get_' . $k;
            my $v   = $self->$acc();
            if ( not defined $v ) {
                $v = '<undef>';
            }
            Test::More::diag("\t$k: $v");
        }
        my $msg = $self->get_msg;
        if ($msg) {
            Test::More::diag('Contents of $msg:');
            Test::More::diag( Dumper($msg) );
        }
    }

    sub disconnect {
        my $self   = shift;
        my $client = $self->get_client;
        eval { $client && $client->send_receive_service_msg('LOGOUT'); };
        $self->set_client(undef);
        $self->set_msg(undef);
    }

    # Handle cleanup
    sub DEMOLISH {
        my ( $self, $id ) = @_;
    }

    ############################################################
    # Map Test::More subroutines
    ############################################################
    no warnings 'redefine';

    sub diag {
        my $self = shift;
        Test::More::diag(@_);
    }

    sub plan {
        my $self = shift;
        Test::More::plan(@_);
    }

    sub skip {
        my $self = shift;
        Test::More::skip(@_);
    }

    sub is ($$;$) {
        my ( $self, $got, $expected, $testname ) = @_;
        return Test::More::is( $got, $expected, $testname );
    }

    sub isnt ($$;$) {
        my ( $self, $got, $expected, $testname ) = @_;
        return Test::More::isnt( $got, $expected, $testname );
    }

    sub ok ($;$) {
        my ( $self, $test, $name ) = @_;
        return Test::More::ok( $test, $name );
    }

    sub nok ($;$) {
        my ( $self, $test, $name ) = @_;
        return Test::More::ok( !$test, $name );
    }

    sub like ($$;$) {
        my ( $self, $test, $regexp, $name ) = @_;
        return Test::More::like( $test, $regexp, $name );
    }
}

1;

__END__

=head1 NAME

OpenXPKI::Test::More

=head1 DESCRIPTION

This is a helper module for the OpenXPKI test suites. In contrast to
OpenXPKI::Test, this uses an OOP interface that, hopefully, will
simplify handling the connection to the OpenXPKI daemon.

Subclassing is supported, so a test script can have an in-line package
definition to extend this class.

=head1 SYNOPSIS

  #!/usr/bin/perl

  use strict;
  use warnings;

  package MyWFModuleTest;
  use base qw( OpenXPKI::Test::More );

  # object attributes
  my %myattrs : ATTR;

  sub myproc {
    my $self = shift;
    ...
  }

  package main;

  ...

  my $test = MyWFModuleTest->new();
  $test->plan( tests => 3);

  $test->connect_ok(user => 'USER', password => 'PASS',
        socketfile => 'SOCKFILE', realm => 'REALM');
  $test->create_ok($wftype, {});
  $test->state_eq('EXPECTED_STATE');
  $test->disconnect();

=head1 TEST METHODS

These test subroutines act as test methods similar to those found in
Test::More. They will result in an output line that can be parsed
by Test::Harness.

=head2 $test->connect_ok PARAMS

Creates a connection to the OpenXPKI daemon. The arguments, a named-parameter
list, contain the key 'testname', which describes the test for Test::Harness.
If not set, the default test name is printed.
In addition, the arguments for connect() are used.

=head2 $test->create_ok WFTYPE, PARAMSREF, [ TESTNAME ]

Creates a new workflow instance of the given WFTYPE, passing the
reference to the parameter hash PARAMSREF. The TESTNAME is optional.

=head2 $test->create_nok WFTYPE, PARAMSREF, [ TESTNAME ]

Attempts to create a new workflow instance of the given WFTYPE, passing the
reference to the parameter hash PARAMSREF. It is expected that the create()
will fail (i.e.: if the create is successful, this test fails). The
TESTNAME is optional.

=head2 $test->execute_ok ACTION, PARAMSREF, [ TESTNAME ]

Executes the given ACTION on the current workflow, passing the PARAMSREF.
TESTNAME is optional.

=head2 $test->execute_nok ACTION, PARAMSREF, [ TESTNAME ]

Executes the given ACTION on the current workflow, passing the PARAMSREF.
An execution error is expected (i.e.: if the execution is successful, this test fails)
TESTNAME is optional.

=head2 $test->param_is NAME, EXPECTED, [ TESTNAME ]

Fetches the value of the given workflow context parameter NAME and compares
it with the expected value EXPECTED.

Optionally, the test name TESTNAME may be specified.

=head2 $test->state_is EXPECTED, [ TESTNAME ]

Fetches the state of the workflow and compares
it with the expected value EXPECTED.

Optionally, the test name TESTNAME may be specified.

=head1 HELPER METHODS

The helper subroutines provide functionality that doesn't result in
a test (e.g.: "1... ok") entry for harness.

=head2 $test->connect

Creates a connection to the OpenXPKI daemon. The arguments, a named-parameter
list, contain the following keys:

=over 8

=item user

The name of the user to log in as. [optional]

=item pass

The password to use. [optional]

=item socketfile

The socket file to use for the connection.

=item realm

The PKI Realm to use for the connection. [optional]

=back

On success, a reference to SELF is returned.

=head2 $test->create WFTYPE, [ PARAMSREF ]

Create a workflow of the given workflow type WFTYPE. Optionally, a reference
to a named-parameter list PARAMSREF may be passed.

On error, C<undef> is returned and the reason is in C<$@>.

=head2 $test->execute ACTION, [ PARAMSREF ]

Executes the ACTION for the current workflow. Optionally, a reference to
a named-parameter list PARAMSREF may be passed.

=head2 $test->state

Returns the state of the current workflow

=head2 $test->wfid

Returns the workflow ID of the current workflow

=head2 $test->param NAME

Returns the value of the given context parameter for the current workflow.

=head2 $test->reset

resets the internal cached workflow info. can be used to force  "fresh" workflow data from server.
usefull if execution results in an (expected) error and you want to check some workflow property (e.g. context param)

=head2 $test->array NAME

Returns a WFArray object instance that is currently stored in the NAME
workflow context parameter.

=head2 $test->search KEY, VALUE

Searches the workflow records using the given KEY and VALUE. Optionally,
a FILTER may be specified as a grep block and SORTREF may be specified
as a sort block.

  my @results = $test->search( 'token_id', $token);

=head2 $test->error

Returns the error string if the most recent server call failed. Otherwise,
C<undef> is returned.

=head2 $test->set_verbose( 0 | 1 )

Sets the verbosity off or on.

=head2 $test->disconnect

Close the current connection to the OpenXPKI daemon

=head1 Test::More SUBROUTINES

The following subroutines are wrapped in instance methods of this class:

diag, plan, ok, is, like


text:
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
		http://www.springframework.org/schema/aop
		http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

	<mvc:annotation-driven />
	<aop:aspectj-autoproxy />
	<aop:aspectj-autoproxy />

	<!-- Configuring propeties file -->
	<bean id="messageSource"
		class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
		<property name="basename" value="classpath:messages" />
		<property name="defaultEncoding" value="UTF-8" />
	</bean>
	<mvc:interceptors>
		<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
			<property name="paramName" value="lang"></property>
		</bean>
	</mvc:interceptors>

	<!-- Theme Change Interceptor and Resolver definition -->
	<bean id="themeChangeInterceptor"
		class="org.springframework.web.servlet.theme.ThemeChangeInterceptor">
		<property name="paramName" value="theme" />
	</bean>
	<bean id="themeResolver"
		class="org.springframework.web.servlet.theme.CookieThemeResolver">
		<property name="defaultThemeName" value="default" />
	</bean>

	<!-- Tiles Configuration -->
	<bean id="tilesConfigurer"
		class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
		<property name="definitions">
			<list>
				<value>/WEB-INF/tiles.xml</value>
			</list>
		</property>
	</bean>

	<bean id="handlerMapping"
		class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
		<property name="interceptors">
			<list>
				<ref bean="localeChangeInterceptor" />
				<ref bean="themeChangeInterceptor" />
			</list>
		</property>
	</bean>

	<bean id="viewResolver"
		class="org.springframework.web.servlet.view.UrlBasedViewResolver">
		<property name="viewClass"
			value="org.springframework.web.servlet.view.tiles2.TilesView" />
	</bean>

	<bean id="multipartResolver"
		class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
		<!-- one of the properties available; the maximum file size in bytes <property
			name="maxUploadSize" value="200000"/> -->
	</bean>

	<bean
		class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping">
		<property name="interceptors">
			<list>
				<ref bean="localeChangeInterceptor" />
			</list>
		</property>
	</bean>

	<bean id="localeChangeInterceptor"
		class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
		<property name="paramName" value="lang" />
	</bean>

	<bean id="localeResolver"
		class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
		<property name="defaultLocale" value="en" />
	</bean>

</beans>


text:
<resources xmlns:tools="http://schemas.android.com/tools">

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPurpleLight</item>
        <item name="colorPrimaryDark">@color/colorPurpleLight</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:windowBackground">@android:color/white</item>
        <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
    </style>
    <style name="DrawerArrowStyle" parent="@style/Widget.AppCompat.DrawerArrowToggle">
        <item name="spinBars">true</item>
        <item name="color">@android:color/white</item>
    </style>
    <style name="AppThemeFull" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPurpleLight</item>
        <item name="colorPrimaryDark">@color/colorPurpleLight</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

    <style name="h2">
        <item name="android:textSize">@dimen/h2</item>
        <item name="android:textColor">@color/colorTextBlack</item>
    </style>

    <style name="EditText">
        <item name="android:textSize">@dimen/h3</item>
        <item name="android:textColor">@color/colorTextBlack</item>
        <item name="android:textColorHint">@color/colorTextHint</item>
        <item name="android:padding">@dimen/space10</item>
        <item name="android:background">@drawable/bg_top_grey</item>
        <item name="android:textAppearance">@style/Light</item>
    </style>

    <style name="h3Info">
        <item name="android:textSize">@dimen/h3</item>
        <item name="android:textColor">@color/colorTextInfo</item>
    </style>

    <style name="ButtonPink">
        <item name="android:textSize">@dimen/h3</item>
        <item name="android:textColor">@android:color/white</item>
        <item name="android:textAllCaps">false</item>
        <item name="android:background">@drawable/btn_pink</item>
        <item name="android:gravity">center</item>
        <item name="android:stateListAnimator" tools:targetApi="LOLLIPOP">@null</item>
        <item name="android:padding">@dimen/space20</item>
    </style>

    <style name="ButtonGreen">
        <item name="android:textSize">@dimen/h3</item>
        <item name="android:textColor">@android:color/white</item>
        <item name="android:textAllCaps">false</item>
        <item name="android:background">@drawable/btn_green</item>
        <item name="android:gravity">center</item>
        <item name="android:stateListAnimator" tools:targetApi="LOLLIPOP">@null</item>
        <item name="android:padding">@dimen/space20</item>
    </style>

    <style name="Light" parent="android:TextAppearance">
        <item name="fontPath">font/Nunito_Regular.ttf</item>
    </style>

    <style name="LightNav" parent="android:TextAppearance">
        <item name="android:textSize">@dimen/h3</item>
        <item name="fontPath">font/Nunito_Regular.ttf</item>
    </style>

    <style name="ExtraLight" parent="android:TextAppearance">
        <item name="fontPath">font/Nunito_Light.ttf</item>
    </style>

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

</resources>


text:
<?php

final class PhabricatorPasteTransactionComment
  extends PhabricatorApplicationTransactionComment {

  protected $lineNumber;
  protected $lineLength;

  public function getApplicationTransactionObject() {
    return new PhabricatorPasteTransaction();
  }

  public function shouldUseMarkupCache($field) {
    // Only cache submitted comments.
    return ($this->getTransactionPHID() != null);
  }

}


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Hello World!</title>
    <link rel="stylesheet" href="mdl/material.min.css">

    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">

                Run

                    <button style="-webkit-app-region: no-drag; background-color: #f44336;box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2)"
                        class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent">Reboot</button>

            Menu

                Main
                Run
                Link
                Link

                    <input class="mdl-textfield__input" type="text" id="command_name" />

                    command_name...

                    <input class="mdl-textfield__input" type="text" id="command_arg" />

                    command_arg...

                <button id="button_run" onclick="button_run();" style="-webkit-app-region: no-drag; background-color: #ff5722;box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2)"
                    class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent">Run</button>


text:
import {NgModule} from "@angular/core";
import {BrowserModule} from "@angular/platform-browser";
import {FormsModule} from "@angular/forms";
import {CodeSetEditComponent} from "./codeSetEditor.component";

@NgModule({
	imports:[
		BrowserModule,
		FormsModule
	],
	declarations:[
		CodeSetEditComponent,
	],
})
export class CodeSetModule {}


text:
<TITLE>Review for For Love of the Game (1999)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

For Love of the Game (1999)

reviewed by
Edwin Jahiel

BY EDWIN JAHIEL

FOR LOVE OF THE GAME  ***  Directed by Sam Raimi. Written by Dana Stevens from
the novel by Michael Shaara.  Produced by Armyan Bernstein, Amy
Robinson.  Photography, John Bailey. Editing, Eric L. Beason, Arthur
Coburn. Production design,  Neil Spisak. Music, Basil Poledouris.
Cast: Kevin Costner (Billy Chapel), Kelly Preston (Jane Aubrey), John
C. Reilly (Gus Sinski), Jena Malone (Heather), Brian Cox (Gary
Wheeler), J.K. Simmons (Frank Perry), Vin Scully & Steve Lyons (as
themselves), Carmine D. Giovinazzo (Ken Strout), Bill Rogers (Davis
Birch), Hugh Ross (Mike Udall). A Universal release. 137 minutes.
PG-13

Does America love baseball? Has Kevin Costner had box-office hits
with the baseball films Bull Durham and Field of Dreams? Has been
unlucky with  some recent movies --except for Tin Cup where he plays
a golfer? Is The Pope Catholic?

So it made good sense to do a third baseball picture. He is Billy
Chapel, the Detroit Tigers ace pitcher and prime Hall of Fame
candidate. Now he's in New York for a game at Yankee Stadium. His
shoulder hurts. His soul hurts as he is told that his team is being
sold. He's 40, getting older by sports standards. He has 19 years of
pro playing behind him. And his heart is breaking because his girl,
magazine writer Jane (Kelly Preston)  announces that it's all over
between them; that he really needs no one; that his real love is
baseball; that  in a few hours she's off to England where a dream-job
is expecting her.

That's the set-up. From here on out it's flashbacks and flashforwards
that would be artsy and tiresome (but can be a tad tiring)  except
that Sam Raimi --who directed The Evil Dead but caught us by surprise
in 1998 with the so-different A Simple Plan-- manages his script and
his team (of actors) with a sure-hand and an obvious passion for The
Game.

Five years ago Billy and Jane first met. They met cute, but it's
funny and fresh. Their relationship is charted back and forth,
surprises abound, there's even a surprise young girl, Heather (Jena
Malone) who livens, warms up and helps crystallize the lovers'
on-off relationship. More, I cannot say, since this is sports movie
but also a character-driven picture. It has its own levels of
suspense, in personal and in sports matters.

There are some clever inventions (events, scenes, sequences), whether
in rainy New York, sunny Florida or the snowy West. The plot is
highly manipulative of course, as it plays with the characters'
actions and reactions, and with the audience's response to what is
on the screen. The tricks of the trade, both filmic and baseballic,
are out in force. But they are well handled, keep your attention and
do not ever get boring. Even the music score by Greek-American
Poledouris, though generic/romantic, skirts the bombastic repetitions
by Greek-Greek composer Vangelis in that popular sports-movie
Chariots of Fire.

All this would still be high-class routine stuff, were it not for the
superb scenes in the ballpark, their mise-en-scene, their
photography, the realistically filmed crowds : excellent, imaginative
photography, sound-mixes, editing that coordinates people and actions
in the diamond and off it. We get the players, the raucous fans, and
we get the iffy  but touching thoughts of Billy during his mind games
with the opponents. He's fighting (under physical and psychological
handicaps) for his team, his good name, and his exit from the Tigers
(he'll be traded, no matter what happens).

The movie treats its players with a glove (not kid, but still), as we
only see and hear rather comradely things with no trace of
locker-roomitis. The closest to a nasty presence is a young Yankees
batter who looks satanic. Billy foils him again and again. But the
game is a gem of excitement and suspense.

The players (in both senses) are very good, although there is no true
depth in the affair, the setbacks and the Fun With Bill and Jane.
Costner has the right physique for the role, but it  does get a bit
redundant as we watch him suffer. Kelly Preston is convincing as a
real person, as opposed to one playing a part. She does not want to
be a groupie, but the presumed intensity of the affair is made
somewhat ho-hum by three things: the lightning fast, out-of-character
(hers) speed of her initial sex with Billy; our knowledge that so
many male sports figures are incorrigible woman-collectors; and the
studio-imposed carnal cuts in order to get a PG-13 rating. Young Jena
Malone is beautifully cast as she matches perfectly Preston's looks.

The winningest side of the film is the great edge-of-the-seat footage
which works both on baseball lovers and on non-aficionados.

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews