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 Sep 12, 2024
1 parent 5e11eee commit b3a7cc0
Show file tree
Hide file tree
Showing 12 changed files with 1,088 additions and 0 deletions.
75 changes: 75 additions & 0 deletions docs/spring/cs6768fe28-70a7-11ef-9560-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package com.huifer.springboot.kafka.consumer.bean;

import com.huifer.springboot.kafka.consumer.service.KafkaConsumerMessageListener;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.annotation.EnableKafka;
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
import org.springframework.kafka.config.KafkaListenerContainerFactory;
import org.springframework.kafka.core.ConsumerFactory;
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
import org.springframework.kafka.listener.ConcurrentMessageListenerContainer;

import java.util.HashMap;
import java.util.Map;

/**
* <p>Title : KafkaConsumerConfig </p>
* <p>Description : </p>
*
* @author huifer
* @date 2019-06-19
*/
@Configuration
@EnableKafka
public class KafkaConsumerConfig {

@Value("${kafka.consumer.bootstrap-servers}")
private String bootstrap_servers;
@Value("${kafka.consumer.group.id}")
private String group_id;
@Value("${kafka.consumer.enable.auto.commit}")
private String enable_auto_commit;
@Value("${kafka.consumer.auto.commit.interval.ms}")
private String auto_commit_interval_ms;
@Value("${kafka.consumer.key.deserializer}")
private String key_deserializer;
@Value("${kafka.consumer.value.deserializer}")
private String value_deserializer;
@Value("${kafka.consumer.auto.offset.reset}")
private String reset;

public Map config() {
Map<String, Object> conf = new HashMap<>();
conf.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrap_servers);
conf.put(ConsumerConfig.GROUP_ID_CONFIG, group_id);
conf.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, enable_auto_commit);
conf.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, auto_commit_interval_ms);
conf.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, key_deserializer);
conf.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, value_deserializer);
conf.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, reset);
return conf;
}


public ConsumerFactory<Object, Object> consumerFactory() {
return new DefaultKafkaConsumerFactory<>(config());
}

@Bean
public KafkaConsumerMessageListener listener() {
return new KafkaConsumerMessageListener();
}

@Bean
public KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<String, String>> kafkaListenerContainerFactory() {
ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<>();
factory.setConsumerFactory(consumerFactory());
factory.getContainerProperties().setPollTimeout(1500);
return factory;
}


}
86 changes: 86 additions & 0 deletions docs/spring/cs67b1d6ac-70a7-11ef-9560-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/**
* Copyright 2009-2019 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.type;

import org.junit.jupiter.api.Test;

import java.time.ZonedDateTime;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.Mockito.*;

class ZonedDateTimeTypeHandlerTest extends BaseTypeHandlerTest {

private static final TypeHandler<ZonedDateTime> TYPE_HANDLER = new ZonedDateTimeTypeHandler();
private static final ZonedDateTime ZONED_DATE_TIME = ZonedDateTime.now();

@Override
@Test
public void shouldSetParameter() throws Exception {
TYPE_HANDLER.setParameter(ps, 1, ZONED_DATE_TIME, null);
verify(ps).setObject(1, ZONED_DATE_TIME);
}

@Override
@Test
public void shouldGetResultFromResultSetByName() throws Exception {
when(rs.getObject("column", ZonedDateTime.class)).thenReturn(ZONED_DATE_TIME);
assertEquals(ZONED_DATE_TIME, TYPE_HANDLER.getResult(rs, "column"));
verify(rs, never()).wasNull();
}

@Override
@Test
public void shouldGetResultNullFromResultSetByName() throws Exception {
when(rs.getObject("column", ZonedDateTime.class)).thenReturn(null);
assertNull(TYPE_HANDLER.getResult(rs, "column"));
verify(rs, never()).wasNull();
}

@Override
@Test
public void shouldGetResultFromResultSetByPosition() throws Exception {
when(rs.getObject(1, ZonedDateTime.class)).thenReturn(ZONED_DATE_TIME);
assertEquals(ZONED_DATE_TIME, TYPE_HANDLER.getResult(rs, 1));
verify(rs, never()).wasNull();
}

@Override
@Test
public void shouldGetResultNullFromResultSetByPosition() throws Exception {
when(rs.getObject(1, ZonedDateTime.class)).thenReturn(null);
assertNull(TYPE_HANDLER.getResult(rs, 1));
verify(rs, never()).wasNull();
}

@Override
@Test
public void shouldGetResultFromCallableStatement() throws Exception {
when(cs.getObject(1, ZonedDateTime.class)).thenReturn(ZONED_DATE_TIME);
assertEquals(ZONED_DATE_TIME, TYPE_HANDLER.getResult(cs, 1));
verify(cs, never()).wasNull();
}

@Override
@Test
public void shouldGetResultNullFromCallableStatement() throws Exception {
when(cs.getObject(1, ZonedDateTime.class)).thenReturn(null);
assertNull(TYPE_HANDLER.getResult(cs, 1));
verify(cs, never()).wasNull();
}

}
22 changes: 22 additions & 0 deletions docs/spring/cs67fb4d14-70a7-11ef-9560-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.huifer.rmi.rpc.client;

import com.huifer.rmi.rpc.HelloService;

/**
* <p>Title : ClientDemo </p>
* <p>Description : </p>
*
* @author huifer
* @date 2019-06-11
*/
public class ClientDemo {

public static void main(String[] args) {
RpcClientProxy rpcClientProxy = new RpcClientProxy();
HelloService helloService = rpcClientProxy
.clientProxy(HelloService.class, "localhost", 8888);
String jkl = helloService.hello("hello-rpc");
System.out.println(jkl);
}

}
14 changes: 14 additions & 0 deletions docs/spring/cs684bda7c-70a7-11ef-9560-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.huifer.jdk.jvm;

public class SonPojo extends FatherPojo {

private int age;

public SonPojo() {
}

public SonPojo(int age) {
super();
this.age = age;
}
}
20 changes: 20 additions & 0 deletions docs/spring/cs689fe48c-70a7-11ef-9560-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.huifer.design.singleton.nw;

import java.io.Serializable;

public class SerializableSingleton implements Serializable {

private static final SerializableSingleton singleton = new SerializableSingleton();

private SerializableSingleton() {
}


public static SerializableSingleton getInstance() {
return singleton;
}

private Object readResolve() {
return singleton;
}
}
17 changes: 17 additions & 0 deletions docs/spring/cs68ee6918-70a7-11ef-9560-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.github.huifer.simple.shiro.boot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

@SpringBootApplication
@EnableJpaRepositories(basePackages = {"com.github.huifer.simple.shiro.boot.repo"})
@EntityScan(basePackages = {"com.github.huifer.simple.shiro.boot.entity"})
public class ShiroApp {

public static void main(String[] args) {
SpringApplication.run(ShiroApp.class);
}

}
123 changes: 123 additions & 0 deletions docs/spring/cs693c2ae0-70a7-11ef-9560-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
package com.huifer.ssm.pojo;

public class UserWithBLOBs extends User {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user.ssl_cipher
*
* @mbg.generated
*/
private byte[] sslCipher;

/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user.x509_issuer
*
* @mbg.generated
*/
private byte[] x509Issuer;

/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user.x509_subject
*
* @mbg.generated
*/
private byte[] x509Subject;

/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user.authentication_string
*
* @mbg.generated
*/
private String authenticationString;

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user.ssl_cipher
*
* @return the value of user.ssl_cipher
* @mbg.generated
*/
public byte[] getSslCipher() {
return sslCipher;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user.ssl_cipher
*
* @param sslCipher the value for user.ssl_cipher
* @mbg.generated
*/
public void setSslCipher(byte[] sslCipher) {
this.sslCipher = sslCipher;
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user.x509_issuer
*
* @return the value of user.x509_issuer
* @mbg.generated
*/
public byte[] getX509Issuer() {
return x509Issuer;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user.x509_issuer
*
* @param x509Issuer the value for user.x509_issuer
* @mbg.generated
*/
public void setX509Issuer(byte[] x509Issuer) {
this.x509Issuer = x509Issuer;
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user.x509_subject
*
* @return the value of user.x509_subject
* @mbg.generated
*/
public byte[] getX509Subject() {
return x509Subject;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user.x509_subject
*
* @param x509Subject the value for user.x509_subject
* @mbg.generated
*/
public void setX509Subject(byte[] x509Subject) {
this.x509Subject = x509Subject;
}

/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user.authentication_string
*
* @return the value of user.authentication_string
* @mbg.generated
*/
public String getAuthenticationString() {
return authenticationString;
}

/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user.authentication_string
*
* @param authenticationString the value for user.authentication_string
* @mbg.generated
*/
public void setAuthenticationString(String authenticationString) {
this.authenticationString = authenticationString == null ? null : authenticationString.trim();
}
}
Loading

0 comments on commit b3a7cc0

Please sign in to comment.