Skip to content

Commit

Permalink
write a line into test.file
Browse files Browse the repository at this point in the history
  • Loading branch information
huifer committed Dec 18, 2024
1 parent 39295a4 commit c746bb7
Show file tree
Hide file tree
Showing 8 changed files with 348 additions and 0 deletions.
30 changes: 30 additions & 0 deletions docs/spring/cs742249b4-bce0-11ef-949f-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.huifer.zk.rpcclient;

import com.huifer.zk.inter.HelloInInterface;
import com.huifer.zk.regist.ZkConfig;
import com.huifer.zk.zkfind.ZkServerDiscovery;
import com.huifer.zk.zkfind.ZkServerDiscoveryImpl;

/**
* <p>Title : ZkRpcClientRun </p>
* <p>Description : </p>
*
* @author huifer
* @date 2019-06-13
*/
public class ZkRpcClientRun2 {

public static void main(String[] args) {
ZkServerDiscovery discovery = new ZkServerDiscoveryImpl(ZkConfig.CONNECTION_STR);

ZkRpcClient zkRpcClient = new ZkRpcClient(discovery);

for (int i = 0; i < 10; i++) {

HelloInInterface hello = zkRpcClient.clientProxy(HelloInInterface.class);
String kjljkll = hello.hello("kjljkll");
System.out.println(kjljkll);
}
}

}
27 changes: 27 additions & 0 deletions docs/spring/cs744c7892-bce0-11ef-949f-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.github.huifer.shiro;

import static org.junit.Assert.*;
import java.nio.charset.StandardCharsets;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.crypto.hash.Md5Hash;
import org.apache.shiro.mgt.DefaultSecurityManager;
import org.apache.shiro.subject.Subject;
import org.junit.Test;

public class CustomerRealmTest {

@Test
public void testCustomerRealm(){
DefaultSecurityManager defaultSecurityManager = new DefaultSecurityManager();
defaultSecurityManager.setRealm(new CustomerRealm());
SecurityUtils.setSecurityManager(defaultSecurityManager);
Subject subject = SecurityUtils.getSubject();
UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken("admin", "admin2123");
subject.login(usernamePasswordToken);

}



}
27 changes: 27 additions & 0 deletions docs/spring/cs747877f8-bce0-11ef-949f-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Copyright 2009-2018 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ibatis.submitted.default_method;

import org.apache.ibatis.annotations.Select;

interface PackageMapper {
@Select("select * from users where id = #{id}")
User getUserById(Integer id);

default User defaultGetUser(Object... args) {
return getUserById((Integer) args[0]);
}
}
43 changes: 43 additions & 0 deletions docs/spring/cs749ddef8-bce0-11ef-949f-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package org.huifer.rbac.entity.res;

import java.util.Objects;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@Data
@EqualsAndHashCode
public class Result<T> {
private String msg;

private Integer code;

private T data;

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Result<?> result = (Result<?>) o;
return Objects.equals(msg, result.msg) &&
Objects.equals(code, result.code) &&
Objects.equals(data, result.data);
}

@Override
public int hashCode() {
return Objects.hash(msg, code, data);
}

public Result() {
}

public Result(String msg, Integer code, T data) {
this.msg = msg;
this.code = code;
this.data = data;
}
}
38 changes: 38 additions & 0 deletions docs/spring/cs74c84288-bce0-11ef-949f-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Copyright 2009-2015 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ibatis.submitted.inline_association_with_dot;

public class Element {
private Element element;

private String value;

public Element getElement() {
return element;
}

public void setElement(Element anElement) {
element = anElement;
}

public String getValue() {
return value;
}

public void setValue(String aValue) {
value = aValue;
}
}
62 changes: 62 additions & 0 deletions docs/spring/cs74f227ec-bce0-11ef-949f-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* Copyright 2009-2016 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ibatis.reflection.typeparam;

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

public interface Level0Mapper<L, M, N> {

void simpleSelectVoid(Integer param);

double simpleSelectPrimitive(int param);

Double simpleSelect();

List<Double> simpleSelectList();

Map<Integer, Double> simpleSelectMap();

String[] simpleSelectArray();

String[][] simpleSelectArrayOfArray();

<K extends Calculator<?>> K simpleSelectTypeVar();

List<? extends String> simpleSelectWildcard();

N select(N param);

List<N> selectList(M param1, N param2);

List<? extends N> selectWildcardList();

Map<N, M> selectMap();

N[] selectArray(List<N>[] param);

N[][] selectArrayOfArray();

List<N>[] selectArrayOfList();

Calculator<N> selectCalculator(Calculator<N> param);

List<Calculator<L>> selectCalculatorList();

interface Level0InnerMapper extends Level0Mapper<String, Long, Float> {
}

}
114 changes: 114 additions & 0 deletions docs/spring/cs75208448-bce0-11ef-949f-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.util.Properties;

public class MavenWrapperDownloader {

/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL =
"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar";

/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to use instead of the
* default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";

/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";

/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";

public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());

// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if (mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if (mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: : " + url);

File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if (!outputFile.getParentFile().exists()) {
if (!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}

private static void downloadFileFromURL(String urlString, File destination) throws Exception {
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}

}
7 changes: 7 additions & 0 deletions docs/spring/cs7549cc0e-bce0-11ef-949f-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.huifer.bilibili.monitoring.intf.label;

public interface MonitoringInterface<T> {

void monitor(T t);

}

0 comments on commit c746bb7

Please sign in to comment.